Skip to content

Commit

Permalink
[lld-macho] Read in new addrsig format
Browse files Browse the repository at this point in the history
The new format uses symbol relocations, as described in {D127637}.

Reviewed By: #lld-macho, alx32

Differential Revision: https://reviews.llvm.org/D128938
  • Loading branch information
int3 committed Jul 20, 2022
1 parent 2e2737c commit 2d889a8
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions lld/MachO/ICF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,18 +384,13 @@ void macho::markAddrSigSymbols() {
continue;
assert(addrSigSection->subsections.size() == 1);

Subsection *subSection = &addrSigSection->subsections[0];
ArrayRef<unsigned char> &contents = subSection->isec->data;

const uint8_t *pData = contents.begin();
while (pData != contents.end()) {
unsigned size;
const char *err;
uint32_t symIndex = decodeULEB128(pData, &size, contents.end(), &err);
if (err)
fatal(toString(file) + ": could not decode addrsig section: " + err);
markSymAsAddrSig(obj->symbols[symIndex]);
pData += size;
const InputSection *isec = addrSigSection->subsections[0].isec;

for (const Reloc &r : isec->relocs) {
if (auto *sym = r.referent.dyn_cast<Symbol *>())
markSymAsAddrSig(sym);
else
error(toString(isec) + ": unexpected section relocation");
}
}
}
Expand Down

0 comments on commit 2d889a8

Please sign in to comment.