diff mbox series

[pushed] Darwin, D : Adjust the X spec to cater for duplicate use.

Message ID 57C96B92-3DDC-471F-9B52-57DBA770921B@sandoe.co.uk
State New
Headers show
Series [pushed] Darwin, D : Adjust the X spec to cater for duplicate use. | expand

Commit Message

Iain Sandoe Dec. 1, 2020, 8:08 p.m. UTC
Hi

For Darwin, the '-X' flag is an obsolete spelling for a command to tell
the linker to 'strip local symbols'.  This has been the default action
for a long time - but, as per the usual GCC approach, although the
flag is retired, we have not removed it; rather, we just delete it
in the driver self-spec.

The D language adds this flag as a front end option (to emit json)
which means that deleting it in the driver disables that function
in D.

This patch works around the duplication by removing the unused flag
in the link_spec instead of the driver self-spec.

this workaround tested on x86_64-darwin (where gdc tests now pass)
applied to master
thanks
Iain

----

Joseph; I don’t know if you have any advice on a ‘better’ long-term
solution; in some ways I am surprised that the compiler built with
duplicate specifications for a flag - perhaps the uses merged in some
way.  Since the use of ‘X’ in D is an upstream decision and the use of
‘X’ in Darwin is a historical fact (albeit luckily obsolete) it seems the
only recourse is eventually to delete one useage?

----

gcc/ChangeLog:

	* config/darwin.h: Remove unused 'X' specs in the link spec
	rather than driver self-specs.
---
  gcc/config/darwin.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joseph Myers Dec. 1, 2020, 11:01 p.m. UTC | #1
On Tue, 1 Dec 2020, Iain Sandoe wrote:

> Joseph; I don’t know if you have any advice on a ‘better’ long-term
> solution; in some ways I am surprised that the compiler built with
> duplicate specifications for a flag - perhaps the uses merged in some
> way.  Since the use of ‘X’ in D is an upstream decision and the use of

It's fine to have an option supported by multiple languages (here Driver 
counts as a language) as long as the syntax in each language (regarding 
any option arguments etc.) is compatible.  There are several options that 
are language-specific options for C-family languages and for Fortran, but 
not for other languages, for example.
diff mbox series

Patch

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 5a766319cb0..da40a08443e 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -135,7 +135,7 @@  extern GTY(()) int darwin_ms_struct;
  "%{shared:-Zdynamiclib} %<shared",					\
  "%{static:%{Zdynamic:%e conflicting code gen style switches are used}}",\
  "%{y*:%nthe y option is obsolete and ignored} %<y*",			\
-"%<Mach %<X"
+"%<Mach "
 
  #if LD64_HAS_EXPORT_DYNAMIC
  #define DARWIN_RDYNAMIC "%{rdynamic:-export_dynamic}"
@@ -237,7 +237,7 @@  extern GTY(()) int darwin_ms_struct;
      DARWIN_NOPIE_SPEC \
      DARWIN_RDYNAMIC \
      DARWIN_NOCOMPACT_UNWIND \
-    "}}}}}}} %<pie %<no-pie %<rdynamic "
+    "}}}}}}} %<pie %<no-pie %<rdynamic %<X "
 
  #define DSYMUTIL "\ndsymutil"