http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54083



Jack Howarth <howarth at nitro dot med.uc.edu> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |howarth at nitro dot

                   |                            |med.uc.edu



--- Comment #12 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-11-19 
17:00:21 UTC ---

(In reply to comment #11)

> Author:    hjl

> Date:    Mon Nov 5 21:59:49 2012 UTC (13 days, 18 hours ago)

> New Revision: 193193

> 

> URL: http://gcc.gnu.org/viewcvs?view=revision&sortby=date&revision=193193

> Log:    

>     * gcc.dg/torture/pr53922.c: Use -Wl,-undefined,dynamic_lookup on

>     darwin.

> 

> Modified:

>     trunk/gcc/testsuite/ChangeLog

>     trunk/gcc/testsuite/gcc.dg/torture/pr53922.c

>  

> This does not fix the failures for powerpc-apple-darwin9.



This is will never be fixable for darwin9 short of using a newer linker as the

test case for radr://10466868, "-undefined dynamic_lookup linker bug" fails

under Xcode 3.1.4.



17-Nov-2011 08:22 PM Jack Howarth:

Summary: The following weak.c test case reveals a linker bug in -undefined

dynamic_lookup in Xcode 4.2/4.2.1 under both darwin10 and darwin11.



--------------- weak.c ---------------------

#include <stdio.h>



char *myweakfunc(void) __attribute__((weak)) ;



int main(int argc, char **argv)

{

  if (myweakfunc)

    printf ("found myweakfunc %s\n", myweakfunc());

  else

    printf("Weak func not found\n");

  return 0;

}

-------------------------------------------



Steps to Reproduce:

1) Install Xcode 4.2 on darwin10 or darwin11.

2) Compile the weak.c test case with...



/usr/bin/llvm-gcc weak.c -o wk -undefined dynamic_lookup



3) Execute the resulting "wk" executable



Expected Results:



I expected the same results as is seen when the weak.c test case is compiled

with llvm-gcc from Xcode 3.2.6...



howarth% /Developer-3.2.6/usr/bin/llvm-gcc weak.c -o wk -undefined

dynamic_lookup

howarth% ./wk

Weak func not found



Actual Results:



The resulting binary fails to execute with the runtime error...



dyld: Symbol not found: _myweakfunc

  Referenced from: /Users/howarth/./wk

  Expected in: flat namespace

 in /Users/howarth/./wk

Trace/BPT trap



This behavior was works in Xcode 3.2.6 up to Xcode 4.2 where it was broken

again. It was fixed again after Xcode 4.4.1 and we should be careful to test

for this linker behavior in the FSF gcc testsuite to insure that Apple doesn't

break it again.



Note that MacPorts provides an ld64 package on powerpc darwin9 which is based

on the linker from Xcode 3.2.6 which should work.

Reply via email to