[PATCH] D157663: [Driver] Default riscv*-linux* to -fdebug-default-version=4

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 15:59:24 PDT 2023


MaskRay updated this revision to Diff 549192.
MaskRay added a comment.

add a comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157663/new/

https://reviews.llvm.org/D157663

Files:
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/test/Driver/clang-g-opts.c


Index: clang/test/Driver/clang-g-opts.c
===================================================================
--- clang/test/Driver/clang-g-opts.c
+++ clang/test/Driver/clang-g-opts.c
@@ -37,3 +37,7 @@
 
 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
 // CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
+
+// RUN: %clang -### -S %s -g --target=riscv64-linux-gnu 2>&1 \
+// RUN:   | FileCheck --check-prefix=VERSION4 %s
+// VERSION4: "-dwarf-version=4"
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -343,7 +343,8 @@
 }
 
 unsigned Linux::GetDefaultDwarfVersion() const {
-  if (getTriple().isAndroid())
+  // TODO Remove isRISCV when R_RISCV_SET_ULEB128 linker support is better.
+  if (getTriple().isAndroid() || getTriple().isRISCV())
     return 4;
   return ToolChain::GetDefaultDwarfVersion();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157663.549192.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230810/471b2d15/attachment.bin>


More information about the cfe-commits mailing list