[PATCH] D31941: [ELF] - Implemented --compress-debug-sections option.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 10:33:06 PDT 2017
ruiu added inline comments.
================
Comment at: ELF/OutputSections.cpp:90
+// https://docs.oracle.com/cd/E53394_01/html/E54813/section_compression.html
+static std::vector<uint8_t> createHeader(size_t Size, uint32_t Alignment) {
+ llvm::support::endianness E = Config->Endianness;
----------------
I think it is better to template this function with ELFT so that you can access members by name using ELFT::Chdr type.
================
Comment at: ELF/OutputSections.cpp:115
+
+template <class ELFT> void OutputSection::compress() {
+ if (!(this->Flags & SHF_COMPRESSED))
----------------
Rename this `maybeComrpess` as it does't always compress contents.
================
Comment at: ELF/OutputSections.cpp:143-147
+ // If -compress-debug-sections is specified, we compress output debug
+ // sections.
+ if (Config->CompressDebugSections && Name.startswith(".debug_"))
+ if (!(Flags & SHF_ALLOC))
+ this->Flags |= SHF_COMPRESSED;
----------------
Move this to OutputSection::compress().
================
Comment at: ELF/OutputSections.h:92-93
+ // Used for implementation of --compress-debug-sections option.
+ llvm::SmallVector<char, 1> CompressedData;
+ std::vector<uint8_t> CompressedHeader;
+
----------------
CompressedHeader can be part of CompressedData.
================
Comment at: ELF/OutputSections.h:95-96
+
+ // Size of decompressed data. Only has meaning if compression enabled.
+ size_t DecompressedSize;
+
----------------
You don't need this, I guess?
https://reviews.llvm.org/D31941
More information about the llvm-commits
mailing list