[PATCH] D53311: [llvm-objcopy] Introduce dispatch mechanism based on input type
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 12:05:47 PDT 2018
alexshap added inline comments.
================
Comment at: llvm-objcopy.cpp:655
FileBuffer FB(Config.OutputFilename);
- BinaryReader Reader(Config.BinaryArch, BufOrErr->get());
- executeElfObjcopyOnBinary(Config, Reader, FB,
- getOutputElfType(Config.BinaryArch));
+ elf::executeObjcopyOnRawBinary(Config, *BufOrErr->get(), FB);
} else {
----------------
jakehehrlich wrote:
> jhenderson wrote:
> > It seems a bit odd still having mention of elf at this level. Is it allowed to read binary input for COFF or Mach-O output?
> I believe it should be possible for both of those. There should be a second dispatch on the output format when that happens. Right now we don't have all the -O/-I stuff hooked up in a general way just yet. It seems a bit out of scope to do that in this change. We should add a check to make sure that the output format is ELF here. I think I'd like a function that mirrors executeObjcopyOnBinary but for raw binaries.
yeah, will do
================
Comment at: llvm-objcopy.cpp:665
} else {
FileBuffer FB(Config.OutputFilename);
+ executeObjcopyOnBinary(Config, *BinaryOrErr.get().getBinary(), FB);
----------------
jakehehrlich wrote:
> to mirror executeObjcopyOnArchive, can we move the construction of the file buffer into executeObjcopyOnBinary.
the thing is that executeObjcopyOnBinary is called inside executeObjcopyOnArchive with a different type of buffer
Repository:
rL LLVM
https://reviews.llvm.org/D53311
More information about the llvm-commits
mailing list