This is an archive of the discontinued LLVM Phabricator instance.

[ObjectYAML][DWARF] Let the target address size be inferred from FileHeader.
ClosedPublic

Authored by Higuoxing on Jun 11 2020, 7:09 PM.

Details

Summary

This patch adds a new field bool Is64bit in DWARFYAML::Data to indicate the address size of target. It's helpful for inferring the AddrSize in some DWARF sections.

Diff Detail

Event Timeline

Higuoxing created this revision.Jun 11 2020, 7:09 PM
Higuoxing updated this revision to Diff 270288.Jun 11 2020, 7:13 PM
  • magic of 64-bit target in Mach-O can be MH_CIGM_64 as well.

It looks reasonable to me.

llvm/lib/ObjectYAML/DWARFEmitter.cpp
153

I'd suggest to do in the next way:

uint8_t AddrSize;
if (DebugRanges.AddrSize)
  AddrSize = *DebugRanges.AddrSize;
else
  AddrSize = DI.Is64bit ? 8 : 4;
llvm/lib/ObjectYAML/MachOYAML.cpp
111

I am not an expert in MachO, but should MachO::FAT_MAGIC_64 and MachO::FAT_CIGAM_64 also be tested?

Higuoxing updated this revision to Diff 270339.Jun 12 2020, 2:33 AM
Higuoxing marked 3 inline comments as done.

Address comment.

Thanks for reviewing!

llvm/lib/ObjectYAML/MachOYAML.cpp
111

The Fat binary format has its own unique tag

--- !fat-mach-o

I think we don't need to worry about it here.

MaskRay accepted this revision.Jun 13 2020, 5:31 PM

LGTM. Looks reasonable.

This revision is now accepted and ready to land.Jun 13 2020, 5:31 PM
This revision was automatically updated to reflect the committed changes.