[David Mosberger <davidm@hpl.hp.com>] problem with unwind info for .init/.fini sections

H . J . Lu hjl@lucon.org
Sat Mar 2 14:07:00 GMT 2002


On Sat, Mar 02, 2002 at 01:56:56PM -0800, David Mosberger wrote:
> >>>>> On Sat, 2 Mar 2002 13:43:44 -0800, "H . J . Lu" <hjl@lucon.org> said:
> 
>   HJ> I noticed 2 problems:
> 
>   HJ> 1. glibc doesn't support .*_array in executales. elf/dl-init.c is not
>   HJ> used on executables. However, sysdeps/generic/libc-start.c doesn't
>   HJ> know how to do it. Glibc needs to be modified to call those functions
>   HJ> with __*_array_start/__*_array_end.
> 
> Yes, I noticed that, too.  Wouldn't libc-start.c also have to call the
> preinit array if the program is statically linked?

Yes.

> 
>   HJ> We can use
> 
>   HJ> +  { ".init_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE         }, 
>   HJ> +  { ".fini_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE         },
>   HJ> +  { ".preinit_array",SHT_PROGBITS, SHF_ALLOC + SHF_WRITE   }, 
> 
>   HJ> in gas and let bfd to set the section type. Or we can teach gcc about
>   HJ> those special sections.
> 
> The latter seems better.  On targets where this is supported, we'll
> want gcc to use the arrays at any rate (it's certainly true for ia64,
> due to the unwind issues that started this discussion).

Something like the `constructor_array' attribute? On the other hand,
it may be nice to use those special functions in the existing gcc.


H.J.



More information about the Binutils mailing list