Patchwork [Ada,Darwin] Adjust architecture for built shared libs.

login
register
mail settings
Submitter IainS
Date Sept. 5, 2011, 6:50 p.m.
Message ID <9D22B279-0617-448B-A074-68508138DB86@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/113426/
State New
Headers show

Comments

IainS - Sept. 5, 2011, 6:50 p.m.
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.

      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)
Arnaud Charlet - Sept. 5, 2011, 7:02 p.m.
> 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)?

Well, the patch attached is OK. The patch inline in your mail body is NOT
(contains unrelated hunks).

I'd recommend that you do not duplicate patches like that, in particular not
if both are different, since this is very confusing and error prone.

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

Again, same problem with too longer lines in your changelog entry.

To clarify, the patch which is OK is the following:

> 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)

Patch

====

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 = \