[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/3666] New: Comdat/linkonce doesn't merge symbol visibility
From: |
hjl at lucon dot org |
Subject: |
[Bug ld/3666] New: Comdat/linkonce doesn't merge symbol visibility |
Date: |
6 Dec 2006 14:39:29 -0000 |
When a symbol in a comdat/linkonce section has different visibility in different
files, linker doesn't merge symbol visibility:
bash-3.1$ cat foo.c
int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1")))
bar ()
{
return 1;
}
bash-3.1$ cat bar.c
int foo __attribute__ ((section (".gnu.linkonce.d.1"),
visibility ("hidden"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1"), visibility ("hidden")))
bar ()
{
return 1;
}
int
get_foo ()
{
return foo;
}
int
get_bar ()
{
return bar ();
}
bash-3.1$ make
gcc -fPIC -O -c -o bar.o bar.c
gcc -fPIC -O -c -o foo.o foo.c
ld -shared -o lib1.so bar.o foo.o
ld -shared -o lib2.so foo.o bar.o
ld: bar.o: relocation R_X86_64_PC32 against `foo' can not be used when making a
shared object; recompile with -fPIC
ld: final link failed: Bad value
make: *** [lib2.so] Error 1
bash-3.1$
Should we handle this case?
--
Summary: Comdat/linkonce doesn't merge symbol visibility
Product: binutils
Version: 2.18 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: hjl at lucon dot org
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=3666
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/3666] New: Comdat/linkonce doesn't merge symbol visibility,
hjl at lucon dot org <=