This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Add native ELF and LTO support in collect2


On Mon, 11 Oct 2010, Andi Kleen wrote:

> On Mon, Oct 11, 2010 at 02:33:07PM +0000, Joseph S. Myers wrote:
> > On Mon, 11 Oct 2010, Andi Kleen wrote:
> > 
> > > Controlled by a define in the OS specific config file.
> > > I only enabled this on x86 Linux for now.
> > 
> > OBJECT_FORMAT_ELF is already defined in elfos.h where it belongs (and in 
> > several target-specific headers where it doesn't belong - some duplicating 
> > the definition in elfos.h, others ELF targets that don't use elfos.h for 
> > whatever reason).
> 
> What do you suggest? Use a different name?

No.  Just allow this code to apply for all ELF targets like it should, 
rather than trying to enable it specially only for one particular target.

> > > +#if  !defined (HAVE_LIBELF_H) || !defined (HAVE_GELF_H)  \
> > > +  || !defined (HAVE_UNISTD_H) || !defined (HAVE_FCNTL_H) \
> > > +  || defined (CROSS_DIRECTORY_STRUCTURE)
> > 
> > Why the CROSS_DIRECTORY_STRUCTURE conditional?
> 
> I wasn't sure if the host libelf works from cross compilation.

libelf should work for all targets for any host.

> Also some of the other elf format code had checks for it so
> I thought it was safer to exclude.

What code are you talking about?  The compiler should never behave 
differently for a particular target depending on the host unless you have 
a properly understood reason for it; such a difference certainly isn't 
"safer", it's dangerous.  If it's a matter of non-GNU native linkers, the 
conditional should be on the choice of linker, not on whether it's a cross 
compiler.  If it's a matter of native system headers describing an object 
file format, that won't apply with libelf (and in any case, adding 
equivalent GNU headers describing the format is the correct approach).  
CROSS_DIRECTORY_STRUCTURE should only ever be used when it is genuinely 
the *directory structure* - the locations of various files - that is 
relevant.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]