[PATCH] D56211: [llvm-objcopy][ELF] Implement a mutable section visitor that updates size-related fields (Size, EntrySize, Align) before layout.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 09:43:41 PST 2019


rupprecht added inline comments.


================
Comment at: tools/llvm-objcopy/ELF/Object.cpp:89
+  Sec.Size = Sec.Symbols.size() * Sec.EntrySize;
+  Sec.Align = sizeof(Elf_Shdr::sh_addralign);
+}
----------------
jhenderson wrote:
> I assume here and below, sh_addralign is used as a placeholder for "whatever is the largest data field in the struct" (i.e. sh_size or whatever would be equally valid)?
Yes, I'm pretty sure that's where this is coming from. It's been a bit since I first wrote this patch though, so I'll have to do some digging today -- this matches what GNU objcopy seems to do, but there may be a more technically correct way to do this.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56211/new/

https://reviews.llvm.org/D56211





More information about the llvm-commits mailing list