-fvisibility=protected doesn't work? ay@xlin2:~$ cat 1.c void F1() { } void* F2() { return F1; } jay@xlin2:~$ $HOME/bin/gcc 1.c -fPIC -shared -fvisibility=protected /usr/bin/ld: /tmp/cc0d6EQ3.o: relocation R_386_GOTOFF against protected function `F1' can not be used when making a shared object /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status jay@xlin2:~$ $HOME/bin/gcc -v Using built-in specs. COLLECT_GCC=/home/jay/bin/gcc COLLECT_LTO_WRAPPER=/home/jay/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: /src/gcc-4.5.0/configure -verbose -prefix=/home/jay -disable-bootstrap -disable-multilibs Thread model: posix gcc version 4.5.0 (GCC)
Can you give the output of ld --version ? There might have been a binutils bug about this before.
*** This bug has been marked as a duplicate of 37611 ***