summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFStreamer.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-10-08 06:38:53 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-10-08 06:38:53 +0000
commitd7586046ee8a006b7589e63ee20a096f2e6f1fb1 (patch)
tree78bd0d05e43b6aeea980fc5e9e28f7a121614b7e /llvm/lib/MC/WinCOFFStreamer.cpp
parent5fbe324ff9b28c04fe62c9a1e40dc7893de5e979 (diff)
downloadbcm5719-llvm-d7586046ee8a006b7589e63ee20a096f2e6f1fb1.tar.gz
bcm5719-llvm-d7586046ee8a006b7589e63ee20a096f2e6f1fb1.zip
COFF: Don't oversize COMMON symbols when targeting BFD ld
COFF normally doesn't allow us to describe the alignment of COMMON symbols. It turns out that most linkers use the symbol size as a hint as to how aligned the symbol should be. However the BFD folks have added a .drectve command, which we now support as of r219229, that allows us to specify the alignment precisely. With this in mind, stop rounding sizes up. llvm-svn: 219281
Diffstat (limited to 'llvm/lib/MC/WinCOFFStreamer.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFStreamer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index 9bae53706a0..b8d5f2a11b5 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -185,14 +185,13 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
"Got non-COFF section in the COFF backend!");
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
- if (T.isKnownWindowsMSVCEnvironment())
+ if (T.isKnownWindowsMSVCEnvironment()) {
if (ByteAlignment > 32)
report_fatal_error("alignment is limited to 32-bytes");
- // Round size up to alignment so that we will honor the alignment request.
- // TODO: We don't need to do this if we are targeting the bfd linker once we
- // add support for adding -aligncomm into the .drectve section.
- Size = std::max(Size, static_cast<uint64_t>(ByteAlignment));
+ // Round size up to alignment so that we will honor the alignment request.
+ Size = std::max(Size, static_cast<uint64_t>(ByteAlignment));
+ }
AssignSection(Symbol, nullptr);
OpenPOWER on IntegriCloud