This bug is reproducible inside the glibc testbench:
[jack@needle:nptl]$ gcc -o tst-raise1 tst-raise1.c -static -lpthread
[jack@needle:nptl]$ ./tst-raise1
first raise failed: Invalid argument
Notice:
[jack@needle:nptl]$ gcc -o tst-raise1 tst-raise1.c -static -lpthread -Wl,--cref | grep minimal
__pthread_initialize_minimal /usr/lib/libc.a(libc-tls.o)
It is pulling the the function from the wrong place (it should be pulling it from pthread).
However, simply putting a reference to the function (as dead code) into the test causes it to succeed.
*** tst-raise1.c Sat Aug 4 00:19:45 2007
--- tst-raise1_new.c Sat Aug 4 00:24:30 2007
***************
*** 25,30 ****
--- 25,34 ----
volatile int count;
+ void dead_code(void) {
+ __pthread_initialize_minimal();
+ }
+
void
sh (int sig)
{
[jack@needle:nptl]$ gcc -o tst-raise1_new tst-raise1_new.c -static -pthread
[jack@needle:nptl]$ ./tst-raise1_new
Notice:
[jack@needle:nptl]$ gcc -o tst-raise1_new tst-raise1_new.c -static -pthread -Wl,--cref | grep minimal
__pthread_initialize_minimal /usr/lib/libpthread.a(init.o)
__pthread_initialize_minimal_internal /usr/lib/libpthread.a(init.o)
I've noticed this problem with binutils-2.17. However, I haven't been able to reduce the problem, yet.
Cheers,
--Jack
--
Jack (John) Cummings http://mudshark.org/
PGP fingerprint: F18B 13A3 6D06 D48A 598D 42EA 3D53 BDC8 7917 F802
Attachment:
pgpJ3NKYw_io1.pgp
Description: PGP signature