[PATCH] D87162: [Driver] Allow -specs and -nostartfiles to be forwarded to GCC

Pengxuan Zheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 14:03:39 PDT 2020


pzheng created this revision.
pzheng added reviewers: MaskRay, apazos.
Herald added subscribers: cfe-commits, dang.
Herald added a project: clang.
pzheng requested review of this revision.

With 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee <https://reviews.llvm.org/rG6a75496836ea14bcfd2f4b59d35a1cad4ac58cee>, these two options are no longer
forwarded to GCC. This patch restores the original behavior.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87162

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/gcc_forward.c


Index: clang/test/Driver/gcc_forward.c
===================================================================
--- clang/test/Driver/gcc_forward.c
+++ clang/test/Driver/gcc_forward.c
@@ -1,7 +1,7 @@
-// RUN: %clang -### %s -target aarch64-none-elf \
+// RUN: %clang -### %s -target aarch64-none-elf -specs=nosys.specs -nostartfiles \
 // RUN:   --coverage -e _start -fuse-ld=lld --ld-path=ld -nostdlib -r -rdynamic -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{{[^"]*}}" "-specs=nosys.specs" "-nostartfiles" "--coverage" "-fuse-ld=lld" "--ld-path=ld" "-nostdlib" "-rdynamic" "-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.
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2760,7 +2760,7 @@
 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 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++">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87162.290025.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200904/20948465/attachment.bin>


More information about the cfe-commits mailing list