Binary compatibility loss regarding errno

H. J. Lu hjl@lucon.org
Mon Dec 30 10:17:00 GMT 2002


On Fri, Dec 27, 2002 at 01:47:45PM -0800, Roland McGrath wrote:
Content-Description: message body text
> > On Fri, Dec 27, 2002 at 01:09:48PM -0800, Roland McGrath wrote:
> > > I consider this an ld bug.  It's invalid to produce other than an
> > > R_386_GLOB_DAT reloc for a data object that is exported at runtime.
> > 
> > If you have a small testcase, I will take a look.
> 
> $ gcc -shared -o loser.so loser.c -Wl,--version-script=loser.v
> $ readelf -r loser.so
> 
> Note no reloc using the symbol `x'.
> 

Content-Description: C source file for ld bug test case
> int x;
> asm(".symver x,x@VERS_1");
> int foo() { return x; }

I believe ld works as expected. Basically

int foo() { return x; }

will use the definition of `x', which is the original symbol, not the
versioned one. Please try

extern int x;
int _x __attribute__((section (".bss")));
asm(".symver _x,x@VERS_1");
int foo() { return x; }

When you use `.symver NAME,NAME2@NODENAME', NAME should be different
from NAME2. Otherwise, you will get many surprises.


H.J.



More information about the Libc-alpha mailing list