[llvm-objcopy][ELF] Implement a mutable section visitor that updates size-related fields (Size, EntrySize, Align) before layout.
Summary:
Fix EntrySize, Size, and Align before doing layout calculation.
As a side cleanup, this removes a dependence on sizeof(Elf_Sym) within BinaryReader, so we can untemplatize that.
This unblocks a cleaner implementation of handling the -O<format> flag. See D53667 for a previous attempt. Actual implementation of the -O<format> flag will come in an upcoming commit, this is largely a NFC (although not _totally_ one, because alignment on binary input was actually wrong before).
Reviewers: jakehehrlich, jhenderson, alexshap, espindola
Reviewed By: jhenderson
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D56211
llvm-svn: 350336
diff --git a/llvm/test/tools/llvm-objcopy/ELF/binary-input.test b/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
index ff1d381..3e9b1ba 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/binary-input.test
@@ -45,7 +45,7 @@
# CHECK-NEXT: Size:
# CHECK-NEXT: Link: 1
# CHECK-NEXT: Info: 1
-# CHECK-NEXT: AddressAlignment: 1
+# CHECK-NEXT: AddressAlignment: 8
# CHECK-NEXT: EntrySize: 24
# CHECK-NEXT: }
# CHECK-NEXT: Section {