Skip to content

Commit 33c3629

Browse files
committed
[SOL] Handle BPF_64_64 relocations in .debug sections as ABS64
Because of a bug in BPF backend ABS64 relocations are incorrectly generated as 64_64 relocations in BPF object files. This temporary works around this for relocations in .debug section to generate debug information addresses correctly.
1 parent 006c681 commit 33c3629

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lld/ELF/InputSection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,10 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
831831
for (const RelTy &rel : rels) {
832832
RelType type = rel.getType(config->isMips64EL);
833833

834+
// FIX: Temporary remap BPF_64_64 relocations in debug sections.
835+
if (config->emachine == EM_BPF && type == R_BPF_64_64 && isDebug)
836+
type = R_BPF_64_ABS64;
837+
834838
// GCC 8.0 or earlier have a bug that they emit R_386_GOTPC relocations
835839
// against _GLOBAL_OFFSET_TABLE_ for .debug_info. The bug has been fixed
836840
// in 2017 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630), but we

0 commit comments

Comments
 (0)