http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46861
Summary: alpha gcc 4.2 -fPIC visibility hidden => gp-relative relocation against dynamic symbol Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: jay.kr...@cornell.edu I assume this is a known bug in gcc 4.2? No repro with 4.5.1. I worked around it by using a local static signal handler that calls the real one. j...@alphalinux:~$ $HOME/gcc-4.5.1/bin/gcc -v -fPIC 1.c 2.c -shared Target: alphaev5-unknown-linux-gnu Configured with: /home/jay/src/gcc-4.5.1/configure -prefix=/home/jay/gcc-4.5.1 => success j...@alphalinux:~$ gcc -v -fPIC 1.c 2.c -shared Target: alpha-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-libssp --with-long-double-128 --enable-checking=release --build=alpha-linux-gnu --host=alpha-linux-gnu --target=alpha-linux-gnu Thread model: posix gcc version 4.2.4 (Debian 4.2.4-6) /usr/bin/ld: /tmp/ccNIE2XD.o: gp-relative relocation against dynamic symbol SignalHandler /usr/bin/ld: /tmp/ccNIE2XD.o: gp-relative relocation against dynamic symbol SignalHandler /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status j...@alphalinux:~$ cat 1.c 2.c #include <signal.h> void SignalHandler(int signo, siginfo_t *info, void *context) { } #include <string.h> #include <signal.h> #pragma GCC visibility push(hidden) void SignalHandler(int signo, siginfo_t *info, void *context); void F2(void) { struct sigaction act; int r; memset(&act, 0, sizeof(act)); act.sa_sigaction = &SignalHandler; sigaction(0, &act, NULL); }