Skip to content

Commit

Permalink
[lld-macho][nfc] Remove TODO regarding addends
Browse files Browse the repository at this point in the history
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
  • Loading branch information
int3 committed Mar 1, 2021
1 parent 776be16 commit f083f65
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lld/MachO/InputFiles.cpp
Expand Up @@ -330,8 +330,7 @@ void ObjFile::parseRelocations(const section_64 &sec,
// The implicit addend for pcrel section relocations is the pcrel offset
// in terms of the addresses in the input file. Here we adjust it so
// that it describes the offset from the start of the referent section.
// TODO: The offset of 4 is probably not right for ARM64, nor for
// relocations with r_length != 2.
assert(target->hasAttr(r.type, RelocAttrBits::BYTE4));
referentOffset =
sec.addr + relInfo.r_address + 4 + totalAddend - referentSec.addr;
} else {
Expand Down

0 comments on commit f083f65

Please sign in to comment.