summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86TargetAsmInfo.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
index 965e8d6b77a..e3bc507bb84 100644
--- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -245,6 +245,7 @@ const Section*
X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
bool isWeak = GV->isWeakForLinker();
+ bool isNonStatic = (X86TM->getRelocationModel() != Reloc::Static);
switch (Kind) {
case SectionKind::Text:
@@ -261,7 +262,8 @@ X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
else
return (isWeak ? DataCoalSection : getDataSection_());
case SectionKind::ROData:
- return (isWeak ? ConstDataCoalSection : getReadOnlySection_());
+ return (isWeak ? ConstDataCoalSection :
+ (isNonStatic ? ConstDataSection : getReadOnlySection_()));
case SectionKind::RODataMergeStr:
return (isWeak ?
ConstDataCoalSection :
OpenPOWER on IntegriCloud