https://sourceware.org/bugzilla/show_bug.cgi?id=21661
Bug ID: 21661 Summary: Ld failed to hide versioned common symbol Product: binutils Version: 2.29 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- When hiding a versioned common symbol, the wrong address is used: [hjl@gnu-tools-1 xxx]$ cat foo.c char *foo; #ifdef COMPAT asm (".symver foo,foo@VERS.1"); #endif void check (char **p) { if (p != &foo) __builtin_abort (); } [hjl@gnu-tools-1 xxx]$ cat main.c extern void check (); extern char *foo; int main () { check (&foo); return 0; } [hjl@gnu-tools-1 xxx]$ cat foo.v VERS.1 { global: foo; }; [hjl@gnu-tools-1 xxx]$ make gcc -g -fPIC -c -o foo1.o foo.c ./ld -o foo1.so -shared foo1.o --version-script foo.v -soname=foo.so gcc -g -fPIC -DCOMPAT -c -o foo2.o foo.c ./ld -o foo2.so -shared foo2.o --version-script foo.v -soname=foo.so gcc -g -c -o main.o main.c gcc -o x main.o foo1.so -Wl,-R,. readelf -sW foo1.so | grep foo 5: 0000000000201020 8 OBJECT GLOBAL DEFAULT 14 foo@@VERS.1 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS foo.c 29: 0000000000201020 8 OBJECT GLOBAL DEFAULT 14 foo readelf -sW foo2.so | grep foo 2: 0000000000201020 8 OBJECT GLOBAL DEFAULT 12 foo@VERS.1 19: 0000000000000000 0 FILE LOCAL DEFAULT ABS foo.c 22: 0000000000201028 8 OBJECT LOCAL DEFAULT 12 foo foo should have the same address as foo@VERS.1. 25: 0000000000201020 8 OBJECT GLOBAL DEFAULT 12 foo@VERS.1 ln -sf foo1.so foo.so ./x ln -sf foo2.so foo.so ./x Makefile:7: recipe for target 'all' failed make: *** [all] Aborted (core dumped) [hjl@gnu-tools-1 xxx]$ -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils