diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 17:16:04 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 17:16:04 +0900 |
commit | 0aa930a41f2d1ebf1fa90ec42da8f96d15a4dcbb (patch) | |
tree | 6a77b463f700e090df586672c26b9fe765fd115b /lld/MachO/MapFile.cpp | |
parent | ec6892d1c979ce0b84c86918d5cdbb03037b409a (diff) | |
parent | 6d16b1c5c468a79ecf867293023c89ac518ecdda (diff) | |
download | llvm-users/chapuni/cov/single/nextcount-base.zip llvm-users/chapuni/cov/single/nextcount-base.tar.gz llvm-users/chapuni/cov/single/nextcount-base.tar.bz2 |
Merge branch 'users/chapuni/cov/single/pair' into users/chapuni/cov/single/nextcount-baseusers/chapuni/cov/single/nextcount-base
Diffstat (limited to 'lld/MachO/MapFile.cpp')
-rw-r--r-- | lld/MachO/MapFile.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp index 9c06216..12417df 100644 --- a/lld/MachO/MapFile.cpp +++ b/lld/MachO/MapFile.cpp @@ -161,6 +161,20 @@ static uint64_t getSymSizeForMap(Defined *sym) { return sym->size; } +// Merges two vectors of input sections in order of their outSecOff values. +// This approach creates a new (temporary) vector which is not ideal but the +// ideal approach leads to a lot of code duplication. +static std::vector<ConcatInputSection *> +mergeOrderedInputs(ArrayRef<ConcatInputSection *> inputs1, + ArrayRef<ConcatInputSection *> inputs2) { + std::vector<ConcatInputSection *> vec(inputs1.size() + inputs2.size()); + std::merge(inputs1.begin(), inputs1.end(), inputs2.begin(), inputs2.end(), + vec.begin(), [](ConcatInputSection *a, ConcatInputSection *b) { + return a->outSecOff < b->outSecOff; + }); + return vec; +} + void macho::writeMapFile() { if (config->mapFile.empty()) return; @@ -220,7 +234,11 @@ 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)) { + if (auto *textOsec = dyn_cast<TextOutputSection>(osec)) { + auto inputsAndThunks = + mergeOrderedInputs(textOsec->inputs, textOsec->getThunks()); + printIsecArrSyms(inputsAndThunks); + } else if (auto *concatOsec = dyn_cast<ConcatOutputSection>(osec)) { printIsecArrSyms(concatOsec->inputs); } else if (osec == in.cStringSection || osec == in.objcMethnameSection) { const auto &liveCStrings = info.liveCStringsForSection.lookup(osec); |