This is the mail archive of the
mailing list for the binutils project.
Undef weak ref to _init/_fini causes DT_INIT/DT_FINI in DSO
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 9 Apr 2002 19:15:06 +0200
- Subject: Undef weak ref to _init/_fini causes DT_INIT/DT_FINI in DSO
But should it be that way? Right now you get those DT_INIT and
DT_FINI tags, with 0 for the address (their d_ptr value).
To wit, if I create a shared library consisting only of (by way
of -fpic -nostdlib -nostartfiles -shared):
extern char _init __attribute__ ((__weak__));
Should that shared library have a DT_INIT due to this weak
I can't find anything conclusive in
which should be all the RTFM needed (other pointers welcome).
IMHO, there should be no DT_INIT or DT_FINI if there are only
(weak) undefined references. Note that the d_ptr value isn't
relocated; it will stay 0 no matter what _init or _fini are in
other libraries at runtime. (Even if it could, another
libraries _init or _fini shouldn't be used for this library.)
Of course, relying on behavior one way or the other is improper.
(Found in uClibc, they say it's 0.9.10.)
(Place to patch: elflink.h:NAME(bfd_elf,size_dynamic_sections),
about line 3172.)