|
@@ -50,14 +50,14 @@ using namespace dwarf;
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
|
|
MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
|
|
- const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
|
|
|
|
|
|
+ const GlobalValue *GV, const TargetMachine &TM,
|
|
MachineModuleInfo *MMI) const {
|
|
MachineModuleInfo *MMI) const {
|
|
unsigned Encoding = getPersonalityEncoding();
|
|
unsigned Encoding = getPersonalityEncoding();
|
|
if ((Encoding & 0x80) == dwarf::DW_EH_PE_indirect)
|
|
if ((Encoding & 0x80) == dwarf::DW_EH_PE_indirect)
|
|
return getContext().getOrCreateSymbol(StringRef("DW.ref.") +
|
|
return getContext().getOrCreateSymbol(StringRef("DW.ref.") +
|
|
- TM.getSymbol(GV, Mang)->getName());
|
|
|
|
|
|
+ TM.getSymbol(GV, getMangler())->getName());
|
|
if ((Encoding & 0x70) == dwarf::DW_EH_PE_absptr)
|
|
if ((Encoding & 0x70) == dwarf::DW_EH_PE_absptr)
|
|
- return TM.getSymbol(GV, Mang);
|
|
|
|
|
|
+ return TM.getSymbol(GV, getMangler());
|
|
report_fatal_error("We do not support this DWARF encoding yet!");
|
|
report_fatal_error("We do not support this DWARF encoding yet!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,20 +84,19 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(
|
|
}
|
|
}
|
|
|
|
|
|
const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
|
const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
|
- const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM, MachineModuleInfo *MMI,
|
|
|
|
- MCStreamer &Streamer) const {
|
|
|
|
|
|
+ const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
|
|
|
|
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
|
|
|
|
|
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
|
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
|
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
|
|
|
|
|
- MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
|
|
|
|
|
|
+ MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", TM);
|
|
|
|
|
|
// Add information about the stub reference to ELFMMI so that the stub
|
|
// Add information about the stub reference to ELFMMI so that the stub
|
|
// gets emitted by the asmprinter.
|
|
// gets emitted by the asmprinter.
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
|
if (!StubSym.getPointer()) {
|
|
if (!StubSym.getPointer()) {
|
|
- MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(GV, getMangler());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,8 +105,8 @@ const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
|
}
|
|
}
|
|
|
|
|
|
- return TargetLoweringObjectFile::
|
|
|
|
- getTTypeGlobalReference(GV, Encoding, Mang, TM, MMI, Streamer);
|
|
|
|
|
|
+ return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, TM,
|
|
|
|
+ MMI, Streamer);
|
|
}
|
|
}
|
|
|
|
|
|
static SectionKind
|
|
static SectionKind
|
|
@@ -205,8 +204,7 @@ static const Comdat *getELFComdat(const GlobalValue *GV) {
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
|
|
MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
StringRef SectionName = GV->getSection();
|
|
StringRef SectionName = GV->getSection();
|
|
|
|
|
|
// Infer section flags from the section name if we can.
|
|
// Infer section flags from the section name if we can.
|
|
@@ -310,8 +308,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
|
MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
unsigned Flags = getELFSectionFlags(Kind);
|
|
unsigned Flags = getELFSectionFlags(Kind);
|
|
|
|
|
|
// If we have -ffunction-section or -fdata-section then we should emit the
|
|
// If we have -ffunction-section or -fdata-section then we should emit the
|
|
@@ -325,12 +322,12 @@ MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
|
}
|
|
}
|
|
EmitUniqueSection |= GV->hasComdat();
|
|
EmitUniqueSection |= GV->hasComdat();
|
|
|
|
|
|
- return selectELFSectionForGlobal(getContext(), GV, Kind, Mang, TM,
|
|
|
|
|
|
+ return selectELFSectionForGlobal(getContext(), GV, Kind, getMangler(), TM,
|
|
EmitUniqueSection, Flags, &NextUniqueID);
|
|
EmitUniqueSection, Flags, &NextUniqueID);
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
|
MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
|
- const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
|
|
|
|
|
+ const Function &F, const TargetMachine &TM) const {
|
|
// If the function can be removed, produce a unique section so that
|
|
// If the function can be removed, produce a unique section so that
|
|
// the table doesn't prevent the removal.
|
|
// the table doesn't prevent the removal.
|
|
const Comdat *C = F.getComdat();
|
|
const Comdat *C = F.getComdat();
|
|
@@ -339,7 +336,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
|
return ReadOnlySection;
|
|
return ReadOnlySection;
|
|
|
|
|
|
return selectELFSectionForGlobal(getContext(), &F, SectionKind::getReadOnly(),
|
|
return selectELFSectionForGlobal(getContext(), &F, SectionKind::getReadOnly(),
|
|
- Mang, TM, EmitUniqueSection, ELF::SHF_ALLOC,
|
|
|
|
|
|
+ getMangler(), TM, EmitUniqueSection, ELF::SHF_ALLOC,
|
|
&NextUniqueID);
|
|
&NextUniqueID);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -423,7 +420,7 @@ MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
|
|
}
|
|
}
|
|
|
|
|
|
const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference(
|
|
const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference(
|
|
- const GlobalValue *LHS, const GlobalValue *RHS, Mangler &Mang,
|
|
|
|
|
|
+ const GlobalValue *LHS, const GlobalValue *RHS,
|
|
const TargetMachine &TM) const {
|
|
const TargetMachine &TM) const {
|
|
// We may only use a PLT-relative relocation to refer to unnamed_addr
|
|
// We may only use a PLT-relative relocation to refer to unnamed_addr
|
|
// functions.
|
|
// functions.
|
|
@@ -437,9 +434,9 @@ const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference(
|
|
return nullptr;
|
|
return nullptr;
|
|
|
|
|
|
return MCBinaryExpr::createSub(
|
|
return MCBinaryExpr::createSub(
|
|
- MCSymbolRefExpr::create(TM.getSymbol(LHS, Mang), PLTRelativeVariantKind,
|
|
|
|
|
|
+ MCSymbolRefExpr::create(TM.getSymbol(LHS, getMangler()), PLTRelativeVariantKind,
|
|
getContext()),
|
|
getContext()),
|
|
- MCSymbolRefExpr::create(TM.getSymbol(RHS, Mang), getContext()),
|
|
|
|
|
|
+ MCSymbolRefExpr::create(TM.getSymbol(RHS, getMangler()), getContext()),
|
|
getContext());
|
|
getContext());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -490,10 +487,9 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
|
|
}
|
|
}
|
|
|
|
|
|
/// emitModuleFlags - Perform code emission for module flags.
|
|
/// emitModuleFlags - Perform code emission for module flags.
|
|
-void TargetLoweringObjectFileMachO::
|
|
|
|
-emitModuleFlags(MCStreamer &Streamer,
|
|
|
|
- ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
|
|
|
- Mangler &Mang, const TargetMachine &TM) const {
|
|
|
|
|
|
+void TargetLoweringObjectFileMachO::emitModuleFlags(
|
|
|
|
+ MCStreamer &Streamer, ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
|
|
|
+ const TargetMachine &TM) const {
|
|
unsigned VersionVal = 0;
|
|
unsigned VersionVal = 0;
|
|
unsigned ImageInfoFlags = 0;
|
|
unsigned ImageInfoFlags = 0;
|
|
MDNode *LinkerOptions = nullptr;
|
|
MDNode *LinkerOptions = nullptr;
|
|
@@ -567,8 +563,7 @@ static void checkMachOComdat(const GlobalValue *GV) {
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
|
MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
// Parse the section specifier and create it if valid.
|
|
// Parse the section specifier and create it if valid.
|
|
StringRef Segment, Section;
|
|
StringRef Segment, Section;
|
|
unsigned TAA = 0, StubSize = 0;
|
|
unsigned TAA = 0, StubSize = 0;
|
|
@@ -609,8 +604,7 @@ MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
|
|
MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
checkMachOComdat(GV);
|
|
checkMachOComdat(GV);
|
|
|
|
|
|
// Handle thread local data.
|
|
// Handle thread local data.
|
|
@@ -695,23 +689,21 @@ MCSection *TargetLoweringObjectFileMachO::getSectionForConstant(
|
|
}
|
|
}
|
|
|
|
|
|
const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
|
const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
|
- const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM, MachineModuleInfo *MMI,
|
|
|
|
- MCStreamer &Streamer) const {
|
|
|
|
|
|
+ const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
|
|
|
|
+ MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
|
// The mach-o version of this method defaults to returning a stub reference.
|
|
// The mach-o version of this method defaults to returning a stub reference.
|
|
|
|
|
|
if (Encoding & DW_EH_PE_indirect) {
|
|
if (Encoding & DW_EH_PE_indirect) {
|
|
MachineModuleInfoMachO &MachOMMI =
|
|
MachineModuleInfoMachO &MachOMMI =
|
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
|
|
|
|
|
- MCSymbol *SSym =
|
|
|
|
- getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
|
|
|
|
|
|
+ MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", TM);
|
|
|
|
|
|
// Add information about the stub reference to MachOMMI so that the stub
|
|
// Add information about the stub reference to MachOMMI so that the stub
|
|
// gets emitted by the asmprinter.
|
|
// gets emitted by the asmprinter.
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
|
if (!StubSym.getPointer()) {
|
|
if (!StubSym.getPointer()) {
|
|
- MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(GV, getMangler());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -720,24 +712,24 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
|
}
|
|
}
|
|
|
|
|
|
- return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
|
|
|
|
- TM, MMI, Streamer);
|
|
|
|
|
|
+ return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, TM,
|
|
|
|
+ MMI, Streamer);
|
|
}
|
|
}
|
|
|
|
|
|
MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol(
|
|
MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol(
|
|
- const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
|
|
|
|
|
|
+ const GlobalValue *GV, const TargetMachine &TM,
|
|
MachineModuleInfo *MMI) const {
|
|
MachineModuleInfo *MMI) const {
|
|
// The mach-o version of this method defaults to returning a stub reference.
|
|
// The mach-o version of this method defaults to returning a stub reference.
|
|
MachineModuleInfoMachO &MachOMMI =
|
|
MachineModuleInfoMachO &MachOMMI =
|
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
|
|
|
|
|
- MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
|
|
|
|
|
|
+ MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", TM);
|
|
|
|
|
|
// Add information about the stub reference to MachOMMI so that the stub
|
|
// Add information about the stub reference to MachOMMI so that the stub
|
|
// gets emitted by the asmprinter.
|
|
// gets emitted by the asmprinter.
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
|
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
|
if (!StubSym.getPointer()) {
|
|
if (!StubSym.getPointer()) {
|
|
- MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(GV, getMangler());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -818,13 +810,13 @@ static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
|
|
}
|
|
}
|
|
|
|
|
|
void TargetLoweringObjectFileMachO::getNameWithPrefix(
|
|
void TargetLoweringObjectFileMachO::getNameWithPrefix(
|
|
- SmallVectorImpl<char> &OutName, const GlobalValue *GV, Mangler &Mang,
|
|
|
|
|
|
+ SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
|
const TargetMachine &TM) const {
|
|
const TargetMachine &TM) const {
|
|
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
|
|
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
|
|
- const MCSection *TheSection = SectionForGlobal(GV, GVKind, Mang, TM);
|
|
|
|
|
|
+ const MCSection *TheSection = SectionForGlobal(GV, GVKind, TM);
|
|
bool CannotUsePrivateLabel =
|
|
bool CannotUsePrivateLabel =
|
|
!canUsePrivateLabel(*TM.getMCAsmInfo(), *TheSection);
|
|
!canUsePrivateLabel(*TM.getMCAsmInfo(), *TheSection);
|
|
- Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
|
|
|
|
|
+ getMangler().getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
|
}
|
|
}
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
@@ -911,8 +903,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) {
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
|
MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
int Selection = 0;
|
|
int Selection = 0;
|
|
unsigned Characteristics = getCOFFSectionFlags(Kind, TM);
|
|
unsigned Characteristics = getCOFFSectionFlags(Kind, TM);
|
|
StringRef Name = GV->getSection();
|
|
StringRef Name = GV->getSection();
|
|
@@ -926,7 +917,7 @@ MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
|
ComdatGV = GV;
|
|
ComdatGV = GV;
|
|
|
|
|
|
if (!ComdatGV->hasPrivateLinkage()) {
|
|
if (!ComdatGV->hasPrivateLinkage()) {
|
|
- MCSymbol *Sym = TM.getSymbol(ComdatGV, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(ComdatGV, getMangler());
|
|
COMDATSymName = Sym->getName();
|
|
COMDATSymName = Sym->getName();
|
|
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
|
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
|
|
} else {
|
|
} else {
|
|
@@ -951,8 +942,7 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
|
|
MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
|
|
- const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|
|
|
- const TargetMachine &TM) const {
|
|
|
|
|
|
+ const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const {
|
|
// If we have -ffunction-sections then we should emit the global value to a
|
|
// If we have -ffunction-sections then we should emit the global value to a
|
|
// uniqued section specifically for it.
|
|
// uniqued section specifically for it.
|
|
bool EmitUniquedSection;
|
|
bool EmitUniquedSection;
|
|
@@ -980,13 +970,13 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
|
|
UniqueID = NextUniqueID++;
|
|
UniqueID = NextUniqueID++;
|
|
|
|
|
|
if (!ComdatGV->hasPrivateLinkage()) {
|
|
if (!ComdatGV->hasPrivateLinkage()) {
|
|
- MCSymbol *Sym = TM.getSymbol(ComdatGV, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(ComdatGV, getMangler());
|
|
StringRef COMDATSymName = Sym->getName();
|
|
StringRef COMDATSymName = Sym->getName();
|
|
return getContext().getCOFFSection(Name, Characteristics, Kind,
|
|
return getContext().getCOFFSection(Name, Characteristics, Kind,
|
|
COMDATSymName, Selection, UniqueID);
|
|
COMDATSymName, Selection, UniqueID);
|
|
} else {
|
|
} else {
|
|
SmallString<256> TmpData;
|
|
SmallString<256> TmpData;
|
|
- Mang.getNameWithPrefix(TmpData, GV, /*CannotUsePrivateLabel=*/true);
|
|
|
|
|
|
+ getMangler().getNameWithPrefix(TmpData, GV, /*CannotUsePrivateLabel=*/true);
|
|
return getContext().getCOFFSection(Name, Characteristics, Kind, TmpData,
|
|
return getContext().getCOFFSection(Name, Characteristics, Kind, TmpData,
|
|
Selection, UniqueID);
|
|
Selection, UniqueID);
|
|
}
|
|
}
|
|
@@ -1011,7 +1001,7 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
|
|
}
|
|
}
|
|
|
|
|
|
void TargetLoweringObjectFileCOFF::getNameWithPrefix(
|
|
void TargetLoweringObjectFileCOFF::getNameWithPrefix(
|
|
- SmallVectorImpl<char> &OutName, const GlobalValue *GV, Mangler &Mang,
|
|
|
|
|
|
+ SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
|
const TargetMachine &TM) const {
|
|
const TargetMachine &TM) const {
|
|
bool CannotUsePrivateLabel = false;
|
|
bool CannotUsePrivateLabel = false;
|
|
if (GV->hasPrivateLinkage() &&
|
|
if (GV->hasPrivateLinkage() &&
|
|
@@ -1019,11 +1009,11 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
|
|
(isa<GlobalVariable>(GV) && TM.getDataSections())))
|
|
(isa<GlobalVariable>(GV) && TM.getDataSections())))
|
|
CannotUsePrivateLabel = true;
|
|
CannotUsePrivateLabel = true;
|
|
|
|
|
|
- Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
|
|
|
|
|
+ getMangler().getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
|
}
|
|
}
|
|
|
|
|
|
MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
|
MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
|
- const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
|
|
|
|
|
+ const Function &F, const TargetMachine &TM) const {
|
|
// If the function can be removed, produce a unique section so that
|
|
// If the function can be removed, produce a unique section so that
|
|
// the table doesn't prevent the removal.
|
|
// the table doesn't prevent the removal.
|
|
const Comdat *C = F.getComdat();
|
|
const Comdat *C = F.getComdat();
|
|
@@ -1035,7 +1025,7 @@ MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
|
if (F.hasPrivateLinkage())
|
|
if (F.hasPrivateLinkage())
|
|
return ReadOnlySection;
|
|
return ReadOnlySection;
|
|
|
|
|
|
- MCSymbol *Sym = TM.getSymbol(&F, Mang);
|
|
|
|
|
|
+ MCSymbol *Sym = TM.getSymbol(&F, getMangler());
|
|
StringRef COMDATSymName = Sym->getName();
|
|
StringRef COMDATSymName = Sym->getName();
|
|
|
|
|
|
SectionKind Kind = SectionKind::getReadOnly();
|
|
SectionKind Kind = SectionKind::getReadOnly();
|
|
@@ -1048,10 +1038,9 @@ MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
|
COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE, UniqueID);
|
|
COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE, UniqueID);
|
|
}
|
|
}
|
|
|
|
|
|
-void TargetLoweringObjectFileCOFF::
|
|
|
|
-emitModuleFlags(MCStreamer &Streamer,
|
|
|
|
- ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
|
|
|
- Mangler &Mang, const TargetMachine &TM) const {
|
|
|
|
|
|
+void TargetLoweringObjectFileCOFF::emitModuleFlags(
|
|
|
|
+ MCStreamer &Streamer, ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
|
|
|
+ const TargetMachine &TM) const {
|
|
MDNode *LinkerOptions = nullptr;
|
|
MDNode *LinkerOptions = nullptr;
|
|
|
|
|
|
for (const auto &MFE : ModuleFlags) {
|
|
for (const auto &MFE : ModuleFlags) {
|
|
@@ -1115,7 +1104,7 @@ MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
|
|
}
|
|
}
|
|
|
|
|
|
void TargetLoweringObjectFileCOFF::emitLinkerFlagsForGlobal(
|
|
void TargetLoweringObjectFileCOFF::emitLinkerFlagsForGlobal(
|
|
- raw_ostream &OS, const GlobalValue *GV, const Mangler &Mang) const {
|
|
|
|
|
|
+ raw_ostream &OS, const GlobalValue *GV) const {
|
|
if (!GV->hasDLLExportStorageClass() || GV->isDeclaration())
|
|
if (!GV->hasDLLExportStorageClass() || GV->isDeclaration())
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -1129,14 +1118,14 @@ void TargetLoweringObjectFileCOFF::emitLinkerFlagsForGlobal(
|
|
if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
|
|
if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
|
|
std::string Flag;
|
|
std::string Flag;
|
|
raw_string_ostream FlagOS(Flag);
|
|
raw_string_ostream FlagOS(Flag);
|
|
- Mang.getNameWithPrefix(FlagOS, GV, false);
|
|
|
|
|
|
+ getMangler().getNameWithPrefix(FlagOS, GV, false);
|
|
FlagOS.flush();
|
|
FlagOS.flush();
|
|
if (Flag[0] == GV->getParent()->getDataLayout().getGlobalPrefix())
|
|
if (Flag[0] == GV->getParent()->getDataLayout().getGlobalPrefix())
|
|
OS << Flag.substr(1);
|
|
OS << Flag.substr(1);
|
|
else
|
|
else
|
|
OS << Flag;
|
|
OS << Flag;
|
|
} else {
|
|
} else {
|
|
- Mang.getNameWithPrefix(OS, GV, false);
|
|
|
|
|
|
+ getMangler().getNameWithPrefix(OS, GV, false);
|
|
}
|
|
}
|
|
|
|
|
|
if (!GV->getValueType()->isFunctionTy()) {
|
|
if (!GV->getValueType()->isFunctionTy()) {
|