Skip to content

Commit 2d889a8

Browse files
committed
[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
1 parent 2e2737c commit 2d889a8

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lld/MachO/ICF.cpp

+7-12
Original file line numberDiff line numberDiff line change
@@ -384,18 +384,13 @@ void macho::markAddrSigSymbols() {
384384
continue;
385385
assert(addrSigSection->subsections.size() == 1);
386386

387-
Subsection *subSection = &addrSigSection->subsections[0];
388-
ArrayRef<unsigned char> &contents = subSection->isec->data;
389-
390-
const uint8_t *pData = contents.begin();
391-
while (pData != contents.end()) {
392-
unsigned size;
393-
const char *err;
394-
uint32_t symIndex = decodeULEB128(pData, &size, contents.end(), &err);
395-
if (err)
396-
fatal(toString(file) + ": could not decode addrsig section: " + err);
397-
markSymAsAddrSig(obj->symbols[symIndex]);
398-
pData += size;
387+
const InputSection *isec = addrSigSection->subsections[0].isec;
388+
389+
for (const Reloc &r : isec->relocs) {
390+
if (auto *sym = r.referent.dyn_cast<Symbol *>())
391+
markSymAsAddrSig(sym);
392+
else
393+
error(toString(isec) + ": unexpected section relocation");
399394
}
400395
}
401396
}

0 commit comments

Comments
 (0)