aboutsummaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorJez Ng <jezng@fb.com>2022-07-19 21:22:27 -0400
committerJez Ng <jezng@fb.com>2022-07-19 21:22:27 -0400
commit2d889a87fb1c557f67adf9bc6dce90ddef7c7836 (patch)
treebe7cab94823ae509ecfddc1df4ccf0852e9dbce6 /lld
parent2e2737cdf9983744fd894a5e5101429d74a67056 (diff)
downloadllvm-2d889a87fb1c557f67adf9bc6dce90ddef7c7836.zip
llvm-2d889a87fb1c557f67adf9bc6dce90ddef7c7836.tar.gz
llvm-2d889a87fb1c557f67adf9bc6dce90ddef7c7836.tar.bz2
[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
Diffstat (limited to 'lld')
-rw-r--r--lld/MachO/ICF.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp
index 2a927b1..34ffd05 100644
--- a/lld/MachO/ICF.cpp
+++ b/lld/MachO/ICF.cpp
@@ -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");
}
}
}