[PATCH] D158124: [dsymutil] Add support for mergeable libraries

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 04:05:12 PDT 2023


avl added inline comments.


================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:541
   MyInfo.InDebugMap = true;
+  MyInfo.FileName = RelocMgr.getFileName();
 
----------------
Why do we need to put FileName info into the every DIE info structure?

LibInstallName is initialized in AddressManager contructor. It looks like we can ask AddressManager for FileName when it is needed, instead of storing it into the DIE info structure.


================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1756
+  int64_t RelocSlide =
+      !Info.FileName ? (int64_t)OutOffset - (int64_t)Offset : 0;
+  // Reflect displacement due to DW_AT_APPLE_origin attribute in output file.
----------------
Can we move this check into the applyValidRelocs(a couple of lines below) as AddressManager already knows FileName?


```
bool DwarfLinkerForBinary::AddressManager<AddressesMapBase>::applyValidRelocs(
    MutableArrayRef<char> Data, uint64_t BaseOffset, bool IsLittleEndian,
    uint64_t OutOffset, CompileUnit& CU) {

    int64_t RelocSlide = (getFileName()) ? 0 ; (int64_t)OutOffset - (int64_t)Offset;
    if (!CU.getOrigUnit().getUnitDIE().find(DW_AT_APPLE_origin))
      RelocSlide += 4;
...
}


```


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

https://reviews.llvm.org/D158124



More information about the llvm-commits mailing list