[clang] b1b1f36 - [Driver] Don't default to DWARF 2 on Solaris

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 11:03:08 PDT 2023


Author: Rainer Orth
Date: 2023-09-01T20:02:37+02:00
New Revision: b1b1f364d63382637fa5f64871ee06bf74bd0405

URL: https://github.com/llvm/llvm-project/commit/b1b1f364d63382637fa5f64871ee06bf74bd0405
DIFF: https://github.com/llvm/llvm-project/commit/b1b1f364d63382637fa5f64871ee06bf74bd0405.diff

LOG: [Driver] Don't default to DWARF 2 on Solaris

`clang` currently defaults to DWARF 2 on Solaris.  This dates back to LLVM
3.8.0.  I suspect this is related to `gcc/config/sol2.cc`
(`solaris_override_options`) doing the same unless
`HAVE_LD_EH_FRAME_CIEV3`.  The latter is 1 on both Solaris 11.3 and 11.4,
so the workaround has become irrelevant these days.

This patch removes the Solaris override, adjusting affected testcases
accordingly.

Tested on `amd64-pc-solaris2.11` (`Release` and `Debug` builds) and
`sparcv9-sun-solaris2.11` (`Release` build).

Differential Revision: https://reviews.llvm.org/D159352

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Solaris.h
    clang/test/CodeGen/dwarf-version.c
    clang/test/Driver/clang-g-opts.c
    clang/test/Driver/debug-options.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Solaris.h b/clang/lib/Driver/ToolChains/Solaris.h
index fbac92c2c0f31c..9023bf7c37c522 100644
--- a/clang/lib/Driver/ToolChains/Solaris.h
+++ b/clang/lib/Driver/ToolChains/Solaris.h
@@ -63,7 +63,6 @@ class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_ELF {
                            llvm::opt::ArgStringList &CC1Args) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
-  unsigned GetDefaultDwarfVersion() const override { return 2; }
 
   const char *getDefaultLinker() const override {
     // clang currently uses Solaris ld-only options.

diff  --git a/clang/test/CodeGen/dwarf-version.c b/clang/test/CodeGen/dwarf-version.c
index d307eb3f101f8f..850cedf4d14c76 100644
--- a/clang/test/CodeGen/dwarf-version.c
+++ b/clang/test/CodeGen/dwarf-version.c
@@ -4,6 +4,8 @@
 // RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
 // RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
 // RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
+// RUN: %clang --target=i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
+// RUN: %clang --target=i386-pc-solaris -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
 
 // The -isysroot is used as a hack to avoid LIT messing with the SDKROOT
 // environment variable which indirecty overrides the version in the target
@@ -13,8 +15,6 @@
 
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
-// RUN: %clang -target i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
-// RUN: %clang -target i386-pc-solaris -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
 
 // Check which debug info formats we use on Windows. By default, in an MSVC
 // environment, we should use codeview. You can enable dwarf, which implicitly

diff  --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
index 5ee0fe64fe484f..4882eb6068f436 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/clang/test/Driver/clang-g-opts.c
@@ -27,8 +27,8 @@
 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
-// RUN: %clang -### -S %s -g0 -g -target i386-pc-solaris 2>&1 \
-// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
+// RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
 
 // CHECK-WITHOUT-G-NOT: -debug-info-kind
 // CHECK-WITH-G: "-debug-info-kind=constructor"

diff  --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index 4dbd7be10982e3..8ffa88d00dff37 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -193,8 +193,8 @@
 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
-// RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
-// RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
+// RUN: %clang -### -c -gline-tables-only -g %s --target=i386-pc-solaris 2>&1 \
+// RUN:             | FileCheck -check-prefix=G_ONLY %s
 // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
 // RUN:             | FileCheck -check-prefix=GLTO_NO %s
 //
@@ -212,8 +212,8 @@
 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
 // RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
-// RUN: %clang -### -c -gline-directives-only -g %s -target i386-pc-solaris 2>&1 \
-// RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
+// RUN: %clang -### -c -gline-directives-only -g %s --target=i386-pc-solaris 2>&1 \
+// RUN:             | FileCheck -check-prefix=G_ONLY %s
 // RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \
 // RUN:             | FileCheck -check-prefix=GLIO_NO %s
 


        


More information about the cfe-commits mailing list