Page MenuHomePhabricator

[llvm-objdump][WIP] Make llvm-objdump -h compatible with GNU objdump.
Changes PlannedPublic

Authored by rupprecht on Oct 8 2019, 3:06 PM.

Details

Summary

Note: this patch is large and not intended for submission as-is. Instead, this patch presents a poor implementation that makes llvm-objdump GNU compatibile for this option (with all existing tests passing, but few added tests, hacky code, etc.), and will serve as context for smaller changes to be submitted separately with more careful review.

llvm-objdump -h was implemented to be similar to readelf -S (see rL141579). However, it is not completely compatible with that, and anyone that does want headers displayed that way can use llvm-readelf -S now that it exists. Make llvm-objdump compatible with GNU objdump instead.

A brief overview of changes:

  • Add file offset (with implementations for all filetypes supported by llvm-readobj).
  • Add 2**n section alignment column (with implementations for all filetypes supported by llvm-readobj).
  • Section numbers are not the actual section numbers, but something different, corresponding to libbfd section numbers. llvm-readelf -s prints the actual section numbers if those are desired.
  • Filter out certain sections like symtabs/strtabs/relocs. The actual logic is a lot more convoluted (and probably isn't fully compatibile, but is pretty close).

Event Timeline

rupprecht created this revision.Oct 8 2019, 3:06 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
rupprecht planned changes to this revision.Oct 8 2019, 3:11 PM

Note: herald added reviewers, but this patch is just to provide context. I'll send the real patches for review in the coming days.