summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2022-05-29 16:14:32 +0100
committerIain Sandoe <iain@sandoe.co.uk>2022-06-15 20:07:17 +0100
commit58c0bc2b62cdbbe9d9677b448fe52a8c54044276 (patch)
treedeb7664e91554c6e417a0bb88b69b41da84dd796
parentd: Set TYPE_ARTIFICIAL on internal TypeInfo types (diff)
downloadgcc-58c0bc2b62cdbbe9d9677b448fe52a8c54044276.tar.gz
gcc-58c0bc2b62cdbbe9d9677b448fe52a8c54044276.tar.bz2
gcc-58c0bc2b62cdbbe9d9677b448fe52a8c54044276.tar.xz
Darwin: Fix empty g++ command lines [PR105599].
An empty g++ command line should produce a diagnostic that there are no inputs. The PR is that currently Darwin produces a dignostic about missing link items instead - this is because (errnoeously), for this driver, we are creating a link job for empty command lines. The problem occurs in four stages: The g++ driver appends -shared-libgcc to the command line. The Darwin driver_init code in the backend does not see this (it sees an empty command line). When the back end driver code driver sees an empty command line, it does not add any supplementary flags (e.g. asm-macosx-version-min) - precisely to avoid anything being claimed as an input_file and therefore triggering a link line. Since we do not have a value for asm-macosx-version-min when processing the driver specs, we unconditionally inject 'multiply_defined suppress' which is used with shared libgcc (but only intended on very old Darwin). This then causes the generation of a link job. The solution, for the present, is to move version-specific link params to the LINK_SPEC so that they are only processed when a link job has already been decided. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR target/105599 gcc/ChangeLog: * config/darwin.h: Move versions-specific handling of multiply_defined from SUBTARGET_DRIVER_SELF_SPECS to LINK_SPEC. (cherry picked from commit 794737976b9a6418eab817f143bb4eb2d0c834d2)
-rw-r--r--gcc/config/darwin.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 3682bd2b2c5..51e257dc698 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -143,10 +143,7 @@ extern GTY(()) int darwin_ms_struct;
143 Right now there's no mechanism to split up the "variable portion" (%*) of 143 Right now there's no mechanism to split up the "variable portion" (%*) of
144 the matched spec string, so where we have some driver specs that take 2 144 the matched spec string, so where we have some driver specs that take 2
145 or 3 arguments, these cannot be processed here, but are deferred until the 145 or 3 arguments, these cannot be processed here, but are deferred until the
146 LINK_SPEC, where they are copied verbatim. 146 LINK_SPEC, where they are copied verbatim. */
147 We have a "safe" version of the MacOS version string, that's been sanity-
148 checked and truncated to minor version. If the 'tiny' (3rd) portion of the
149 value is not significant, it's better to use this in version-compare(). */
150 147
151#undef SUBTARGET_DRIVER_SELF_SPECS 148#undef SUBTARGET_DRIVER_SELF_SPECS
152#define SUBTARGET_DRIVER_SELF_SPECS \ 149#define SUBTARGET_DRIVER_SELF_SPECS \
@@ -220,13 +217,8 @@ extern GTY(()) int darwin_ms_struct;
220 "%{image_base*:-Xlinker -image_base -Xlinker %*} %<image_base*", \ 217 "%{image_base*:-Xlinker -image_base -Xlinker %*} %<image_base*", \
221 "%{init*:-Xlinker -init -Xlinker %*} %<init*", \ 218 "%{init*:-Xlinker -init -Xlinker %*} %<init*", \
222 "%{multi_module:-Xlinker -multi_module} %<multi_module", \ 219 "%{multi_module:-Xlinker -multi_module} %<multi_module", \
223 "%{multiply_defined*:-Xlinker -multiply_defined -Xlinker %*; \ 220 "%{multiply_defined*:-Xlinker -multiply_defined -Xlinker %*} \
224 :%{shared-libgcc: \ 221 %<multiply_defined* ", \
225 %:version-compare(< 10.5 asm_macosx_version_min= -Xlinker) \
226 %:version-compare(< 10.5 asm_macosx_version_min= -multiply_defined) \
227 %:version-compare(< 10.5 asm_macosx_version_min= -Xlinker) \
228 %:version-compare(< 10.5 asm_macosx_version_min= suppress)}} \
229 %<multiply_defined*", \
230 "%{multiplydefinedunused*:\ 222 "%{multiplydefinedunused*:\
231 -Xlinker -multiply_defined_unused -Xlinker %*} \ 223 -Xlinker -multiply_defined_unused -Xlinker %*} \
232 %<multiplydefinedunused* ", \ 224 %<multiplydefinedunused* ", \
@@ -458,6 +450,9 @@ extern GTY(()) int darwin_ms_struct;
458 %{!force_cpusubtype_ALL:-arch %(darwin_subarch)} "\ 450 %{!force_cpusubtype_ALL:-arch %(darwin_subarch)} "\
459 LINK_SYSROOT_SPEC \ 451 LINK_SYSROOT_SPEC \
460 "%{mmacosx-version-min=*:-macosx_version_min %*} \ 452 "%{mmacosx-version-min=*:-macosx_version_min %*} \
453 %{!multiply_defined*:%{shared-libgcc: \
454 %:version-compare(< 10.5 mmacosx-version-min= -multiply_defined) \
455 %:version-compare(< 10.5 mmacosx-version-min= suppress) }} \
461 %{sectalign*} %{sectcreate*} %{sectobjectsymbols*} %{sectorder*} \ 456 %{sectalign*} %{sectcreate*} %{sectobjectsymbols*} %{sectorder*} \
462 %{segaddr*} %{segcreate*} %{segprot*} " 457 %{segaddr*} %{segcreate*} %{segprot*} "
463 458