[PATCH] D67689: [llvm-objcopy] Add support for --gap-fill and --pad-to options
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 15:23:36 PDT 2019
jakehehrlich added a comment.
"Interstitial data" is data covered by by a segment but not a section. Gap fill should IMO set the bytes for all of that space. This is consistent with James's recommendation how things work. --pad-to when padding to a page aligned address this can for instance ensure that all executable bytes contain either valid code or a trap instruction.
Another axiom I'd like to hold if possible for the use case: no new segment overlapping should occur and its an error if --pad-to causes this. Technically this is valid and can occur and the internals handle it so I'm not adding a hard no here.
Dear god lets throw an error for now if this has to touch a TLS segment/sections...thats a crazy rabit whole where the rules for how everything works change. When someone hits that case we can think about it then.
If the last PT_LOAD segment memsize and filesize don't agree then using -pad-to is invalid and should be be an error.
I'm still not satisfied I've thought of all the error conditions so expect more as I think about this more carefully.
================
Comment at: llvm/tools/llvm-objcopy/ObjcopyOpts.td:229
+ : Eq<"gap-fill",
+ "Fill gaps between two loadable sections with <val>.">,
+ MetaVarName<"val">;
----------------
I'd say "set all bytes not covered by an allocated section but covered by a PT_LOAD segment to <val>" or something explicit to that effect. Reading GNU objcopy's format agnostic documentation is far too vauge to guess the results of.
================
Comment at: llvm/tools/llvm-objcopy/ObjcopyOpts.td:234
+ : Eq<"pad-to",
+ "Pad the last loadable section up to <addr> with the value specified by --gap-fill if present or zero by default.">,
+ MetaVarName<"addr">;
----------------
jhenderson wrote:
> This line is too long and should be broken up over multiple lines, like the other switch names. I think there's a clang-format invocation to do that for tablegen files, but I'm not sure what it is.
We should be explict and say "pad the last SHF_ALLOC section ...."
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67689/new/
https://reviews.llvm.org/D67689
More information about the llvm-commits
mailing list