[PATCH] D54939: [RFC] [llvm-objcopy] Initial COFF support

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 14:41:02 PST 2018


mstorsjo updated this revision to Diff 176482.
mstorsjo added a comment.

Split the large methods in Object.cpp into a bunch of smaller ones, and added a bit more comments. Moved the COFF header getter implementations into the cpp file.

Suggested changes not (yet) done:

- Didn't split the COFF header getter methods to a separate patch as I don't know a sensible standalone test for it, other than using it here.
- Kept the class named Object instead of COFFObject, as there weren't clear unanimosity about changing them yet
- Didn't change to use yaml2obj for the tests yet.

Currently, the llvm-objcopy output matches bytewise what lld outputs for executables (except for string tables), and what the LLVM codegen outputs for normal object files. If testing with files synthesized from yaml, yaml2obj needs 3 changes; padding executable sections, skipping 4 byte section content alignment as yaml2obj does but MC doesn't, and using the MC StringTableBuilder. The former two are trivial to change, but the latter requires adding an MC dependency to yaml2obj, which I'm not sure is wanted.


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

https://reviews.llvm.org/D54939

Files:
  include/llvm/Object/COFF.h
  lib/Object/COFFObjectFile.cpp
  test/tools/llvm-objcopy/COFF/Inputs/i386-big.o
  test/tools/llvm-objcopy/COFF/Inputs/i386.exe
  test/tools/llvm-objcopy/COFF/Inputs/i386.o
  test/tools/llvm-objcopy/COFF/Inputs/x86_64-big.o
  test/tools/llvm-objcopy/COFF/Inputs/x86_64.exe
  test/tools/llvm-objcopy/COFF/Inputs/x86_64.o
  test/tools/llvm-objcopy/COFF/basic-copy.test
  tools/llvm-objcopy/CMakeLists.txt
  tools/llvm-objcopy/COFF/COFFObjcopy.cpp
  tools/llvm-objcopy/COFF/COFFObjcopy.h
  tools/llvm-objcopy/COFF/Object.cpp
  tools/llvm-objcopy/COFF/Object.h
  tools/llvm-objcopy/llvm-objcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54939.176482.patch
Type: text/x-patch
Size: 25240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181203/d2363d69/attachment.bin>


More information about the llvm-commits mailing list