]> gcc.gnu.org Git - gcc.git/commit
Darwin: Fix empty g++ command lines [PR105599].
authorIain Sandoe <iain@sandoe.co.uk>
Sun, 29 May 2022 15:14:32 +0000 (16:14 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 16 May 2023 19:01:44 +0000 (20:01 +0100)
commita8307cfd66d29efae9c28f5b32bd677398c92dfe
tree8135a6905f51a7d63fcc24c40acea1feaf6ae3d2
parent05b00c066cd0282b628182963dee6582ea0fc92d
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)
gcc/config/darwin.h
This page took 0.062973 seconds and 6 git commands to generate.