bash-3.2$ cat x.c extern void foo() __attribute__((weak,visibility("hidden"))); extern int puts( char const* ); int main() { foo ? foo() : puts( "foo == null, skipped." ); return 0; } bash-3.2$ /usr/gcc-4.4/bin/gcc -B./ -fPIC -g -c -o x.o x.c bash-3.2$ ./ld -shared -o libx.so x.o ./ld: x.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 bash-3.2$ /usr/gcc-4.4/bin/gcc -B./ -fPIC -g -c -o x.o x.c -m32 bash-3.2$ ld -m elf_i386 -shared -o libx.so x.o bash-3.2$
Linker should issue clear error message for both cases. -- Summary: Linker doesn't check weak and hidden symbols Product: binutils Version: 2.19 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: hjl dot tools at gmail dot com CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=5789 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils