This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR47558


   Currently FSF gcc 4.6 is improperly linking libgcc when targeting Mac OS X
10.6. Both Apple's gcc 4.2.1 and clang precedes the linkage of -lgcc with
-lSystem to insure that libgcc.a's ___enable_execute_stack doesn't cause the 
non-system unwinder to be used for mmacosx-version-min=10.6. Note that the Apple
linker developer was firm that only the unwinder from libSystem should be used
under 10.6. However, for FSF gcc, preceding the linkage on -lgcc with -lSystem is
insufficient to resolve PR47558 since -lgcc_ext.10.5 appears to act as a corner case.
As Apple doesn't link against the stub libgcc_s.10.5 for mmacosx-version-min=10.6,
it is unwise to assume that handling of stubs for libgcc_s.1.dylib hasn't changed 
or become buggy when 10.6 is targeted. I was told that Apple intends to eventually 
eliminate the linkage on -lgcc entirely so buggy handling of stubs for libgcc_s under
mmacosx-version-min=10.6 isn't that implausible.
   The attached patch resolves PR47558 by changing our linkage under
mmacosx-version-min=10.6 from...

-lgcc_ext.s.10.5 -lgcc -no_compact_unwind -lSystem

to the more proper linkage of...

-lSystem -lgcc_ext.s.10.5 -lgcc -no_compact_unwind -lSystem

Okay for gcc trunk after full regression tests on x86_64-apple-darwin10?
                   Jack
ps While this changes our linkage order to...

	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10)
	/sw/lib/gcc4.6/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

I would note that Apple's compiler doesn't do this since all the symbols in their system
libgcc_s.1.dylib are protected with magic symbols...

0000000000000ee8 S $ld$add$os10.4$__Unwind_Backtrace
0000000000000eea S $ld$add$os10.4$__Unwind_DeleteException
...
0000000000000ee9 S $ld$add$os10.5$__Unwind_Backtrace
0000000000000eeb S $ld$add$os10.5$__Unwind_DeleteException

hence their lack of a need to worry about the linkage position of /usr/lib/libgcc_s.10.5.dylib
relative to /usr/lib/libSystem.B.dylib.

2011-02-04  Jack Howarth <howarth@bromo.med.uc.edu>

	PR target/47558
	config/darwin.h (REAL_LIBGCC_SPEC): Precede -lgcc_ext.10.5
	and -lgcc with -lSystem for mmacosx-version-min>=10.6.


Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 169820)
+++ gcc/config/darwin.h	(working copy)
@@ -329,11 +329,13 @@ extern GTY(()) int darwin_ms_struct;
        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)	   \
        %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4)	   \
+       %:version-compare(>= 10.6 mmacosx-version-min= -lSystem)            \
        %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5)	   \
        -lgcc ;								   \
       :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
        %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4)	   \
+       %:version-compare(>= 10.6 mmacosx-version-min= -lSystem)            \
        %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5)	   \
        -lgcc }"
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]