[lld-macho] Read in new addrsig format

The new format uses symbol relocations, as described in {D127637}.

Reviewed By: #lld-macho, alx32

Differential Revision: https://reviews.llvm.org/D128938
This commit is contained in:
Jez Ng 2022-07-19 21:22:27 -04:00
parent 2e2737cdf9
commit 2d889a87fb
1 changed files with 6 additions and 11 deletions

View File

@ -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 InputSection *isec = addrSigSection->subsections[0].isec;
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;
for (const Reloc &r : isec->relocs) {
if (auto *sym = r.referent.dyn_cast<Symbol *>())
markSymAsAddrSig(sym);
else
error(toString(isec) + ": unexpected section relocation");
}
}
}