[PATCH] D81709: [ObjectYAML][DWARF] Let the target address size be inferred from FileHeader.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 02:08:05 PDT 2020


grimar added a comment.

It looks reasonable to me.



================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:149
+    uint8_t AddrSize =
+        DebugRanges.AddrSize ? (uint8_t)*DebugRanges.AddrSize : TargetAddrSize;
     for (auto Entry : DebugRanges.Entries) {
----------------
I'd suggest to do in the next way:

```
uint8_t AddrSize;
if (DebugRanges.AddrSize)
  AddrSize = *DebugRanges.AddrSize;
else
  AddrSize = DI.Is64bit ? 8 : 4;
```


================
Comment at: llvm/lib/ObjectYAML/MachOYAML.cpp:111
+  Object.DWARF.Is64bit = Object.Header.magic == MachO::MH_MAGIC_64 ||
+                         Object.Header.magic == MachO::MH_CIGAM_64;
   IO.mapOptional("LoadCommands", Object.LoadCommands);
----------------
I am not an expert in MachO, but should MachO::FAT_MAGIC_64 and MachO::FAT_CIGAM_64 also be tested?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81709





More information about the llvm-commits mailing list