Skip to content

Commit 63d53ee

Browse files
authored
Revert "[Driver] Default riscv*- triples to -fdebug-default-version=4" (#84119)
This reverts commit bbc0f99 (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.
1 parent 8fe3e70 commit 63d53ee

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

clang/include/clang/Driver/ToolChain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class ToolChain {
580580

581581
// Return the DWARF version to emit, in the absence of arguments
582582
// to the contrary.
583-
virtual unsigned GetDefaultDwarfVersion() const;
583+
virtual unsigned GetDefaultDwarfVersion() const { return 5; }
584584

585585
// Some toolchains may have different restrictions on the DWARF version and
586586
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host

clang/lib/Driver/ToolChain.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,6 @@ ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const {
453453
return UnwindTableLevel::None;
454454
}
455455

456-
unsigned ToolChain::GetDefaultDwarfVersion() const {
457-
// TODO: Remove the RISC-V special case when R_RISCV_SET_ULEB128 linker
458-
// support becomes more widely available.
459-
return getTriple().isRISCV() ? 4 : 5;
460-
}
461-
462456
Tool *ToolChain::getClang() const {
463457
if (!Clang)
464458
Clang.reset(new tools::Clang(*this, useIntegratedBackend()));

clang/test/Driver/clang-g-opts.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,3 @@
4242

4343
// CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
4444
// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
45-
46-
/// TODO: Special case before R_RISCV_SET_ULEB128 linker support becomes more widely available.
47-
// RUN: %clang -### -S %s -g --target=riscv64-linux-gnu 2>&1 | FileCheck --check-prefix=VERSION4 %s
48-
// RUN: %clang -### -S %s -g --target=riscv64-unknown-elf 2>&1 | FileCheck --check-prefix=VERSION4 %s
49-
// VERSION4: "-dwarf-version=4"

0 commit comments

Comments
 (0)