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

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 05:20:20 PDT 2023


ro created this revision.
ro added a reviewer: MaskRay.
ro added a project: clang.
Herald added subscribers: fedor.sergeev, jyknight.
Herald added a project: All.
ro requested review of this revision.

`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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159352

Files:
  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


Index: clang/test/Driver/debug-options.c
===================================================================
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -195,7 +195,7 @@
 // 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:             | FileCheck -check-prefix=G_ONLY %s
 // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
 // RUN:             | FileCheck -check-prefix=GLTO_NO %s
 //
@@ -214,7 +214,7 @@
 // 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:             | FileCheck -check-prefix=G_ONLY %s
 // RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \
 // RUN:             | FileCheck -check-prefix=GLIO_NO %s
 
Index: clang/test/Driver/clang-g-opts.c
===================================================================
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -28,7 +28,7 @@
 // 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:             | FileCheck --check-prefix=CHECK-WITH-G %s
 
 // CHECK-WITHOUT-G-NOT: -debug-info-kind
 // CHECK-WITH-G: "-debug-info-kind=constructor"
Index: clang/test/CodeGen/dwarf-version.c
===================================================================
--- clang/test/CodeGen/dwarf-version.c
+++ 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
Index: clang/lib/Driver/ToolChains/Solaris.h
===================================================================
--- clang/lib/Driver/ToolChains/Solaris.h
+++ clang/lib/Driver/ToolChains/Solaris.h
@@ -66,7 +66,6 @@
                            llvm::opt::ArgStringList &CC1Args) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
-  unsigned GetDefaultDwarfVersion() const override { return 2; }
 
   const char *getDefaultLinker() const override;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159352.555335.patch
Type: text/x-patch
Size: 3761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230901/085455ca/attachment-0001.bin>


More information about the cfe-commits mailing list