[PATCH] D132541: [llvm-objcopy] Introduce 'ihex-flat' output format.

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 02:46:29 PDT 2022


simon_tatham added a comment.

Supplementary discussion:

This is a conservative patch which changes no existing behavior. But I'd be happy to go further if people want to, by making `ihex-flat` the default, and relegating the old behavior to a different name, or perhaps even removing it entirely.

Rationale: this segment:offset representation of addresses was only ever important to 16-bit x86 as far as I know, and in all other situations, its sole effect is to complicate the file format unnecessarily for everyone else. And since LLVM doesn't even support x86-16 as a target architecture, 'everyone else' is quite likely to be all users!

Also, even if someone //is// targeting x86-16, I can't see how a hex file written in this way would be useful. Surely you would need the ability to control the precise CS:IP representation of the entry point address, so you could set it to match the expectations of the code that will be executing there? And that will not in all cases match the fixed policy here of making the segment address a multiple of 0x1000 and putting all 16 low bits of the linear address into the offset.

But the current code was put in on purpose, and as far as I can tell from the comments in D60270 <https://reviews.llvm.org/D60270>, the purpose was to match GNU objcopy, so for the moment I'm presuming that's useful in its own right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132541



More information about the llvm-commits mailing list