[PATCH] D67689: [llvm-objcopy] Add support for --gap-fill and --pad-to options

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 20:44:49 PDT 2019


asmith created this revision.
asmith added reviewers: jhenderson, rupprecht, Hui.
Herald added subscribers: llvm-commits, seiya, abrachet, dexonsmith, MaskRay, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a project: LLVM.

This adds two new options to match GNU objcopy:

--gap-fill is used to fill gaps between two adjacent loadable sections with a specified 8 bit value.
--pad-to will pad the last loadable section to the pad-to address with the value specified by --gap-fill if present or zero by default.

Overview of how this works in llvm-objcopy:

1. Resize all the segments if needed.
2. Adjust section/segment layout (i.e. file offset) due to overlap across sections in the same segment or overlap across segments.
3. Set the parent segment's content.
4. Set the segment child's content.
5. Set the section's content.


Repository:
  rL LLVM

https://reviews.llvm.org/D67689

Files:
  llvm/include/llvm/Object/ELF.h
  llvm/test/Object/invalid.test
  llvm/test/tools/llvm-objcopy/ELF/Inputs/gapfillpadto.elf
  llvm/test/tools/llvm-objcopy/ELF/gap-fill.test
  llvm/test/tools/llvm-objcopy/ELF/pad-to.test
  llvm/tools/llvm-objcopy/CopyConfig.cpp
  llvm/tools/llvm-objcopy/CopyConfig.h
  llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
  llvm/tools/llvm-objcopy/ObjcopyOpts.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67689.220604.patch
Type: text/x-patch
Size: 26848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190918/e054b105/attachment-0001.bin>


More information about the llvm-commits mailing list