This bug is reproducible inside the glibc testbench:

    [EMAIL PROTECTED]:nptl]$ gcc -o tst-raise1 tst-raise1.c -static -lpthread 
    [EMAIL PROTECTED]:nptl]$ ./tst-raise1
    first raise failed: Invalid argument

Notice:

    [EMAIL PROTECTED]: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)
  {


    [EMAIL PROTECTED]:nptl]$ gcc -o tst-raise1_new tst-raise1_new.c -static 
-pthread
    [EMAIL PROTECTED]:nptl]$ ./tst-raise1_new

Notice:

    [EMAIL PROTECTED]: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: pgp18WbyWz6Lg.pgp
Description: PGP signature

Reply via email to