[PATCH] D63184: [llvm-objcopy] Recognize the output file format other than ELF

Seiya Nuta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 00:25:39 PDT 2019


seiya created this revision.
Herald added subscribers: llvm-commits, MaskRay, jakehehrlich, fedor.sergeev, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.

Currently, llvm-objcopy doesn't recognize the output file format given by the -O option and implicitly calls 
elf::executeObjcopyOnRawBinary if the input is binary.

This patches changes the type of Config.InputFormat and Config.OutputFormat to an enum so that
we can call executeObjcopyOnRawBinary function for other output file formats like MachO in the future.

In addition to this,  this patch adds -O option into tests some tests because it seems that GNU objcopy simply
copies the input file if -O is not specified, that is, if you run `objcopy -Ibinary foo.txt bar`, the output file "bar" is
identical "foo.txt", not an ELF object file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63184

Files:
  llvm/test/tools/llvm-objcopy/ELF/binary-input-and-output.test
  llvm/test/tools/llvm-objcopy/ELF/binary-input-arch.test
  llvm/test/tools/llvm-objcopy/ELF/binary-input-error.test
  llvm/test/tools/llvm-objcopy/ELF/binary-input.test
  llvm/tools/llvm-objcopy/CopyConfig.cpp
  llvm/tools/llvm-objcopy/CopyConfig.h
  llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
  llvm/tools/llvm-objcopy/llvm-objcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63184.204220.patch
Type: text/x-patch
Size: 18260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190612/530fa762/attachment.bin>


More information about the llvm-commits mailing list