[all-commits] [llvm/llvm-project] 6ed8e2: [ELF] Ignore the maximum of input section alignmen...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Feb 21 08:12:13 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 6ed8e2014330b6a48d238cdc4357e788cdd6d445
https://github.com/llvm/llvm-project/commit/6ed8e2014330b6a48d238cdc4357e788cdd6d445
Author: Fangrui Song <maskray at google.com>
Date: 2020-02-21 (Fri, 21 Feb 2020)
Changed paths:
M lld/ELF/LinkerScript.cpp
M lld/ELF/Writer.cpp
M lld/test/ELF/linkerscript/lma-align.test
M lld/test/ELF/linkerscript/outsections-addr.s
A lld/test/ELF/linkerscript/section-align2.test
Log Message:
-----------
[ELF] Ignore the maximum of input section alignments for two cases
Follow-up for D74286.
Notations:
* alignExpr: the computed ALIGN value
* max_input_align: the maximum of input section alignments
This patch changes the following two cases to match GNU ld:
* When ALIGN is present, GNU ld sets output sh_addr to alignExpr, while lld use max(alignExpr, max_input_align)
* When addrExpr is specified but alignExpr is not, GNU ld sets output sh_addr to addrExpr, while lld uses `advance(0, max_input_align)`
Note, sh_addralign is still set to max(alignExpr, max_input_align).
lma-align.test is enhanced a bit to check we don't overalign sh_addr.
fixSectionAlignments() sets addrExpr but not alignExpr for the `!hasSectionsCommand` case.
This patch sets alignExpr as well so that max_input_align will be respected.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D74736
More information about the All-commits
mailing list