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

--- Comment #50 from Iain Sandoe <iains at gcc dot gnu.org> 2011-02-04 10:52:38 
UTC ---
(In reply to comment #49)
> (In reply to comment #38)
> 
> [ you might want to re-check
> http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00274.html would work with
> -flat_namespace - it's not obvious how it resolves that issue].

scratch that - I see it effectively does %L %G %L (which would be a more
conventional way to do what you've posted).  i.e. the patch in comment #17
(with no other changes).

*sigh*. if %L %G %L now apparently works - without Java regressions, then all
the effort to sort out pruning of early links to libSystem should be
irrelevant.  I guess bugs have been fixed in the 10.6.{5,6} releases.  

the (alternate) patch below produces (on 10.6.6):

$ ./gcc/xgcc -Bgcc /Volumes/ScratchCS/tests/linkage.c -o tt -v
...
... -lgcc_ext.10.5 -no_compact_unwind -lSystem -lgcc -v

$ ./gcc/xgcc -Bgcc /Volumes/ScratchCS/tests/linkage.c -o tt -v -flat_namespace
...
...  -lgcc_s.10.5 -lgcc_ext.10.5 -no_compact_unwind -lSystem -lgcc -v

$ ./gcc/xgcc -Bgcc /Volumes/ScratchCS/tests/linkage.c -o tt -v
-mmacosx-version-min=10.5
...
... -macosx_version_min 10.5 ... -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -lSystem -v

It seems to be OK on 10.6 for c++ tests.

*** However, if the patch at comment #17 works for all langs incl. Java *and*
-flat_namespace without regressions, then it is probably a better solution.  


Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h    (revision 169811)
+++ gcc/config/darwin.h    (working copy)
@@ -327,15 +332,19 @@ extern GTY(()) int darwin_ms_struct;
    "%{static-libgcc|static: -lgcc_eh -lgcc;                   \
       shared-libgcc|fexceptions|fgnu-runtime:                   \
        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)       \
-       %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
+       %{Zflat_namespace|Zforce_flat_namespace:                   \
+         %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5);       \
+        :%: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.5 mmacosx-version-min= -lgcc_ext.10.5)       \
-       -lgcc ;                                   \
+       %:version-compare(< 10.6 mmacosx-version-min= -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)   \
+       %{Zflat_namespace|Zforce_flat_namespace:                   \
+         %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5);       \
+        :%: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.5 mmacosx-version-min= -lgcc_ext.10.5)       \
-       -lgcc }"
+       %:version-compare(< 10.6 mmacosx-version-min= -lgcc) }"

 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.

Index: gcc/config/darwin10.h
===================================================================
--- gcc/config/darwin10.h    (revision 169811)
+++ gcc/config/darwin10.h    (working copy)
@@ -21,5 +21,13 @@ along with GCC; see the file COPYING3.  If not see
 /* Fix PR41260 by passing -no_compact_unwind on darwin10 and later until
 unwinder in libSystem is fixed to digest new epilog unwinding notes. */

+/* Also ensure that the FSF static libgcc is linked last (unless the user
+   has specified -static-libgcc, in which case it will be linked earlier
+   by the REAL_LIBGCC_SPEC).  */
+
 #undef LIB_SPEC
-#define LIB_SPEC "%{!static:-no_compact_unwind -lSystem}"
+#define LIB_SPEC \
+"%{!static:                                \
+    %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind)  \
+    -lSystem                                 \
+    %:version-compare(>= 10.6 mmacosx-version-min= -lgcc) }"

Reply via email to