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. jay@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 jay@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 jay@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); }
GCC 4.2.x is no longer maintained, please try newer GCC version(s).
Right, I already reported: no problem with 4.5.1. 4.2.4 is what Debian 5.0 has though. I'll stick with my workaround. I can try 4.3.x, 4.4.x if there is interest (i.e. in fixing them if they are broken; heck for that matter I should probably try stock 4.2.x, instead of Debian's)
(In reply to comment #2) > Right, I already reported: no problem with 4.5.1. > 4.2.4 is what Debian 5.0 has though. Then it should be reported to Debian if they're still maintaining their 4.2 > I'll stick with my workaround. > I can try 4.3.x, 4.4.x if there is interest (i.e. in fixing them if they are > broken; heck for that matter I should probably try stock 4.2.x, instead of > Debian's) If they're broken then there'll be interest, there's just no interest in fixing *anything* in 4.2
It appears to also be ok in 4.3.5. jay@alphalinux:~$ $HOME/gcc-4.3.5/bin/gcc -v Using built-in specs. Target: alphaev5-unknown-linux-gnu Configured with: /home/jay/src/gcc-4.3.5/configure -prefix=/home/jay/gcc-4.3.5 Thread model: posix gcc version 4.3.5 (GCC) jay@alphalinux:~$ $HOME/gcc-4.3.5/bin/gcc 1.c 2.c -fPIC -shared => success 4.4.5 I think has a bootstrap problem in libstdc++, I will confirm and open a separate bug.
No problem with 4.4.5 either. jay@alphalinux:~$ $HOME/gcc-4.4.5/bin/gcc -v Using built-in specs. Target: alphaev5-unknown-linux-gnu Configured with: /home/jay/src/gcc-4.4.5/configure -prefix=/home/jay/gcc-4.4.5 Thread model: posix gcc version 4.4.5 (GCC) jay@alphalinux:~$ $HOME/gcc-4.4.5/bin/gcc 1.c 2.c -fPIC -shared => success
Closing since it's apparently fixed in more recent versions of GCC