diff options
Diffstat (limited to 'lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 6aca6da8af..e983285f33 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -274,19 +274,18 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const { } -const MCSection *TargetLoweringObjectFile:: -getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const { - if (MCSection *S = Ctx->GetSection(Name)) - return S; - return MCSection::Create(Name, isDirective, Kind, *Ctx); -} - - //===----------------------------------------------------------------------===// // ELF //===----------------------------------------------------------------------===// +const MCSection *TargetLoweringObjectFileELF:: +getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const { + if (MCSection *S = getContext().GetSection(Name)) + return S; + return MCSection::Create(Name, isDirective, Kind, getContext()); +} + void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx, const TargetMachine &TM) { TargetLoweringObjectFile::Initialize(Ctx, TM); @@ -576,6 +575,13 @@ getSectionForConstant(SectionKind Kind) const { //===----------------------------------------------------------------------===// const MCSection *TargetLoweringObjectFileMachO:: +getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const { + if (MCSection *S = getContext().GetSection(Name)) + return S; + return MCSection::Create(Name, isDirective, Kind, getContext()); +} + +const MCSection *TargetLoweringObjectFileMachO:: getMachOSection(const char *Name, bool isDirective, SectionKind K) { // FOR NOW, Just forward. return getOrCreateSection(Name, isDirective, K); @@ -789,6 +795,13 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const { //===----------------------------------------------------------------------===// const MCSection *TargetLoweringObjectFileCOFF:: +getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const { + if (MCSection *S = getContext().GetSection(Name)) + return S; + return MCSection::Create(Name, isDirective, Kind, getContext()); +} + +const MCSection *TargetLoweringObjectFileCOFF:: getCOFFSection(const char *Name, bool isDirective, SectionKind K) { return getOrCreateSection(Name, isDirective, K); } |