[PATCH] D122239: [dsymutil] Update vector of section starts with size of current section

Augusto Noronha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 05:41:37 PDT 2022


augusto2112 updated this revision to Diff 417576.
augusto2112 added a comment.

Clang format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122239/new/

https://reviews.llvm.org/D122239

Files:
  llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
  llvm/tools/dsymutil/DwarfLinkerForBinary.h


Index: llvm/tools/dsymutil/DwarfLinkerForBinary.h
===================================================================
--- llvm/tools/dsymutil/DwarfLinkerForBinary.h
+++ llvm/tools/dsymutil/DwarfLinkerForBinary.h
@@ -214,7 +214,7 @@
 
   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);
 
Index: llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
===================================================================
--- llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+++ llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
@@ -494,7 +494,7 @@
 
 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 @@
       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 different .o file points to the correct
+      // place.
+      SectionToOffsetInDwarf[SectionKind] +=  Section.getSize();
       Streamer->emitSwiftReflectionSection(SectionKind, *SectionContents,
                                            Section.getAlignment(),
                                            Section.getSize());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122239.417576.patch
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220323/1a1623ce/attachment.bin>


More information about the llvm-commits mailing list