[uClibc] Proposal adding -z defs by default
Peter S. Mazinger
ps.m at gmx.net
Wed Nov 3 07:54:57 UTC 2004
On Wed, 3 Nov 2004, Joakim Tjernlund wrote:
> > On Tue, 2 Nov 2004, Joakim Tjernlund wrote:
> >
> > > > Hello!
> > > >
> > > > My proposal is to add -z defs to all relevant locations Rules.mak and some
> > > > subdir Makefiles that do not inherit LDFLAGS from Rules.mak to be sure
> > > > that we don't end up w/ some undefined symbols. To have this work there is
> > > > only one issue how to get -z defs resolve __uClibc_main (reported in an
> > > > earlier mail).
> > > > I can provide a patch to add -z defs to all (less libc.so) lib builds,
> > > > the current implementation does not allow to use it generically.
> > > > It helped me for ex. to catch a failure in the relro patch, w/o it libdl
> > > > would have been unusable.
> > > > The question is only were to add some dummy entry (extern ... attribute
> > > > weak) to the sources, so that -z defs will be happy w/ __uClibc_main.
> > > >
> > > > Peter
> > >
> > > Adding "weak_function" to main, "extern int main(int argc, char **argv, char **envp) weak_function;",
> > > in libc/misc/internals/__uClibc_main.c would probaly do it.
> >
> > main is undefined, would it work than?
> >
> > Peter
>
> Yes, unless I am mistaken, ld complain that main is undefined in __uClibc_main.c. Making it weak
> will shut up ld and resolve to NULL iff no main function is found elsewere. That would also mean that
> if you try ty build an exec and forget to define main, you will probably NOT get a compliant from ld
> about missing main function.
Then I wouldn't add that ;-(, it would introduce probably more trouble.
Would you accept a patch that ignores libc, but adds -z defs to LDFLAGS to
all other libs?
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