summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-02-21 01:30:30 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-02-21 01:30:30 +0000
commita3ea407d48eba34c712399c8885a49861ea9a741 (patch)
treebd1e7ff265d796fa63c38c1af1e0eeaca075268b /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent96a01fa04671d7c554007d256294f4ddd96d3eee (diff)
downloadbcm5719-llvm-a3ea407d48eba34c712399c8885a49861ea9a741.tar.gz
bcm5719-llvm-a3ea407d48eba34c712399c8885a49861ea9a741.zip
[X86] Use the correct alignment for COMDAT constant pool entries
COFF doesn't have sections with mergeable contents. Instead, each constant pool entry ends up in a COMDAT section. The linker, when choosing between COMDAT sections, doesn't choose the max alignment of the two sections. You just get whatever alignment was on the section. If one constant needed a higher alignment in one object file from another one, then we will get into trouble if the linker chooses the lower alignment one. Instead, lets promote the alignment of the constant pool entry to make sure we don't use an under aligned constant with an instruction which assumed otherwise. This fixes PR26680. llvm-svn: 261462
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 5dfdb7acef1..81b429a8d11 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -351,7 +351,8 @@ bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(
/// Given a mergeable constant with the specified size and relocation
/// information, return a section that it should be placed in.
MCSection *TargetLoweringObjectFileELF::getSectionForConstant(
- const DataLayout &DL, SectionKind Kind, const Constant *C) const {
+ const DataLayout &DL, SectionKind Kind, const Constant *C,
+ unsigned &Align) const {
if (Kind.isMergeableConst4() && MergeableConst4Section)
return MergeableConst4Section;
if (Kind.isMergeableConst8() && MergeableConst8Section)
@@ -636,7 +637,8 @@ MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
}
MCSection *TargetLoweringObjectFileMachO::getSectionForConstant(
- const DataLayout &DL, SectionKind Kind, const Constant *C) const {
+ const DataLayout &DL, SectionKind Kind, const Constant *C,
+ unsigned &Align) const {
// If this constant requires a relocation, we have to put it in the data
// segment, not in the text segment.
if (Kind.isData() || Kind.isReadOnlyWithRel())
OpenPOWER on IntegriCloud