[lld] r366402 - [DWARF][RISCV] Add support for RISC-V relocations needed for debug info

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 22:22:55 PDT 2019


Author: asb
Date: Wed Jul 17 22:22:55 2019
New Revision: 366402

URL: http://llvm.org/viewvc/llvm-project?rev=366402&view=rev
Log:
[DWARF][RISCV] Add support for RISC-V relocations needed for debug info

When code relaxation is enabled many RISC-V fixups are not resolved but
instead relocations are emitted. This happens even for DWARF debug
sections. Therefore, to properly support the parsing of DWARF debug info
we need to be able to resolve RISC-V relocations. This patch adds:

* Support for RISC-V relocations in RelocationResolver
* DWARF support for two relocations per object file offset
* DWARF changes to support relocations in more DIE fields

The two relocations per offset change is needed because some RISC-V
relocations (used for label differences) come in pairs.

Relocations can also be emitted for DWARF fields where relocations were
not yet evaluated. Adding relocation support for some of these fields is
essencial. On the other hand, LLVM currently emits RISC-V relocations
for fixups that could be safely evaluated, since they can never be
affected by code relaxations. This patch also adds relocation support
for the fields affected by those extraneous relocations (the DWARF unit
entry Length, and the DWARF debug line entry TotalLength and
PrologueLength), for testing purposes.

Differential Revision: https://reviews.llvm.org/D62062
Patch by Luís Marques.

Modified:
    lld/trunk/ELF/DWARF.cpp

Modified: lld/trunk/ELF/DWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DWARF.cpp?rev=366402&r1=366401&r2=366402&view=diff
==============================================================================
--- lld/trunk/ELF/DWARF.cpp (original)
+++ lld/trunk/ELF/DWARF.cpp Wed Jul 17 22:22:55 2019
@@ -110,7 +110,8 @@ LLDDwarfObj<ELFT>::findAux(const InputSe
   DataRefImpl d;
   d.p = getAddend<ELFT>(rel);
   return RelocAddrEntry{secIndex, RelocationRef(d, nullptr),
-                        LLDRelocationResolver<RelTy>::resolve, val};
+                        val,      Optional<object::RelocationRef>(),
+                        0,        LLDRelocationResolver<RelTy>::resolve};
 }
 
 template <class ELFT>




More information about the llvm-commits mailing list