[PATCH] D136309: [clang][Toolchains][Gnu] pass -g through to assembler
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 24 12:31:14 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe3bb359aacdd: [clang][Toolchains][Gnu] pass -g through to assembler (authored by nickdesaulniers).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136309/new/
https://reviews.llvm.org/D136309
Files:
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/as-options.s
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
@@ -34,9 +34,3 @@
// CHECK-NOT: "-Wall"
// CHECK-NOT: "-Wdocumentation"
// CHECK: "-o" "a.out"
-
-// Check that we're not forwarding -g options to the assembler
-// RUN: %clang -g -target x86_64-unknown-linux-gnu -no-integrated-as -c %s -### 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-ASM %s
-// CHECK-ASM: as
-// CHECK-ASM-NOT: "-g"
Index: clang/test/Driver/as-options.s
===================================================================
--- clang/test/Driver/as-options.s
+++ clang/test/Driver/as-options.s
@@ -116,3 +116,13 @@
// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S -o /dev/null 2>&1 \
// RUN: | FileCheck --check-prefix=WARN --allow-empty %s
// WARN: unused
+
+// Test that -g is passed through to GAS.
+// RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -g %s -### 2>&1 | \
+// RUN: FileCheck --check-prefix=DEBUG %s
+// RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -g0 -g %s -### 2>&1 | \
+// RUN: FileCheck --check-prefix=DEBUG %s
+// DEBUG: "-g"
+// RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -g -g0 %s -### 2>&1 | \
+// RUN: FileCheck --check-prefix=NODEBUG %s
+// NODEBUG-NOT: "-g"
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -969,6 +969,10 @@
for (const auto &II : Inputs)
CmdArgs.push_back(II.getFilename());
+ if (Arg *A = Args.getLastArg(options::OPT_g_Flag, options::OPT_gN_Group))
+ if (!A->getOption().matches(options::OPT_g0))
+ Args.AddLastArg(CmdArgs, options::OPT_g_Flag);
+
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(DefaultAssembler));
C.addCommand(std::make_unique<Command>(JA, *this,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136309.470259.patch
Type: text/x-patch
Size: 1976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221024/fd194559/attachment.bin>
More information about the cfe-commits
mailing list