[PATCH] D101332: [llvm-objcopy] Exclude empty sections in IHexWriter output

Ian McIntyre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 22 18:06:25 PDT 2021


mciantyre added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:180
+namespace internal {
+bool SectionCompare::operator()(const SectionBase *Lhs,
+                                const SectionBase *Rhs) const {
----------------
evgeny777 wrote:
> mciantyre wrote:
> > evgeny777 wrote:
> > > With this change you start using section offset/index instead of address for IHexWriter. Why? Is this something GNU objcopy does?
> > I didn't consider the address- vs offset-ordering implications of this change. My goal was to share code, and I was hopeful that if it works for `Segment`, it might work here. See the discussion around James' previous remarks for ways to undo this.
> > 
> > I've so far treated GNU objcopy as a black box, and I'm not sure how it's generating HEX outputs.
> Given that GNU objcopy creates ihex segments in sorted (by physical address) order, I have concerns about this change. ELF segment has designated `p_paddr` field, so section physical addresses can be of different order than section offsets. I don't know if (and how often) this happens in reality though.
Reverted the comparator change. IHex sections are still ordered by physical address.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101332



More information about the llvm-commits mailing list