[PATCH] D97576: [lld-macho][nfc] Remove TODO regarding addends
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 13:35:30 PST 2021
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added subscribers: pengfei, kristof.beyls.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97576
Files:
lld/MachO/InputFiles.cpp
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -308,8 +308,7 @@
// 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 {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97576.326789.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210226/137963d0/attachment.bin>
More information about the llvm-commits
mailing list