[PATCH] D50343: [llvm-objcopy] Add support for -I binary -B <arch>.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 9 09:22:52 PDT 2018


rupprecht marked an inline comment as done.
rupprecht added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:607
+  ElfHdr.PAddr = 0;
+  ElfHdr.FileSize = ElfHdr.MemSize = sizeof(Elf_Ehdr);
+  ElfHdr.Align = 0;
----------------
jakehehrlich wrote:
> I think ELFWriter should assign these. I think I need to do some refactoring to make Object not so ELF specific (with respect to not containing fields that are not known until write time). This change is exposing a lot of points where I failed to properly separate those concerns. In the mean time if you could move this code into ELFWriter and call it form assignOffset that would be ideal.
I didn't find a way to refactor out setting ElfHdr.Index, since `ELFBuilder<ELFT>::readProgramHeaders()` is setting it to `ElfHdr.Index = Index++` in the middle of some other sections, but the rest was simple to refactor into ELFWriter.


Repository:
  rL LLVM

https://reviews.llvm.org/D50343





More information about the llvm-commits mailing list