[lld] [ELF] Change .debug_names tombstone value to UINT32_MAX/UINT64_MAX (PR #74686)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 10:28:59 PST 2023
================
@@ -898,10 +898,16 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
const TargetInfo &target = *elf::target;
const auto emachine = config->emachine;
const bool isDebug = isDebugSection(*this);
- const bool isDebugLocOrRanges =
- isDebug && (name == ".debug_loc" || name == ".debug_ranges");
const bool isDebugLine = isDebug && name == ".debug_line";
- std::optional<uint64_t> tombstone;
+ std::optional<uint64_t> tombstone, debugTombstone;
----------------
MaskRay wrote:
`type == target.symbolicRel` is a proxy for whether the relocation is 64-bit on ELF64 (`symbolicRel`).
Previously, the entries in debug sections that need tombstone values are all `symbolicRel` since they reference a text section (and for generalization, we don't use the small code model assumption).
`.debug_names` is a new special case where its `.long .Ltu_begin0 # Type unit 0` reference is 32-bit.
A natural extension of the existing code looks like this.
`-z dead-reloc-in-nonalloc=` was initially designed to support both 32-bit and 64-bit absolute relocations.
---
Actually, x86-64 is unique in discerning signed/unsigned 32-bit absolute relocations (R_X86_64_32/R_X86_64_32S).
We can special case it instead:
```
if (emachine == EM_X86_64 && type == R_X86_64_32)
value = static_cast<uint32_t>(value);
```
(AArch64/PPC64/RISC-V/etc don't need this.)
I have made the simplication.
https://github.com/llvm/llvm-project/pull/74686
More information about the llvm-commits
mailing list