[llvm] 44a609c - [dsymutil] Update vector of section starts with size of current section
Augusto Noronha via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 23 06:16:32 PDT 2022
Author: Augusto Noronha
Date: 2022-03-23T10:15:54-03:00
New Revision: 44a609cd594fd455ca28ec56e5d60a18f4a4a74d
URL: https://github.com/llvm/llvm-project/commit/44a609cd594fd455ca28ec56e5d60a18f4a4a74d
DIFF: https://github.com/llvm/llvm-project/commit/44a609cd594fd455ca28ec56e5d60a18f4a4a74d.diff
LOG: [dsymutil] Update vector of section starts with size of current section
Take into account the contributions of the sections from different
object files when calculating the address where relocations should be
applied.
Differential Revision: https://reviews.llvm.org/D122239
Added:
Modified:
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
llvm/tools/dsymutil/DwarfLinkerForBinary.h
Removed:
################################################################################
diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
index 8b40816368deb..fef9f25bf7c27 100644
--- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
@@ -494,7 +494,7 @@ void DwarfLinkerForBinary::collectRelocationsToApplyToSwiftReflectionSections(
void DwarfLinkerForBinary::copySwiftReflectionMetadata(
const llvm::dsymutil::DebugMapObject *Obj, DwarfStreamer *Streamer,
- const std::vector<uint64_t> &SectionToOffsetInDwarf,
+ std::vector<uint64_t> &SectionToOffsetInDwarf,
std::vector<MachOUtils::DwarfRelocationApplicationInfo>
&RelocationsToApply) {
using binaryformat::Swift5ReflectionSectionKind;
@@ -539,6 +539,10 @@ void DwarfLinkerForBinary::copySwiftReflectionMetadata(
collectRelocationsToApplyToSwiftReflectionSections(
Section, *SectionContents, MO, SectionToOffsetInDwarf, Obj,
RelocationsToApply);
+ // Update the section start with the current section's contribution, so
+ // the next section we copy from a
diff erent .o file points to the correct
+ // place.
+ SectionToOffsetInDwarf[SectionKind] += Section.getSize();
Streamer->emitSwiftReflectionSection(SectionKind, *SectionContents,
Section.getAlignment(),
Section.getSize());
diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.h b/llvm/tools/dsymutil/DwarfLinkerForBinary.h
index 3a363d82ef16a..dd29b1ff98acb 100644
--- a/llvm/tools/dsymutil/DwarfLinkerForBinary.h
+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.h
@@ -214,7 +214,7 @@ class DwarfLinkerForBinary {
void copySwiftReflectionMetadata(
const llvm::dsymutil::DebugMapObject *Obj, DwarfStreamer *Streamer,
- const std::vector<uint64_t> &SectionToOffsetInDwarf,
+ std::vector<uint64_t> &SectionToOffsetInDwarf,
std::vector<MachOUtils::DwarfRelocationApplicationInfo>
&RelocationsToApply);
More information about the llvm-commits
mailing list