OSDN Git Service

[llvm-mc] - Properly set the the address align field of the compressed sections.
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 23 Apr 2019 09:16:53 +0000 (09:16 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 23 Apr 2019 09:16:53 +0000 (09:16 +0000)
commitd0c7e1df707fbc6f457f16d95bc044b0406123e7
tree69e5942c7aa59e5f74b0f2bcc9a54d58ddc65fd9
parentc540d91184518fcbf065ccb299cd1f69eac99afb
[llvm-mc] - Properly set the the address align field of the compressed sections.

About the compressed sections spec says:
(https://docs.oracle.com/cd/E37838_01/html/E36783/section_compression.html)
sh_addralign fields of the section header for a compressed section
reflect the requirements of the compressed section.

Currently, llvm-mc always puts uncompressed section alignment to sh_addralign.
It is not correct. zlib styled section contains an Elfxx_Chdr header,
so we should either use 4 or 8 values depending on the target
(Uncompressed section alignment is stored in ch_addralign field of the compression header).

GNU assembler version 2.31.1 also has this issue,
but in 2.32.51 it was already fixed. This is how it was found
during debugging of the https://bugs.llvm.org/show_bug.cgi?id=40482
actually.

Differential revision: https://reviews.llvm.org/D60965

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358960 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/ELFObjectWriter.cpp
test/MC/ELF/compression.s