[PATCH] D26372: [COFF] Don't round alignment if it's already a power-of-two
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 15:01:54 PST 2016
davide created this revision.
davide added a reviewer: ruiu.
davide added a subscriber: llvm-commits.
This seems to match what `link.exe` does.
https://reviews.llvm.org/D26372
Files:
COFF/Chunks.cpp
test/COFF/common.test
Index: test/COFF/common.test
===================================================================
--- test/COFF/common.test
+++ test/COFF/common.test
@@ -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:
Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -249,7 +249,9 @@
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()));
+ uint32_t Value = Sym.getValue();
+ Align = std::min(uint64_t(32),
+ isPowerOf2_64(Value) ? Value : NextPowerOf2(Value));
}
uint32_t CommonChunk::getPermissions() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26372.77107.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161107/8a2e9f31/attachment.bin>
More information about the llvm-commits
mailing list