[clang] 63d53ee - Revert "[Driver] Default riscv*- triples to -fdebug-default-version=4" (#84119)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 14 09:53:41 PDT 2024
Author: Fangrui Song
Date: 2024-03-14T09:53:38-07:00
New Revision: 63d53ee3b07e3b13e176eb60d8c02dea365c5ddb
URL: https://github.com/llvm/llvm-project/commit/63d53ee3b07e3b13e176eb60d8c02dea365c5ddb
DIFF: https://github.com/llvm/llvm-project/commit/63d53ee3b07e3b13e176eb60d8c02dea365c5ddb.diff
LOG: Revert "[Driver] Default riscv*- triples to -fdebug-default-version=4" (#84119)
This reverts commit bbc0f99f3bc96f1db16f649fc21dd18e5b0918f6
(https://reviews.llvm.org/D157663).
With this change, `-g` for the next major release 19.1 will generate
R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 relocations, which require
lld>=18 or binutils>=2.41.
binutils 2.41 is relatively new, but GCC has been producing
R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 for some time now.
Added:
Modified:
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/clang-g-opts.c
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index fbe2e8fe8e88d8..a4f9cad98aa8b1 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -580,7 +580,7 @@ class ToolChain {
// Return the DWARF version to emit, in the absence of arguments
// to the contrary.
- virtual unsigned GetDefaultDwarfVersion() const;
+ virtual unsigned GetDefaultDwarfVersion() const { return 5; }
// Some toolchains may have
diff erent restrictions on the DWARF version and
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 08b1fd01b3c0ac..03450fc0f57b93 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -453,12 +453,6 @@ ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const {
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()));
diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
index b73602a155b009..fdbe0b96420c51 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/clang/test/Driver/clang-g-opts.c
@@ -42,8 +42,3 @@
// 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"
More information about the cfe-commits
mailing list