This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by grimar on Apr 22 2019, 2:08 AM.

Diff Detail

Event Timeline

grimar created this revision.Apr 22 2019, 2:08 AM
ruiu added inline comments.Apr 22 2019, 2:13 AM
ELF/InputSection.cpp
256

What is the definition of ch_addralign if it's 0? I wonder if we have to handle 0 as 1.

grimar marked an inline comment as done.Apr 22 2019, 2:24 AM
grimar added inline comments.
ELF/InputSection.cpp
256

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.

grimar updated this revision to Diff 196042.Apr 22 2019, 2:59 AM
  • Add support for ch_addralign == 0 and a test case.
ruiu accepted this revision.Apr 22 2019, 3:05 AM

LGTM

This revision is now accepted and ready to land.Apr 22 2019, 3:05 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2019, 6:39 AM