summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetLoweringObjectFile.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/Target/TargetLoweringObjectFile.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/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index a0b0d8f2404..3c04a214fad 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -252,8 +252,10 @@ TargetLoweringObjectFile::SectionForGlobal(const GlobalValue *GV,
MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
+ unsigned Align = 0;
return getSectionForConstant(F.getParent()->getDataLayout(),
- SectionKind::getReadOnly(), /*C=*/nullptr);
+ SectionKind::getReadOnly(), /*C=*/nullptr,
+ Align);
}
bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
@@ -277,7 +279,8 @@ bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
/// Given a mergable constant with the specified size and relocation
/// information, return a section that it should be placed in.
MCSection *TargetLoweringObjectFile::getSectionForConstant(
- const DataLayout &DL, SectionKind Kind, const Constant *C) const {
+ const DataLayout &DL, SectionKind Kind, const Constant *C,
+ unsigned &Align) const {
if (Kind.isReadOnly() && ReadOnlySection != nullptr)
return ReadOnlySection;
OpenPOWER on IntegriCloud