[PATCH] D49678: [llvm-objcopy] Adding support for compressed DWARF debug sections.
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 26 20:29:48 PDT 2018
jakehehrlich added a comment.
In https://reviews.llvm.org/D49678#1177214, @plotfi wrote:
> Yes, that's exactly why: to make it so that llvm-objcopy could be used as a dropin replacement for objcopy in places where objcopy --compress-debug-sections is being used.
Right so you don't necessarily need to implement this in full. It's better if you do but not critical. A simple change in names is likely sufficient.
================
Comment at: lib/Object/Compressor.cpp:109
+ unsigned Alignment, bool Is64Bit) {
+ if (Is64Bit) {
+ // Write Elf64_Chdr header.
----------------
plotfi wrote:
> jakehehrlich wrote:
> > To further my previous point, if you use an ELFT::Chdr you won't need to check this. That's the general mechanism by which we avoid having to check 64/32 bit and little/big endian. Then you don't need those functions that detect that information. It's far less error prone.
> Could you be more specifc about using ELFT::Chdr ? Do you think the Compressor should take a template parameter like Elf64_Chdr or Elf32_Chdr and then uses that to write to a buffer? I mainly was looking at the MC ELFWriter::maybeWriteCompression when I wrote some of this stuff FYI. Was planning to eventually clean that code up and have the compressor used by multiple places in LLVM where things are redundant.
Not quite, it should take ELFT as a template parameter and use ELFT::Chdr. Look at how ELF headers, Program headers, section headers, symbols, etc... are output in llvm-objcopy. We reinterpret_cast a uint8_t pointer to a specific pointer type.
Repository:
rL LLVM
https://reviews.llvm.org/D49678
More information about the llvm-commits
mailing list