Prepending underscores to symbol names in dlsym() (commit 20613)

Will Newton will.newton at gmail.com
Tue Jan 8 11:22:01 UTC 2008


On Jan 8, 2008 10:14 AM, Paul Mundt <lethal at linux-sh.org> wrote:

> > Hmm, no, I think what I said is correct. If no underscores is NOT
> > defined then we prepend the underscore.
> >
> You both appear to be in agreement on the result. The patch does
> precisely what is described:

Incidentally the patch I refer to is not the posted one, the patch I
was referring to is this one:

http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/uClibc/ldso/libdl/libdl.c?rev=20613&r1=20612&r2=20613

> > > +++ trunk/uClibc/ldso/include/dl-defs.h 2007-12-03 22:46:53 UTC (rev 20613)
> > > @@ -175,4 +175,10 @@
> > >  # define DL_MALLOC_ALIGN (__WORDSIZE / 8)
> > >  #endif
> > >
> > > +#ifdef __UCLIBC_NO_UNDERSCORES__
> > > +#define __C_SYMBOL_PREFIX__ ""
> > > +#else
> > > +#define __C_SYMBOL_PREFIX__ "_"
> > > +#endif
> > > +
> > >  #endif /* _LD_DEFS_H */
> > >
>
> Additionally, this sort of backwards logic is precisely why having
> inverted ifdef logic is absolute brain-damage.

Agreed.

> #ifndef __UCLIBC_UNDERSCORES__ is infinitely more readable, even though
> an #ifdef __UCLIBC_HELP_MY_TOOLCHAIN_SUCKS__ would be more intuitive at
> first glance (and more fitting, for those insisting on using -elf
> toolchains). It's like SYMBOL_PREFIX() hell all over again..

Unfortunately it's a battle I have fought and lost for our toolchain.



More information about the uClibc mailing list