[PATCH] D62364: llvm-objcopy: Implement --extract-partition and --extract-main-partition.

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 12:42:39 PDT 2019

jakehehrlich added a comment.

A few questions

1. This direction means that we can only ever convert from a multi partition binary to a single partition binary. It seems like we should be able to remove each partition individually. The naming scheme I would imagine would be "--remove-partition=<name>" or "--remove-main-partition" and for the equivalent of this feature "--only-keep-partition=<name" and "--only-keep-main-partition". Are you sure we want to limit things to work like this?
2. Can you explain the details a bit more? Like it appears that we have a section to point to partition headers but I'd expect this to be available at dynamic link time as well which should mean that there should be a program header based solution to this as well. I'm also trying to understand exactly what the resulting file format looks like and what effect other operations would have on the net result. Lots of things are not clear to me from the documentation posted.

Comment at: llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp:734
                              object::ELFObjectFileBase &In, Buffer &Out) {
-  ELFReader Reader(&In);
+  ELFReader Reader(&In, Config);
   std::unique_ptr<Object> Obj = Reader.create();
Adding the CopyConfig here is antithetical to the goal of making this code into a library at some point in the future. We should find a way to avoid this. This goes for propagation of Config elsewhere in the code as well. Propogation of CopyConfig is a hard no from me personally.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list