Skip to content

Commit f083f65

Browse files
committed
[lld-macho][nfc] Remove TODO regarding addends
There was initially some concern around the correct handling of pcrel section relocations with r_length != 2. But it looks like there are no such relocations in practice -- x86_64's pcrel section relocs all have r_length == 2, and ARM64 doesn't even have pcrel section relocs. So we can replace the TODO with an assert. Reviewed By: #lld-macho, thakis Differential Revision: https://reviews.llvm.org/D97576
1 parent 776be16 commit f083f65

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lld/MachO/InputFiles.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ void ObjFile::parseRelocations(const section_64 &sec,
330330
// The implicit addend for pcrel section relocations is the pcrel offset
331331
// in terms of the addresses in the input file. Here we adjust it so
332332
// that it describes the offset from the start of the referent section.
333-
// TODO: The offset of 4 is probably not right for ARM64, nor for
334-
// relocations with r_length != 2.
333+
assert(target->hasAttr(r.type, RelocAttrBits::BYTE4));
335334
referentOffset =
336335
sec.addr + relInfo.r_address + 4 + totalAddend - referentSec.addr;
337336
} else {

0 commit comments

Comments
 (0)