ld needs to be passed the correct arch flag when building shared libs.

This means that the multi-libs built for 4.6.x and trunk contain junk (essentially all the input objects are rejected as having the wrong arch).

The attached corrects this.

OK for trunk and 4.6 (since this is a wrong-code issue)?
Iain

P.S. Is there any salient justification for the use of the anachronistic "-Wl, -flat_namespace" in Ada ? ...
... if not then I'll forward a patch to remove this
...  IMO it causes more trouble than it solves ...
... and should be applied explicitly by the User in circumstances that require it.

====

ada:
* gcc-interface/Makefile.in (darwin, SO_OPTS): Provide architecture size switches to the link
        phase for shared libs.

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/ Makefile.in
index 4be366e..8974a99 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2164,6 +2164,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$ (arch) $(osys))),)
 endif

 ifeq ($(strip $(filter-out darwin%,$(osys))),)
+  SO_OPTS = -Wl,-flat_namespace -shared-libgcc
   ifeq ($(strip $(filter-out %86,$(arch))),)
     LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-darwin.ads \
@@ -2184,6 +2185,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
       LIBGNAT_TARGET_PAIRS += \
         $(X86_64_TARGET_PAIRS) \
         system.ads<system-darwin-x86_64.ads
+      SO_OPTS += -m64
     else
       LIBGNAT_TARGET_PAIRS += \
         $(X86_TARGET_PAIRS) \
@@ -2211,6 +2213,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
       LIBGNAT_TARGET_PAIRS += \
         $(X86_TARGET_PAIRS) \
         system.ads<system-darwin-x86.ads
+      SO_OPTS += -m32
     else
       LIBGNAT_TARGET_PAIRS += \
         $(X86_64_TARGET_PAIRS) \
@@ -2243,7 +2246,6 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)

   EH_MECHANISM=-gcc
   GNATLIB_SHARED = gnatlib-shared-darwin
-  SO_OPTS = -Wl,-flat_namespace -shared-libgcc
   RANLIB = ranlib -c
   GMEM_LIB = gmemlib
   LIBRARY_VERSION := $(LIB_VERSION)
@@ -2664,7 +2666,7 @@ gnatlib-shared-darwin:
                $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
                $(SO_OPTS) \
-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$ (soext) \
-               $(MISCLIB) -lm
+               $(MISCLIB)
        cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,- B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
                -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \

diff --git a/gcc/ada/gcc-interface/Makefile.in 
b/gcc/ada/gcc-interface/Makefile.in
index 4be366e..8974a99 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2164,6 +2164,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) 
$(osys))),)
 endif
 
 ifeq ($(strip $(filter-out darwin%,$(osys))),)
+  SO_OPTS = -Wl,-flat_namespace -shared-libgcc
   ifeq ($(strip $(filter-out %86,$(arch))),)
     LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-darwin.ads \
@@ -2184,6 +2185,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
       LIBGNAT_TARGET_PAIRS += \
         $(X86_64_TARGET_PAIRS) \
         system.ads<system-darwin-x86_64.ads
+      SO_OPTS += -m64
     else
       LIBGNAT_TARGET_PAIRS += \
         $(X86_TARGET_PAIRS) \
@@ -2211,6 +2213,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
       LIBGNAT_TARGET_PAIRS += \
         $(X86_TARGET_PAIRS) \
         system.ads<system-darwin-x86.ads
+      SO_OPTS += -m32
     else
       LIBGNAT_TARGET_PAIRS += \
         $(X86_64_TARGET_PAIRS) \
@@ -2243,7 +2246,6 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
 
   EH_MECHANISM=-gcc
   GNATLIB_SHARED = gnatlib-shared-darwin
-  SO_OPTS = -Wl,-flat_namespace -shared-libgcc
   RANLIB = ranlib -c
   GMEM_LIB = gmemlib
   LIBRARY_VERSION := $(LIB_VERSION)

Reply via email to