diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-08-08 06:56:16 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-08-08 06:56:16 +0000 |
commit | 655fa0fec4b9252f4d260f8ff46982e8c43fe8ac (patch) | |
tree | 1bc5a80a02557ef500263a0a57c1bbe4206829ba /llvm/lib/Target/DarwinTargetAsmInfo.cpp | |
parent | 319548b93c19fc504c17bf507f229faab38c384e (diff) | |
download | bcm5719-llvm-655fa0fec4b9252f4d260f8ff46982e8c43fe8ac.tar.gz bcm5719-llvm-655fa0fec4b9252f4d260f8ff46982e8c43fe8ac.zip |
It's not legal to output a GV in a coalesced section if it's used in an ARM PIC relative constantpool.
llvm-svn: 54519
Diffstat (limited to 'llvm/lib/Target/DarwinTargetAsmInfo.cpp')
-rw-r--r-- | llvm/lib/Target/DarwinTargetAsmInfo.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Target/DarwinTargetAsmInfo.cpp b/llvm/lib/Target/DarwinTargetAsmInfo.cpp index 749cb717943..978f5cf36ac 100644 --- a/llvm/lib/Target/DarwinTargetAsmInfo.cpp +++ b/llvm/lib/Target/DarwinTargetAsmInfo.cpp @@ -51,14 +51,15 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) { } const Section* -DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { +DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV, + bool NoCoalesce) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); - bool isWeak = GV->isWeakForLinker(); + bool CanCoalesce = !NoCoalesce && GV->isWeakForLinker(); bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static); switch (Kind) { case SectionKind::Text: - if (isWeak) + if (CanCoalesce) return TextCoalSection; else return getTextSection_(); @@ -67,18 +68,18 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { case SectionKind::BSS: case SectionKind::ThreadBSS: if (cast<GlobalVariable>(GV)->isConstant()) - return (isWeak ? ConstDataCoalSection : ConstDataSection); + return (CanCoalesce ? ConstDataCoalSection : ConstDataSection); else - return (isWeak ? DataCoalSection : getDataSection_()); + return (CanCoalesce ? DataCoalSection : getDataSection_()); case SectionKind::ROData: - return (isWeak ? ConstDataCoalSection : + return (CanCoalesce ? ConstDataCoalSection : (isNonStatic ? ConstDataSection : getReadOnlySection_())); case SectionKind::RODataMergeStr: - return (isWeak ? + return (CanCoalesce ? ConstDataCoalSection : MergeableStringSection(cast<GlobalVariable>(GV))); case SectionKind::RODataMergeConst: - return (isWeak ? + return (CanCoalesce ? ConstDataCoalSection: MergeableConstSection(cast<GlobalVariable>(GV))); default: |