dl_iterate_phdr support

John Marino gnugcc@marino.st
Mon Feb 14 15:48:00 GMT 2011


On 2/14/2011 6:10 AM, Ian Lance Taylor wrote:
>
> The test in gcc/configure.ac is unfortunately rather misleading.  That
> result of that test is currently only used on Solaris.
>
> The relevant code can be found in two places: gcc/unwind-dw2-fde-glibc.c
> and gcc/crtstuff.c.  In unwind-dw2-fde-glibc.c it looks like this:
>
> #if !defined(inhibit_libc)&&  defined(HAVE_LD_EH_FRAME_HDR) \
>      &&  (__GLIBC__>  2 || (__GLIBC__ == 2&&  __GLIBC_MINOR__>  2) \
> 	|| (__GLIBC__ == 2&&  __GLIBC_MINOR__ == 2&&  defined(DT_CONFIG)))
> # define USE_PT_GNU_EH_FRAME
> #endif
>
> #if !defined(inhibit_libc)&&  defined(HAVE_LD_EH_FRAME_HDR) \
>      &&  defined(__FreeBSD__)&&  __FreeBSD__>= 7
> # define ElfW __ElfN
> # define USE_PT_GNU_EH_FRAME
> #endif
>
> #if !defined(inhibit_libc)&&  defined(HAVE_LD_EH_FRAME_HDR) \
>      &&  defined(TARGET_DL_ITERATE_PHDR) \
>      &&  defined(__sun__)&&  defined(__svr4__)
> # define USE_PT_GNU_EH_FRAME
> #endif
>
> The idea is that USE_PT_GNU_EH_FRAME should be defined on any system for
> which the linker supports --eh-frame-hdr and the library supports
> dl_iterate_phdr.  As you can see, the test is being done based on the
> library version.  It is done this way because when gcc is being used to
> build the C library, particularly when building a cross-compiler, there
> is no way to test the features that the C library supports.
>
> Ian


Thanks Ian.  If I understand the code in those two files correctly, only 
Solaris, Linux, and FreeBSD is being considered.  If I want to use this 
on Dragonfly 2.9+, NetBSD 5.99+, and/or OpenBSD, I'll have to patch 
these files will the appropriate code.

My FSF copyright assignment papers should have arrived to FSF by now, so 
I will pass along these patches with the others.

For the others, I am waiting for gcc 4.6 to get branched.  Would a 
configuration patch to these files make it into trunk before it's 
branched?  If you take the words "regression fixes and documentation 
only" literally then the answer would be no, it has to wait for 4.7 stage 1.

Regards,
John





More information about the Gcc-help mailing list