Proper Place for builtin_define(__ELF__)

Michael Eager eager@eagercon.com
Thu Jul 22 00:31:48 GMT 2021



On 7/21/21 5:22 PM, Joel Sherrill wrote:
> 
> 
> On Wed, Jul 21, 2021, 7:12 PM Michael Eager <eager@eagercon.com 
> <mailto:eager@eagercon.com>> wrote:
> 
>     On 7/21/21 2:28 PM, Joel Sherrill wrote:
>      > Hi
>      >
>      > We are in the process of porting RTEMS to the Microblaze and gcc does
>      > not have __ELF__ as a predefine. In looking around at where to
>     add it,
>      > it looks like there are multiple ways to do it. We see variations on
>      > the following patterns:
>      >
>      > + dbxelf.h
>      > + OS specific header in config/
>      > + Arch/OS specific header
>      >
>      > Integrating dbxelf.h into the microblaze seems risky for one simple
>      > builtin_define(). Adding it to config/microblaze/rtems.h won't
>     address
>      > the microblaze-elf target.
>      >
>      > A suggestion on where to add the builtin_predefine is appreciated.
> 
>     There are very few defines for __ELF__ in the GCC target files.
> 
> 
> Many  targets include dbxelf.h from the config.gcc script. There are 130 
> references to that file there. That seems to be where most architectures 
> get it.

AFAIK, no one has ever tried to build microblaze to generate stabs,
and I can't see a good reason why anyone would.  Including dbxelf.h
seems wrong.  I don't have an answer why other arch's do that.

> 
> 
> 
>     Why don't you put this in rtems.h?
> 
> 
> That's ok for a hack but we haven't had to do that on the other ports so 
> it seems wrong.

Yep.

> 
> I didn't mention but without this defined the cdefs.h file in newlib 
> produces incorrect macro definitions for at the weak_reference macro.
> 
> 
>     Alternately, you might put it in microblaze-s.c, wrapped with
>     #ifdef OBJECT_FORMAT_ELF/#endif.
> 
> 
> Ok. This should fix it for microblaze-elf also.

ARM does something which looks screwy to me.  Instead of defining
__ELF__, they pass -D__ELF__ on the CPP command line.

> 
> Thanks.
> 
> --joel
> 
> 
>     -- 
>     Michael Eager
> 

-- 
Michael Eager


More information about the Gcc mailing list