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

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 02:08:31 PST 2018


mstorsjo created this revision.
mstorsjo added reviewers: alexshap, jakehehrlich, jhenderson, rnk.
Herald added subscribers: rupprecht, mgorny.

This is an initial implementation of objcopy/strip for COFF.

I've tried to base the design on the ELF backend, although some of the extra classes (such as Reader vs COFFReader) might not make much sense here.

The COFF target doesn't need any separate set of options or executable name vs the ELF target, as GNU binutils objcopy uses the exact same set of options for both targets.

I remember seeing some discussion mentioning erroring out on unsupported/unimplemented options; I didn't implement that here yet, as that would essentially require enumerating and checking every field in CopyConfig. (Now taking a second look at it, it isn't probably that bad, as I think around half of them are hooked up so far.)

If you prefer to have this in two steps, one for adding plain passthrough copying, and one for actually hooking up options, I can split the commit.

This implements and hooks up those options that I have run into being used in the set of projects that I regularly test.


Repository:
  rL LLVM

https://reviews.llvm.org/D54939

Files:
  include/llvm/Object/COFF.h
  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-debug.exe
  test/tools/llvm-objcopy/COFF/Inputs/x86_64.exe
  test/tools/llvm-objcopy/COFF/Inputs/x86_64.o
  test/tools/llvm-objcopy/COFF/X86/lit.local.cfg
  test/tools/llvm-objcopy/COFF/X86/remove-local-symbols.s
  test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test
  test/tools/llvm-objcopy/COFF/basic-copy.test
  test/tools/llvm-objcopy/COFF/discard-all.test
  test/tools/llvm-objcopy/COFF/only-keep-debug.test
  test/tools/llvm-objcopy/COFF/strip-executable.test
  test/tools/llvm-objcopy/COFF/strip-object.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.175430.patch
Type: text/x-patch
Size: 47751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181127/438e3e41/attachment.bin>


More information about the llvm-commits mailing list