Skip to content

Commit

Permalink
Revert "[Driver] Default riscv*- triples to -fdebug-default-version=4" (
Browse files Browse the repository at this point in the history
llvm#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.
  • Loading branch information
MaskRay authored Mar 14, 2024
1 parent 8fe3e70 commit 63d53ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 different restrictions on the DWARF version and
// may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
5 changes: 0 additions & 5 deletions clang/test/Driver/clang-g-opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 63d53ee

Please sign in to comment.