[clang] 2bccd2b - [Driver] Allow -specs and -nostartfiles to be forwarded to GCC
Pengxuan Zheng via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 4 15:10:00 PDT 2020
Author: Pengxuan Zheng
Date: 2020-09-04T15:09:33-07:00
New Revision: 2bccd2b4350f887cc7fea1cc488690f58186c440
URL: https://github.com/llvm/llvm-project/commit/2bccd2b4350f887cc7fea1cc488690f58186c440
DIFF: https://github.com/llvm/llvm-project/commit/2bccd2b4350f887cc7fea1cc488690f58186c440.diff
LOG: [Driver] Allow -specs and -nostartfiles to be forwarded to GCC
With 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee, these two options are no longer
forwarded to GCC. This patch restores the original behavior.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D87162
Added:
Modified:
clang/include/clang/Driver/Options.td
clang/test/Driver/gcc_forward.c
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5f1668e701f1..4ba5d40117e7 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2760,7 +2760,7 @@ def no_pie : Flag<["-"], "no-pie">, Alias<nopie>;
def noprebind : Flag<["-"], "noprebind">;
def noprofilelib : Flag<["-"], "noprofilelib">;
def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group<Link_Group>;
def nostdinc : Flag<["-"], "nostdinc">, Flags<[CoreOption]>;
def nostdlibinc : Flag<["-"], "nostdlibinc">;
def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option]>,
@@ -2861,7 +2861,7 @@ def segs__read__ : Joined<["-"], "segs_read_">;
def shared_libgcc : Flag<["-"], "shared-libgcc">;
def shared : Flag<["-", "--"], "shared">, Group<Link_Group>;
def single__module : Flag<["-"], "single_module">;
-def specs_EQ : Joined<["-", "--"], "specs=">;
+def specs_EQ : Joined<["-", "--"], "specs=">, Group<Link_Group>;
def specs : Separate<["-", "--"], "specs">, Flags<[Unsupported]>;
def static_libgcc : Flag<["-"], "static-libgcc">;
def static_libstdcxx : Flag<["-"], "static-libstdc++">;
diff --git a/clang/test/Driver/gcc_forward.c b/clang/test/Driver/gcc_forward.c
index a99944f8f533..e6b0670d1a02 100644
--- a/clang/test/Driver/gcc_forward.c
+++ b/clang/test/Driver/gcc_forward.c
@@ -1,7 +1,8 @@
// RUN: %clang -### %s -target aarch64-none-elf \
-// RUN: --coverage -e _start -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -static -static-pie \
+// RUN: --coverage -e _start -fuse-ld=lld --ld-path=ld -nostartfiles \
+// RUN: -nostdlib -r -rdynamic -specs=nosys.specs -static -static-pie \
// RUN: 2>&1 | FileCheck --check-prefix=FORWARD %s
-// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-rdynamic" "-static" "-static-pie" "-o" "a.out" "{{.*}}.o" "-e" "_start" "-r"
+// FORWARD: gcc{{[^"]*}}" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostartfiles" "-nostdlib" "-rdynamic" "-specs=nosys.specs" "-static" "-static-pie" "-o" "a.out" "{{.*}}.o" "-e" "_start" "-r"
// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
// PR12920 -- Check also we may not forward W_Group options to GCC.
More information about the cfe-commits
mailing list