[PATCH] D157663: [Driver] Default riscv*- triples to -fdebug-default-version=4
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 08:27:02 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbbc0f99f3bc9: [Driver] Default riscv*- triples to -fdebug-default-version=4 (authored by MaskRay).
Changed prior to commit:
https://reviews.llvm.org/D157663?vs=549233&id=549956#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157663/new/
https://reviews.llvm.org/D157663
Files:
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.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,8 @@
// CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
+
+/// TODO: Special case before R_RISCV_SET_ULEB128 linker support becomes more widely available.
+// RUN: %clang -### -S %s -g --target=riscv64-linux-gnu 2>&1 | FileCheck --check-prefix=VERSION4 %s
+// RUN: %clang -### -S %s -g --target=riscv64-unknown-elf 2>&1 | FileCheck --check-prefix=VERSION4 %s
+// VERSION4: "-dwarf-version=4"
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -427,6 +427,12 @@
return UnwindTableLevel::None;
}
+unsigned ToolChain::GetDefaultDwarfVersion() const {
+ // TODO: Remove the RISC-V special case when R_RISCV_SET_ULEB128 linker
+ // support becomes more widely available.
+ return getTriple().isRISCV() ? 4 : 5;
+}
+
Tool *ToolChain::getClang() const {
if (!Clang)
Clang.reset(new tools::Clang(*this, useIntegratedBackend()));
Index: clang/include/clang/Driver/ToolChain.h
===================================================================
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -561,7 +561,7 @@
// Return the DWARF version to emit, in the absence of arguments
// to the contrary.
- virtual unsigned GetDefaultDwarfVersion() const { return 5; }
+ virtual unsigned GetDefaultDwarfVersion() const;
// Some toolchains may have different restrictions on the DWARF version and
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157663.549956.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/e87f4c1a/attachment-0001.bin>
More information about the cfe-commits
mailing list