[PATCH] D101332: [llvm-objcopy] Keep ihex sections with same address

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 16 23:42:57 PDT 2021


evgeny777 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 {
----------------
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.


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