[PATCH] D134385: [llvm-objcopy] --compress-debug-sections: remove tail padding for ELFCLASS32
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 23:38:33 PDT 2022
jhenderson added inline comments.
================
Comment at: llvm/lib/ObjCopy/ELF/ELFObject.cpp:538-539
Flags |= ELF::SHF_COMPRESSED;
- size_t ChdrSize =
- std::max(std::max(sizeof(object::Elf_Chdr_Impl<object::ELF64LE>),
- sizeof(object::Elf_Chdr_Impl<object::ELF64BE>)),
- std::max(sizeof(object::Elf_Chdr_Impl<object::ELF32LE>),
- sizeof(object::Elf_Chdr_Impl<object::ELF32BE>)));
+ size_t ChdrSize = Is64Bits ? sizeof(object::Elf_Chdr_Impl<object::ELF64LE>)
+ : sizeof(object::Elf_Chdr_Impl<object::ELF32LE>);
Size = ChdrSize + CompressedData.size();
----------------
Actually one question: this seems to be assuming that BE and LE Elf_Chdr_Impl are the same size. I assume that's intentional, and it's fine if it is, but perhaps it deserves a `static_assert` or similar to protect us in case something odd changes in the future?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134385/new/
https://reviews.llvm.org/D134385
More information about the llvm-commits
mailing list