[PATCH] D44702: [llvm-objcopy] Keep the information about the object elf type

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 15:54:20 PDT 2018


jakehehrlich added a comment.

So I don't think the ELFType should be in the object. Or in the section types. The section types need to never touch or know their format. That's why the Writer and Reader types exist the way that they do. Here's the state of things as I currently see it

1. Initialize doesn't do all the initialization that it should or at the very least some of the initialization is spread out across initializeSymbol, initializeRelocations, and initialize.
2. The data needed to do some of the initialization is ELFType dependent.
3. It's bad for Section* and Object types to be dependent on ELFType IMO (it makes -I, -B, -O hard to implement and kludgy)
4. Currently the initialize method is a part of the Section* types

These things lead me to believe that initialize should not be a part of the Section* types. There should probably instead be a section visitor that does the initialization now that I think about it. The ELFBuilder can then give the whole ElfFile to the initializer. The only remaining piece would be managing the order in which things happen properly. If this theorized "initializer" memoized initialization then every visit method could just call the initialize methods of everything it needed and everything would automatically happen in the right order.


Repository:
  rL LLVM

https://reviews.llvm.org/D44702





More information about the llvm-commits mailing list