[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/21661] New: Ld failed to hide versioned common symbol
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/21661] New: Ld failed to hide versioned common symbol |
Date: |
Fri, 23 Jun 2017 12:14:48 +0000 |
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:
address@hidden xxx]$ cat foo.c
char *foo;
#ifdef COMPAT
asm (".symver foo,address@hidden");
#endif
void
check (char **p)
{
if (p != &foo)
__builtin_abort ();
}
address@hidden xxx]$ cat main.c
extern void check ();
extern char *foo;
int
main ()
{
check (&foo);
return 0;
}
address@hidden xxx]$ cat foo.v
VERS.1 {
global:
foo;
};
address@hidden 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 address@hidden
19: 0000000000000000 0 FILE LOCAL DEFAULT ABS foo.c
22: 0000000000201028 8 OBJECT LOCAL DEFAULT 12 foo
foo should have the same address as address@hidden
25: 0000000000201020 8 OBJECT GLOBAL DEFAULT 12 address@hidden
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)
address@hidden xxx]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/21661] New: Ld failed to hide versioned common symbol,
hjl.tools at gmail dot com <=