public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-11376] Darwin: Move checking of the 'shared' driver spec.
@ 2024-04-27 16:06 Iain D Sandoe
0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2024-04-27 16:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a0121359733b2c476131ea34534b53bd3ce92521
commit r11-11376-ga0121359733b2c476131ea34534b53bd3ce92521
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun Jul 9 09:02:39 2023 +0100
Darwin: Move checking of the 'shared' driver spec.
This avoids a bunch of irrelevant diagnostics if the user passes '-shared' to
gnatmake. Currently, we push '-dynamiclib' back onto the command line (since
that is the Darwin spelling of 'shared') but this is not handled by gnat1,
leading to a diagnostic for every character after the '-d'.
'-shared' has no effect on gnatmake (it needs to be passed to gnatbind).
This moves the handling of '-shared' to leaf specs so that we do not need to
push 'dynamiclib' onto the command line.
gcc/ChangeLog:
* config/darwin.h:
(SUBTARGET_DRIVER_SELF_SPECS): Move handling of 'shared' into the same
specs as 'dynamiclib'. (STARTFILE_SPEC): Handle 'shared'.
(cherry picked from commit 2e36eedb244badaaf2a70388071115c851b8db9b)
Diff:
---
gcc/config/darwin.h | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 9cae0165ae9..430f12662e9 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -131,10 +131,9 @@ extern GTY(()) int darwin_ms_struct;
cases where these driver opts are used multiple times, or to control
operations on more than one command (e.g. dynamiclib). These are handled
specially and we then add %<xxxx specs for the commands that _don't_ need
- them. NOTE: the order of 'shared' and 'dynamiclib' is significant, hence
- they are placed out of alphabetical order at the start. Likewise, we keep
- a couple of cases where a negative option originally appeared after the
- positive alternate, potentially overriding it.
+ them.
+ We keep a couple of cases where a negative option originally appeared after
+ the positive alternate, potentially overriding it.
When we report an error with %e, it seems necessary to strip the option
before doing so, otherwise it survives to the cc1 command line (%e doesn't
appear to abort the program before this).
@@ -145,9 +144,9 @@ extern GTY(()) int darwin_ms_struct;
#undef SUBTARGET_DRIVER_SELF_SPECS
#define SUBTARGET_DRIVER_SELF_SPECS \
- "%{shared:%{!dynamiclib:-dynamiclib}} %<shared", \
- "%{static:%{dynamic|dynamiclib:%econflicting code generation switches}}",\
- "%{dynamiclib:-Xlinker -dylib \
+ "%{static|fapple-kext|mkernel:%{shared|dynamic|dynamiclib: \
+ %econflicting code generation switches}}",\
+ "%{shared|dynamiclib:-Xlinker -dylib \
%{allowable_client*:-Xlinker -allowable_client -Xlinker %*} \
%<allowable_client* \
%{bundle_loader*: %<bundle_loader* \
@@ -165,8 +164,8 @@ extern GTY(()) int darwin_ms_struct;
%e-keep_private_externs not allowed with -dynamiclib} \
%{private_bundle: %<private_bundle \
%e-private_bundle not allowed with -dynamiclib} \
- }", \
- "%{!dynamiclib: \
+ }", \
+ "%{!dynamiclib:%{!shared: \
%{bundle_loader*:-Xlinker -bundle_loader -Xlinker %*} \
%<bundle_loader* \
%{client_name*:-Xlinker -client_name -Xlinker %*} \
@@ -181,13 +180,14 @@ extern GTY(()) int darwin_ms_struct;
%<keep_private_externs \
%{private_bundle:-Xlinker -private_bundle} \
%<private_bundle \
- }", \
+ }}", \
"%{all_load:-Xlinker -all_load} %<all_load", \
"%{arch_errors_fatal:-Xlinker -arch_errors_fatal} \
%<arch_errors_fatal", \
"%{bind_at_load:-Xlinker -bind_at_load} %<bind_at_load", \
- "%{bundle:%{!dynamiclib:-Xlinker -bundle; \
- :%e-bundle not allowed with -dynamiclib}}", \
+ "%{bundle:%{!dynamiclib:%{!shared: -Xlinker -bundle; \
+ :%e-bundle not allowed with -shared}; \
+ :%e-bundle not allowed with -dynamiclib}}", \
"%{dead_strip:-Xlinker -dead_strip} %<dead_strip", \
"%{dylib_file*:-Xlinker -dylib_file -Xlinker %*} %<dylib_file*", \
"%{dylinker:-Xlinker -dylinker} %<dylinker", \
@@ -288,7 +288,7 @@ extern GTY(()) int darwin_ms_struct;
%:version-compare(>= 10.7 mmacosx-version-min= -no_pie) }"
#define DARWIN_CC1_SPEC \
- "%<dynamic %<dynamiclib %<force_cpusubtype_ALL %<multiply_defined* "
+ "%<dynamic %<force_cpusubtype_ALL %<multiply_defined* "
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
@@ -515,8 +515,8 @@ extern GTY(()) int darwin_ms_struct;
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
-"%{dynamiclib: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}} \
- %{!dynamiclib:%{bundle:%(darwin_bundle1)} \
+"%{dynamiclib|shared: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}} \
+ %{!dynamiclib:%{!shared:%{bundle:%(darwin_bundle1)} \
%{!bundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
@@ -527,8 +527,8 @@ extern GTY(()) int darwin_ms_struct;
%{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \
%{!preload: %(darwin_crt1) \
- %(darwin_crt2)}}}}}} \
- %(darwin_crt3) %<dynamiclib "
+ %(darwin_crt2)}}}}}}} \
+ %(darwin_crt3) "
/* We want a destructor last in the list. */
#define TM_DESTRUCTOR "%{fgnu-tm: -lcrttme.o}"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-27 16:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-27 16:06 [gcc r11-11376] Darwin: Move checking of the 'shared' driver spec Iain D Sandoe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).