[patch] init_array/fini_array support
Peter S. Mazinger
ps.m at gmx.net
Tue Feb 14 11:44:40 UTC 2006
On Tue, 14 Feb 2006, Peter S. Mazinger wrote:
> On Tue, 14 Feb 2006, Joseph S. Myers wrote:
>
> > On Tue, 14 Feb 2006, Peter S. Mazinger wrote:
> >
> > > probably I miss something, a static binary has the hidden *_array_* as
> > > listed in __uClibc_main.c (!SHARED) (are in libc.a as undefined), but a
> > > dynamic one does not have any reference to _dl_app_*_array (they are in
> > > ld.so -defined, libc.so -undefined, libdl.so -undefined).
> >
> > I don't see the problem. The init_array and fini_array are available both
> > via the magic linker symbols and via the ELF DT_INIT_ARRAY and
> > DT_FINI_ARRAY. In a static binary, the first mechanism is used. In a
> > dynamic binary, __uClibc_main is in libc.so which is linked against ld.so
> > and gets the _dl_app_*_array functions from there.
>
> That won't work like this w/ uclibc's ld.so, we have to enforce compiling
> anything against libc.so and ld.so, else _dl_app_*_array will be undefined
> each app will need DT_NEEDED for ld.so.
We could make generally use of AS_NEEDED (ld-uClibc.so.0) (currently only
enabled if SSP is enabled), I hope that the test in Rules.mak would work
w/ all binutils, because AS_NEEDED in linker scripts is supported as of
binutils-2.16.1, for these libc.so will look like
GROUP ( libc.so.0 uclibc_nonshared.a AS_NEEDED (ld-uClibc.so.0) )
else for other older binutils
GROUP ( libc.so.0 uclibc_nonshared.a ld-uClibc.so.0 )
at least this was my intention
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
More information about the uClibc
mailing list