diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:31:57 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:33:27 +0900 |
commit | df025ebf872052c0761d44a3ef9b65e9675af8a8 (patch) | |
tree | 9b4e94583e2536546d6606270bcdf846c95e1ba2 /lld/MachO/MapFile.cpp | |
parent | 4428c9d0b1344179f85a72e183a44796976521e3 (diff) | |
parent | bdcf47e4bcb92889665825654bb80a8bbe30379e (diff) | |
download | llvm-users/chapuni/cov/single/loop.zip llvm-users/chapuni/cov/single/loop.tar.gz llvm-users/chapuni/cov/single/loop.tar.bz2 |
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts:
clang/lib/CodeGen/CoverageMappingGen.cpp
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); |