[lld] [lld-macho] Include branch extension thunks in linker map (PR #120496)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 17:32:19 PST 2024
================
@@ -220,7 +242,12 @@ void macho::writeMapFile() {
os << "# Address\tSize \tFile Name\n";
for (const OutputSegment *seg : outputSegments) {
for (const OutputSection *osec : seg->getSections()) {
- if (auto *concatOsec = dyn_cast<ConcatOutputSection>(osec)) {
+ const TextOutputSection *textOsec = dyn_cast<TextOutputSection>(osec);
+ if (textOsec && textOsec->getThunks().size()) {
+ auto inputsAndThunks =
+ mergeOrderedInputs(textOsec->inputs, textOsec->getThunks());
+ printIsecArrSyms(inputsAndThunks);
+ } else if (auto *concatOsec = dyn_cast<ConcatOutputSection>(osec)) {
printIsecArrSyms(concatOsec->inputs);
----------------
alx32 wrote:
I think we would want to add `classof()` to `TextOutputSection` regardless - I don't think we want to have `dyn_cast<TextOutputSection>` silently fail in the background with no reason.
But I am not sure how `classof()` is relating to printing thunks - we need to identify the type of the output section regardless.
About printing directly handling interleaving, this would be an option - I left a comment about it on mergeOrderedInputs - but I'm wondering if it would be the clean approach here - especially if we can simplify `mergeOrderedInputs` into a `std::merge`. Do you prefer interleaved printing ?
https://github.com/llvm/llvm-project/pull/120496
More information about the llvm-commits
mailing list