[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)
commitb9ed9cb5d7e36bcb07b437a8980df32cfe8268a2
treecae481c684625b3a0100092411c8ee5b2d486f38
parent7a784203535b2ec0712d85f898ab1a874530d084
[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

llvm-svn: 358960
llvm/lib/MC/ELFObjectWriter.cpp
llvm/test/MC/ELF/compression.s