bash-3.00$ cat x.c #if 1 extern void foo (); #else extern void foo () __attribute__((visibility ("hidden"))); #endif
void bar () { foo (); } bash-3.00$ ./xgcc -B./ -fPIC -O2 x.c -S -fvisibility=hidden bash-3.00$ more x.s .file "x.c" .text .p2align 4,,15 .globl bar .hidden bar .type bar, @function bar: .LFB2: xorl %eax, %eax jmp [EMAIL PROTECTED] .LFE2: .size bar, .-bar foo is defined in a different file. Why doesn't gcc use "jmp foo" instead of "jmp [EMAIL PROTECTED]"? Use extern void foo () __attribute__((visibility ("hidden"))); works. -- Summary: -fvisibility=hidden has no effect on calling undefined function Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hjl at lucon dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20274