This is very similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 although that one is marked as fixed. (This could be a dup of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19520 but I can't really tell...) The difference from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 is that this now only happens for me with protected functions and not global variables. The code to reproduce is ``` __attribute__((visibility("protected"))) void f() { } // __attribute__((visibility("protected"))) // int f; void f2(void (*cb)(void*)) { cb((void*)&f); } ``` Which gives the error ``` % LANG=C g++ a.cpp -o liba.so -pthread -fPIC -shared /bin/ld: /tmp/ccvUACGZ.o: relocation R_X86_64_PC32 against protected symbol `_Z1fv' can not be used when making a shared object /bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status ```
Confirmed. Never worked. Not sure if this is invalid source or not.
What might be invalid about the source?
Dup. *** This bug has been marked as a duplicate of bug 19520 ***