[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
Tue Jan 23 15:36:07 PST 2024


MaskRay wrote:

> Hi @MaskRay ! This patch seems to have uncovered some odd behavior in our downstream, and I'm having a hard time understanding how this tombstoning is supposed to work.
> 
> Given the following conditions:
> 
> ```
> if (tombstone && (expr == R_ABS || expr == R_DTPREL)) {
>   if (!sym.getOutputSection() || (ds && ds->folded && !isDebugLine)) {
> ```
> 
> It seems to me that relocations in debug sections for which the symbols are defined and absolute will always be tombstoned. Is this really the correct behavior? This means that if you have a symbol definition in the debug info from a source file, but where the symbol is instead defined to an absolute value through a linker script or command line option, the debug info relocation will be tombstoned even though the symbol existed. This situation can happen if the symbol in the source file is weak.
> 
> How is this intended to work, exactly?

Do you have more information about a `.debug_*` section referencing a `SHN_ABS` symbol?

I believe a `SHN_ABS` symbol has never been considered for `InputSection::relocateNonAlloc`. I personally haven't seen such uses.

Before this patch, the code did made it work in the absence of `-z dead-reloc-in-nonalloc=`. However, that seems unintentional. I think it makes sense to support it, but we need to move away from `!sym.getOutputSection()` to discern `SHN_ABS` and a symbol whose section has been discarded.

https://github.com/llvm/llvm-project/pull/74686


More information about the llvm-commits mailing list