diff mbox

[Ada,Darwin] Remove use of "flat_namespace" linker flag.

Message ID F37ADD6C-CFB3-4A3D-98E6-8E390F65AB90@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Sept. 7, 2011, 8:08 a.m. UTC
The "-flat_namespace" linker flag defeats one of Darwin's nicer  
features (two-level library namespaces).

AFAIU, it was habitually applied to unix projects in the early  
versions of darwin to cater for assumptions about library ordering  
made in such projects.

However, it is rarely needed these days (perhaps in the case of  
imported unix projects using plugins sometimes).

It also upsets our careful use of an extension library to provide  
current GCC facilities to Darwin 8...11 (which relies on the two-level  
namespace to use both the system and GCC versions of libgcc_s) ...  
and, in particular, this can cause subtle and difficult to diagnose  
differences of behavior between darwin 9 and later systems.

---

Perhaps I'm missing something (please enlighten me if so), but I can't  
presently see any reason why this needs to be applied to the Ada  
_build_ ...
... and IMHO it's likely to cause end user issues defaulting to it for  
shared library Ada make projects.
(better that the User should explicitly issue the flag where it is  
required)

So is the following OK for trunk?
(no Ada regressions on *-darwin9, x86_64-darwin10).

cheers
Iain

ada:

	* gcc-interface/Makefile.in (darwin): Do not issue the
	'-flat_namespace'  linker flag during Ada build.
	 * mlib-tgt-specific-darwin.adb: Remove 'flat_namespace' flag from
	the default shared library options.

Comments

Mike Stump Sept. 7, 2011, 5 p.m. UTC | #1
On Sep 7, 2011, at 1:08 AM, Iain Sandoe wrote:
> It also upsets our careful use of an extension library to provide current GCC facilities to Darwin 8...11 (which relies on the two-level namespace to use both the system and GCC versions of libgcc_s) ... and, in particular, this can cause subtle and difficult to diagnose differences of behavior between darwin 9 and later systems.

> So is the following OK for trunk?

I'm ok with it from a darwin perspective if you want to go that direction, though, this would be an Ada person call in the end.
Arnaud Charlet Sept. 7, 2011, 5:29 p.m. UTC | #2
> > It also upsets our careful use of an extension library to provide current
> > GCC facilities to Darwin 8...11 (which relies on the two-level namespace
> > to use both the system and GCC versions of libgcc_s) ... and, in
> > particular, this can cause subtle and difficult to diagnose differences
> > of behavior between darwin 9 and later systems.
> 
> > So is the following OK for trunk?
> 
> I'm ok with it from a darwin perspective if you want to go that direction,
> though, this would be an Ada person call in the end.

We're reviewing this patch and its consequences. For now the patch is NOT OK
since the change was done for a reason initially. The question is whether
the reason still holds today, so stay tuned.

Arno
Arnaud Charlet Sept. 14, 2011, 8:37 a.m. UTC | #3
Iain,

> So is the following OK for trunk?
> (no Ada regressions on *-darwin9, x86_64-darwin10).
> 
> cheers
> Iain
> 
> ada:
> 
> 	* gcc-interface/Makefile.in (darwin): Do not issue the
> 	'-flat_namespace'  linker flag during Ada build.
> 	 * mlib-tgt-specific-darwin.adb: Remove 'flat_namespace' flag from
> 	the default shared library options.

After double checking on our various test suites, this change is OK,
thanks.

Arno
diff mbox

Patch

Index: gcc/ada/mlib-tgt-specific-darwin.adb
===================================================================
--- gcc/ada/mlib-tgt-specific-darwin.adb	(revision 178615)
+++ gcc/ada/mlib-tgt-specific-darwin.adb	(working copy)
@@ -57,15 +57,10 @@  package body MLib.Tgt.Specific is
 
    --  Local objects
 
-   Flat_Namespace : aliased String := "-Wl,-flat_namespace";
-   --  Instruct the linker to build the shared library as a flat
-   --  namespace image. The default is a two-level namespace image.
-
    Shared_Libgcc  : aliased String := "-shared-libgcc";
 
    Shared_Options : constant Argument_List :=
-                      (1 => Flat_Namespace'Access,
-                       2 => Shared_Libgcc'Access);
+                      (1 => Shared_Libgcc'Access);
 
    -----------------------------
    -- Archive_Indexer_Options --
Index: gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc/ada/gcc-interface/Makefile.in	(revision 178615)
+++ gcc/ada/gcc-interface/Makefile.in	(working copy)
@@ -2164,7 +2164,7 @@  ifeq ($(strip $(filter-out %x86_64 linux%,$(arch)
 endif
 
 ifeq ($(strip $(filter-out darwin%,$(osys))),)
-  SO_OPTS = -Wl,-flat_namespace -shared-libgcc
+  SO_OPTS = -shared-libgcc
   ifeq ($(strip $(filter-out %86,$(arch))),)
     LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-darwin.ads \