virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const;
+ Mangler *Mang, const TargetMachine &TM) const;
/// getTTypeGlobalReference - Return an MCExpr to use for a reference to the
/// specified type info global variable from exception handling information.
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const;
+ Mangler *Mang, const TargetMachine &TM) const;
virtual const MCSection *
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const;
+ Mangler *Mang, const TargetMachine &TM) const;
/// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
/// option string. Returns StringRef() if the option does not specify a library.
const DataLayout *DL;
TargetLoweringObjectFile(
- const TargetLoweringObjectFile &) LLVM_DELETED_FUNCTION;
+ const TargetLoweringObjectFile&) LLVM_DELETED_FUNCTION;
void operator=(const TargetLoweringObjectFile&) LLVM_DELETED_FUNCTION;
public:
/// be passed external (or available externally) globals.
const MCSection *SectionForGlobal(const GlobalValue *GV,
SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const;
+ const TargetMachine &TM) const;
/// SectionForGlobal - This method computes the appropriate section to emit
/// the specified global variable or function definition. This should not
/// be passed external (or available externally) globals.
const MCSection *SectionForGlobal(const GlobalValue *GV,
Mangler *Mang,
- TargetMachine &TM) const {
+ const TargetMachine &TM) const {
return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
}
protected:
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const;
+ Mangler *Mang, const TargetMachine &TM) const;
};
} // end namespace llvm
unsigned MCUseLoc : 1;
unsigned MCUseCFI : 1;
unsigned MCUseDwarfDirectory : 1;
- unsigned DebugUseUniqueSections : 1;
unsigned RequireStructuredCFG : 1;
public:
bool requiresStructuredCFG() const { return RequireStructuredCFG; }
void setRequiresStructuredCFG(bool Value) { RequireStructuredCFG = Value; }
- bool debugUseUniqueSections() const { return DebugUseUniqueSections; }
- void setDebugUseUniqueSections(bool Value) { DebugUseUniqueSections = Value; }
-
/// hasMCRelaxAll - Check whether all machine code instructions should be
/// relaxed.
bool hasMCRelaxAll() const { return MCRelaxAll; }
: Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator),
PrevLabel(NULL), GlobalRangeCount(0),
InfoHolder(A, "info_string", DIEValueAllocator), HasCURanges(false),
+ UsedNonDefaultText(false),
SkeletonHolder(A, "skel_string", DIEValueAllocator) {
DwarfInfoSectionSym = DwarfAbbrevSectionSym = DwarfStrSectionSym = 0;
// we have -ffunction-sections enabled, or we've emitted a function
// into a unique section. At this point all sections should be finalized
// except for dwarf sections.
- HasCURanges = DwarfCURanges || Asm->TM.debugUseUniqueSections() ||
+ HasCURanges = DwarfCURanges || UsedNonDefaultText ||
TargetMachine::getFunctionSections();
}
else
Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
+ // Check the current section against the standard text section. If different
+ // keep track so that we will know when we're emitting functions into multiple
+ // sections.
+ if (Asm->getObjFileLowering().getTextSection() != Asm->getCurrentSection())
+ UsedNonDefaultText = true;
+
// Emit a label for the function so that we have a beginning address.
FunctionBeginSym = Asm->GetTempSymbol("func_begin", Asm->getFunctionNumber());
// Assumes in correct section after the entry point.
// Whether or not to use AT_ranges for compilation units.
bool HasCURanges;
+ // Whether we emitted a function into a section other than the default
+ // text.
+ bool UsedNonDefaultText;
+
// Version of dwarf we're emitting.
unsigned DwarfVersion;
const MCSection *TargetLoweringObjectFileELF::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
// If we have -ffunction-section or -fdata-section then we should emit the
// global value to a uniqued section specifically for it.
bool EmitUniquedSection;
Flags |= ELF::SHF_GROUP;
}
- // Set that we've used a unique section name in the target machine.
- TM.setDebugUseUniqueSections(true);
return getContext().getELFSection(Name.str(),
getELFSectionType(Name.str(), Kind),
Flags, Kind, 0, Group);
const MCSection *TargetLoweringObjectFileMachO::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
// Handle thread local data.
if (Kind.isThreadBSS()) return TLSBSSSection;
const MCSection *TargetLoweringObjectFileCOFF::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
// If this global is linkonce/weak and the target handles this by emitting it
// into a 'uniqued' section name, create and return the section now.
const MCSection *HexagonTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
// Handle Small Section classification here.
if (Kind.isBSS() && IsGlobalInSmallSection(GV, TM, Kind))
const TargetMachine &TM) const;
bool IsSmallDataEnabled () const;
- const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const;
+ const MCSection* SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind,
+ Mangler *Mang,
+ const TargetMachine &TM) const;
};
} // namespace llvm
const MCSection *MipsTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
// TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*"
// sections?
const TargetMachine &TM) const;
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const;
+ SectionKind Kind,
+ Mangler *Mang,
+ const TargetMachine &TM) const;
// TODO: Classify globals as mips wishes.
const MCSection *getReginfoSection() const { return ReginfoSection; }
const MCSection * PPC64LinuxTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler *Mang, TargetMachine &TM) const {
+ Mangler *Mang, const TargetMachine &TM) const {
const MCSection *DefaultSection =
TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
- virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
- Mangler *Mang,
- TargetMachine &TM) const;
+ virtual const MCSection *
+ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler *Mang, const TargetMachine &TM) const;
/// \brief Describe a TLS variable address within debug info.
virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
/// be passed external (or available externally) globals.
const MCSection *TargetLoweringObjectFile::
SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const {
+ const TargetMachine &TM) const {
// Select section name.
if (GV->hasSection())
return getExplicitSectionGlobal(GV, Kind, Mang, TM);
// Lame default implementation. Calculate the section name for global.
-const MCSection *TargetLoweringObjectFile::SelectSectionForGlobal(
- const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const {
+const MCSection *
+TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind,
+ Mangler *Mang,
+ const TargetMachine &TM) const{
assert(!Kind.isThreadLocal() && "Doesn't support TLS");
if (Kind.isText())
MCUseLoc(true),
MCUseCFI(true),
MCUseDwarfDirectory(false),
- DebugUseUniqueSections(false),
RequireStructuredCFG(false),
Options(Options) {
}
const MCSection *XCoreTargetObjectFile::
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang,
- TargetMachine &TM) const{
+ const TargetMachine &TM) const{
if (Kind.isText()) return TextSection;
if (Kind.isMergeable1ByteCString()) return CStringSection;
if (Kind.isMergeableConst4()) return MergeableConst4Section;
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
- virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind,
- Mangler *Mang,
- TargetMachine &TM) const;
+ virtual const MCSection *
+ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler *Mang, const TargetMachine &TM) const;
virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
};