aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2021-02-04 08:16:17 -0800
committerNathan Sidwell <nathan@acm.org>2021-02-05 05:32:34 -0800
commit6606b852bfa866c19375a7c5e9cb94776a28bd94 (patch)
tree47ea757d2b70c5eabd3e71ce8a76785e1a28a138 /gcc/gcc.c
parent63538886d1f7fc7cbf066b4c2d6d7fd4da537259 (diff)
downloadgcc-6606b852bfa866c19375a7c5e9cb94776a28bd94.zip
gcc-6606b852bfa866c19375a7c5e9cb94776a28bd94.tar.gz
gcc-6606b852bfa866c19375a7c5e9cb94776a28bd94.tar.bz2
driver: error for nonexistent linker inputs [PR 98943]
We used to check all unknown input files, even when passing them to a compiler. But that caused problems. However, not erroring out on non-existent would-be-linker inputs confuses configure machinery that probes the compiler to see if it accepts various inputs. This restores the access check for things that are thought to be linker input files, when we're not linking. (If we are linking, we presume the linker will error out on its own accord.) PR driver/98943 gcc/ * gcc.c (driver::maybe_run_linker): Check for input file accessibility if not linking. gcc/testsuite/ * c-c++-common/pr98943.c: New.
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 76f1d42..7837553 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9020,8 +9020,15 @@ driver::maybe_run_linker (const char *argv0) const
for (i = 0; (int) i < n_infiles; i++)
if (explicit_link_files[i]
&& !(infiles[i].language && infiles[i].language[0] == '*'))
- warning (0, "%s: linker input file unused because linking not done",
- outfiles[i]);
+ {
+ warning (0, "%s: linker input file unused because linking not done",
+ outfiles[i]);
+ if (access (outfiles[i], F_OK) < 0)
+ /* This is can be an indication the user specifed an errorneous
+ separated option value, (or used the wrong prefix for an
+ option). */
+ error ("%s: linker input file not found: %m", outfiles[i]);
+ }
}
/* The end of "main". */