[PATCH] D60959: [LLD][ELF] - Do not forget to use ch_addralign field after decompressing the sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 02:24:11 PDT 2019


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: ELF/InputSection.cpp:256
     UncompressedSize = Hdr->ch_size;
+    Alignment = Hdr->ch_addralign;
     RawData = RawData.slice(sizeof(*Hdr));
----------------
ruiu wrote:
> What is the definition of ch_addralign if it's 0? I wonder if we have to handle 0 as 1.
`ch_addralign` description says:
(https://docs.oracle.com/cd/E53394_01/html/E54813/section_compression.html)
Required alignment for the uncompressed data. **See sh_addralign.**

And `sh_addralign` description says
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html):
Some sections have address alignment constraints. For example, if a section holds a doubleword, the system must ensure doubleword alignment for the entire section. The value of sh_addr must be congruent to 0, modulo the value of sh_addralign. Currently, only 0 and positive integral powers of two are allowed. **Values 0 and 1 mean the section has no alignment constraints.**

So looks in according to the standard we want to handle 0 as 1.


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

https://reviews.llvm.org/D60959





More information about the llvm-commits mailing list