]> granicus.if.org Git - clang/commitdiff
Always pass a -dwarf-version argument to integrated as.
authorDouglas Katzman <dougk@google.com>
Tue, 13 Oct 2015 16:22:51 +0000 (16:22 +0000)
committerDouglas Katzman <dougk@google.com>
Tue, 13 Oct 2015 16:22:51 +0000 (16:22 +0000)
This removes the default of 3 hidden in the assembler previously.

Fixes breakage caused by r249655, reported by vsukharev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250173 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/as-default-dwarf.s [new file with mode: 0644]
tools/driver/cc1as_main.cpp

index 999231a278c1f2c1a2239c4a507360842a2ee977..8a8904dd81b3a0c02b357885c6df67e2ea748631 100644 (file)
@@ -5632,10 +5632,11 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
     if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
       WantDebug = !A->getOption().matches(options::OPT_g0);
       if (WantDebug) {
-        if ((DwarfVersion = DwarfVersionNum(A->getSpelling())) == 0)
-          DwarfVersion = getToolChain().GetDefaultDwarfVersion();
+        DwarfVersion = DwarfVersionNum(A->getSpelling());
       }
     }
+    if (DwarfVersion == 0)
+      DwarfVersion = getToolChain().GetDefaultDwarfVersion();
     RenderDebugEnablingArgs(Args, CmdArgs,
                             (WantDebug ? CodeGenOptions::LimitedDebugInfo
                                        : CodeGenOptions::NoDebugInfo),
diff --git a/test/Driver/as-default-dwarf.s b/test/Driver/as-default-dwarf.s
new file mode 100644 (file)
index 0000000..9988203
--- /dev/null
@@ -0,0 +1,15 @@
+@ REQUIRES: arm-registered-target
+@ RUN: %clang --target=armv8a--linux-gnueabi -c %s -o %t
+@ RUN: llvm-objdump -t %t | FileCheck %s
+    .text
+    .type   foo,%function
+foo:
+    .fnstart
+    .cfi_startproc
+
+.Ltmp2:
+    .size   foo, .Ltmp2-foo
+    .cfi_endproc
+    .fnend
+    .cfi_sections .debug_frame
+@ CHECK: foo
index 54a77ed40ea7d25178a535317750cff5a4b200e8..d98ba6ea42399d07e6fad1f50a7a1e73bb76cdd0 100644 (file)
@@ -144,7 +144,7 @@ public:
     RelaxAll = 0;
     NoExecStack = 0;
     FatalWarnings = 0;
-    DwarfVersion = 3;
+    DwarfVersion = 0;
   }
 
   static bool CreateFromArgs(AssemblerInvocation &Res,