MaxOperandLength = 0;
GlobalPrefix = "";
PrivateGlobalPrefix = ".";
- LessPrivateGlobalPrefix = "";
+ LinkerPrivateGlobalPrefix = "";
JumpTableSpecialLabelPrefix = 0;
GlobalVarAddrPrefix = "";
GlobalVarAddrSuffix = "";
return false;
}
-unsigned TargetAsmInfo::RelocBehaviour() const {
- // By default - all relocations in PIC mode would force symbol to be
- // placed in r/w section.
- return (TM.getRelocationModel() != Reloc::Static ?
- Reloc::LocalOrGlobal : Reloc::None);
-}
-
SectionKind::Kind
TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
// Early exit - functions should be always in text sections.
if (isSuitableForBSS(GVar)) {
// Variable can be easily put to BSS section.
- return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS);
+ return isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS;
} else if (GVar->isConstant() && !isThreadLocal) {
- // Now we know, that varible has initializer and it is constant. We need to
+ // Now we know, that variable has initializer and it is constant. We need to
// check its initializer to decide, which section to output it into. Also
// note, there is no thread-local r/o section.
Constant *C = GVar->getInitializer();
- if (C->ContainsRelocations(Reloc::LocalOrGlobal)) {
- // Decide, whether it is still possible to put symbol into r/o section.
- unsigned Reloc = RelocBehaviour();
-
- // We already did a query for 'all' relocs, thus - early exits.
- if (Reloc == Reloc::LocalOrGlobal)
+ if (C->getRelocationInfo() != 0) {
+ // Decide whether it is still possible to put symbol into r/o section.
+ if (TM.getRelocationModel() != Reloc::Static)
return SectionKind::Data;
- else if (Reloc == Reloc::None)
+ else
return SectionKind::ROData;
- else {
- // Ok, target wants something funny. Honour it.
- return (C->ContainsRelocations(Reloc) ?
- SectionKind::Data : SectionKind::ROData);
- }
} else {
// Check, if initializer is a null-terminated string
if (isConstantString(C))
if (GV) {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
switch (Kind) {
- case SectionKind::Text:
+ case SectionKind::Text:
Flags |= SectionFlags::Code;
break;
- case SectionKind::ThreadData:
- case SectionKind::ThreadBSS:
+ case SectionKind::ThreadData:
+ case SectionKind::ThreadBSS:
Flags |= SectionFlags::TLS;
// FALLS THROUGH
- case SectionKind::Data:
- case SectionKind::DataRel:
- case SectionKind::DataRelLocal:
- case SectionKind::DataRelRO:
- case SectionKind::DataRelROLocal:
- case SectionKind::BSS:
+ case SectionKind::Data:
+ case SectionKind::DataRel:
+ case SectionKind::DataRelLocal:
+ case SectionKind::DataRelRO:
+ case SectionKind::DataRelROLocal:
+ case SectionKind::BSS:
Flags |= SectionFlags::Writeable;
break;
- case SectionKind::ROData:
- case SectionKind::RODataMergeStr:
- case SectionKind::RODataMergeConst:
+ case SectionKind::ROData:
+ case SectionKind::RODataMergeStr:
+ case SectionKind::RODataMergeConst:
// No additional flags here
break;
- case SectionKind::SmallData:
- case SectionKind::SmallBSS:
+ case SectionKind::SmallData:
+ case SectionKind::SmallBSS:
Flags |= SectionFlags::Writeable;
// FALLS THROUGH
- case SectionKind::SmallROData:
+ case SectionKind::SmallROData:
Flags |= SectionFlags::Small;
break;
- default:
+ default:
llvm_unreachable("Unexpected section kind!");
}
return Flags;
}
-const Section*
-TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
- const Section* S;
+const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
// Select section name
if (GV->hasSection()) {
- // Honour section already set, if any
- unsigned Flags = SectionFlagsForGlobal(GV,
- GV->getSection().c_str());
- S = getNamedSection(GV->getSection().c_str(), Flags);
- } else {
- // Use default section depending on the 'type' of global
- S = SelectSectionForGlobal(GV);
+ // Honour section already set, if any.
+ unsigned Flags = SectionFlagsForGlobal(GV, GV->getSection().c_str());
+ return getNamedSection(GV->getSection().c_str(), Flags);
}
-
- return S;
+
+ // Use default section depending on the 'type' of global
+ return SelectSectionForGlobal(GV);
}
// Lame default implementation. Calculate the section name for global.
return NULL;
}
-const Section*
-TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
- bool Override) const {
- Section& S = Sections[Name];
+const Section *TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
+ bool Override) const {
+ Section &S = Sections[Name];
// This is newly-created section, set it up properly.
if (S.Flags == SectionFlags::Invalid || Override) {