[lld/COFF] Don't round alignment if it's already a power-of-two.

This matches link.exe behaviour.

Differential Revision:  https://reviews.llvm.org/D26372

llvm-svn: 286553
This commit is contained in:
Davide Italiano 2016-11-11 02:53:48 +00:00
parent c5bf4b831d
commit c520e18ce0
2 changed files with 2 additions and 2 deletions

View File

@ -249,7 +249,7 @@ void SectionChunk::replace(SectionChunk *Other) {
CommonChunk::CommonChunk(const COFFSymbolRef S) : Sym(S) {
// Common symbols are aligned on natural boundaries up to 32 bytes.
// This is what MSVC link.exe does.
Align = std::min(uint64_t(32), NextPowerOf2(Sym.getValue()));
Align = std::min(uint64_t(32), PowerOf2Ceil(Sym.getValue()));
}
uint32_t CommonChunk::getPermissions() const {

View File

@ -7,7 +7,7 @@
# CHECK: 3005: b8 04 10 00 40
# CHECK: 300a: b8 20 10 00 40
# CHECK: 300f: b8 60 10 00 40
# CHECK: 3014: b8 80 10 00 40
# CHECK: 3014: b8 70 10 00 40
--- !COFF
header: