Re: [PATCH] cross-architecture ELF clean up

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Roman Zippel <zippel@...>
Cc: Eric W. Biederman <ebiederm@...>, lkml <linux-kernel@...>, Andrew Morton <akpm@...>, Linux Arch <linux-arch@...>, Al Viro <viro@...>
Date: Friday, June 29, 2007 - 10:53 am

Roman Zippel wrote:

It seems cleanest to just put all the constants in one place rather than 
scatter them around based on how they happen to be used.



I want to be able to include a header to get just the ELF type and 
constant definitions with no other crud.  Both arch-independent ELF 
definitions, and the ones parameterised by ELF_CLASS.

I want this for three reasons:

   1. one is the general cleanup that allows people to use
      forward-declared ELF types in general kernel headers without
      needing to pull in the full set of ELF headers
   2. and to be able to pull full ELF declarations into code which can't
      deal with Linux headers, such as bootloader code which doesn't
      compile in the same universe as the rest of the kernel
   3. a way of getting arch-dependent but broadly common ELF parameters
      in a consistent way

This is complicated by the fact that each architecture needs to define 
some arch-dependent ELF structures which will end up having wider 
dependencies.  The classic example is the ELF note for core files which 
contains register and other process state, and that will naturally pull 
in a bunch of other headers to implement that.  Unfortunately, the 
current structure of the ELF headers mean that any user with the 
slightest interest in ELF structures will end up pulling in half the 
kernel headers via the asm/elf.h includes.

So my solution was to factor the ELF definitions into useful groups that 
allow the various users to pull in what they need.  The breakdown is:

    * arch-independent ELF forward declarations: linux/elf-decl.h
    * arch-independent constants: linux/elf-const.h
    * arch-independent ELF structure definitions: linux/elf-defn.h
    * arch-parameterised ELF declarations: asm/elf-defines.h

and because more or less all the architectures do the same thing for 
their parameterised ELF types (albeit inconsistently), I pulled the 
implementation into asm-generic/elf{32,64}-defines.h, and the typical 
asm/elf-defines.h ends up being a single line to include the appropriate 
one.

I'd agree that linux/elf-const.h and linux/elf-decl.h could probably be 
folded together.


Which architecture?  The variation of other includes in the various 
asm-*/elf.h headers is very broad.

On i386, it ends up being dependent on the mach-* subarch mess, which 
doesn't work in the boot code.  Since there's nothing about the ELF 
definitions which is subarch-dependent, so that's clearly a bogus 
dependency.


Yes, but it does get a bit subtle.  x86-64 does strange things with 
redefining the ELF class to compile a 32-bit binfmt_elf, and I think 
other architectures play similar games.   Rearranging these headers is 
pretty fragile, and I think my approach is a bit less likely to 
(possibly) break things.  But I haven't cross-compiled all the 
architectures, so I may have broken stuff anyway.


Yes, but only for the module.h case.  My concerns are wider.

    J
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Wed Jun 20, 7:08 pm)
Re: [PATCH] cross-architecture ELF clean up, Paul Mackerras, (Fri Jun 29, 12:48 am)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Fri Jun 29, 1:31 am)
Re: [PATCH] cross-architecture ELF clean up, Paul Mackerras, (Fri Jun 29, 12:13 am)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Fri Jun 29, 1:31 am)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Mon Jun 25, 11:18 am)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Tue Jun 26, 3:28 pm)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Mon Jun 25, 9:37 am)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Tue Jun 26, 3:29 pm)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Wed Jun 27, 7:25 pm)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Thu Jun 28, 11:45 am)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Thu Jun 28, 5:48 pm)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Fri Jun 29, 10:53 am)
Re: [PATCH] cross-architecture ELF clean up, Sam Ravnborg, (Fri Jun 29, 2:12 pm)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Sun Jul 1, 12:23 pm)
Re: [PATCH] cross-architecture ELF clean up, David Woodhouse, (Mon Jun 25, 5:02 am)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Mon Jun 25, 9:40 am)
Re: [PATCH] cross-architecture ELF clean up, Clemens Koller, (Mon Jun 25, 9:56 am)
Re: [PATCH] cross-architecture ELF clean up, Roman Zippel, (Mon Jun 25, 10:06 am)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Mon Jun 25, 8:43 am)
Re: [PATCH] cross-architecture ELF clean up, Chris Zankel, (Thu Jun 21, 12:49 pm)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Thu Jun 21, 2:31 pm)
Re: [PATCH] cross-architecture ELF clean up, Jeremy Fitzhardinge, (Thu Jun 21, 11:06 am)