llvm.org GIT mirror llvm / cebae36
Add a bit along with the MCSymbols stored in the MachineModuleInfo maps that indicates that an MCSymbol is external or not. (It's true if it's external.) This will be used to specify the correct information to add to non-lazy pointers. That will be explained further when this bit is used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98199 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 10 years ago
8 changed file(s) with 141 addition(s) and 99 deletion(s). Raw diff Collapse all Expand all
3030 #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H
3131 #define LLVM_CODEGEN_MACHINEMODULEINFO_H
3232
33 #include "llvm/Support/Dwarf.h"
34 #include "llvm/System/DataTypes.h"
35 #include "llvm/ADT/SmallVector.h"
36 #include "llvm/ADT/DenseMap.h"
37 #include "llvm/ADT/UniqueVector.h"
38 #include "llvm/ADT/SmallPtrSet.h"
39 #include "llvm/ADT/SmallSet.h"
40 #include "llvm/ADT/StringMap.h"
41 #include "llvm/CodeGen/MachineLocation.h"
4233 #include "llvm/GlobalValue.h"
4334 #include "llvm/Pass.h"
4435 #include "llvm/Metadata.h"
36 #include "llvm/ADT/DenseMap.h"
37 #include "llvm/ADT/PointerIntPair.h"
38 #include "llvm/ADT/SmallPtrSet.h"
39 #include "llvm/ADT/SmallSet.h"
40 #include "llvm/ADT/SmallVector.h"
41 #include "llvm/ADT/StringMap.h"
42 #include "llvm/ADT/UniqueVector.h"
43 #include "llvm/CodeGen/MachineLocation.h"
44 #include "llvm/Support/Dwarf.h"
4545 #include "llvm/Support/ValueHandle.h"
46 #include "llvm/System/DataTypes.h"
4647
4748 namespace llvm {
4849
4950 //===----------------------------------------------------------------------===//
5051 // Forward declarations.
5152 class Constant;
53 class GlobalVariable;
5254 class MCSymbol;
5355 class MDNode;
54 class GlobalVariable;
5556 class MachineBasicBlock;
5657 class MachineFunction;
5758 class Module;
5859 class PointerType;
5960 class StructType;
60
6161
6262 /// MachineModuleInfoImpl - This class can be derived from and used by targets
6363 /// to hold private target-specific information for each Module. Objects of
6565 /// MachineModuleInfo is destroyed.
6666 class MachineModuleInfoImpl {
6767 public:
68 typedef PointerIntPair StubValueTy;
6869 virtual ~MachineModuleInfoImpl();
69
70 typedef std::vector >
71 SymbolListTy;
70 typedef std::vector > SymbolListTy;
7271 protected:
73 static SymbolListTy
74 GetSortedStubs(const DenseMap &Map);
72 static SymbolListTy GetSortedStubs(const DenseMap&);
7573 };
7674
7775
2424 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
2525 /// FnStubs - Darwin '$stub' stubs. The key is something like "Lfoo$stub",
2626 /// the value is something like "_foo".
27 DenseMapMCSymbol*> FnStubs;
27 DenseMapStubValueTy> FnStubs;
2828
2929 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
30 /// "Lfoo$non_lazy_ptr", the value is something like "_foo".
31 DenseMap GVStubs;
30 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
31 /// is true if this GV is external.
32 DenseMap GVStubs;
3233
3334 /// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
3435 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
35 /// these are for things with hidden visibility.
36 DenseMap HiddenGVStubs;
36 /// these are for things with hidden visibility. The extra bit is true if
37 /// this GV is external.
38 DenseMap HiddenGVStubs;
3739
3840 virtual void Anchor(); // Out of line virtual method.
3941 public:
4042 MachineModuleInfoMachO(const MachineModuleInfo &) {}
4143
42 MCSymbol *&getFnStubEntry(MCSymbol *Sym) {
44 StubValueTy &getFnStubEntry(MCSymbol *Sym) {
4345 assert(Sym && "Key cannot be null");
4446 return FnStubs[Sym];
4547 }
4648
47 MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
49 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
4850 assert(Sym && "Key cannot be null");
4951 return GVStubs[Sym];
5052 }
5153
52 MCSymbol *&getHiddenGVStubEntry(MCSymbol *Sym) {
54 StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
5355 assert(Sym && "Key cannot be null");
5456 return HiddenGVStubs[Sym];
5557 }
7173 class MachineModuleInfoELF : public MachineModuleInfoImpl {
7274 /// GVStubs - These stubs are used to materialize global addresses in PIC
7375 /// mode.
74 DenseMapMCSymbol*> GVStubs;
76 DenseMapStubValueTy> GVStubs;
7577
7678 virtual void Anchor(); // Out of line virtual method.
7779 public:
7880 MachineModuleInfoELF(const MachineModuleInfo &) {}
7981
80 MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
82 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
8183 assert(Sym && "Key cannot be null");
8284 return GVStubs[Sym];
8385 }
2424 void MachineModuleInfoELF::Anchor() {}
2525
2626 static int SortSymbolPair(const void *LHS, const void *RHS) {
27 const MCSymbol *LHSS =
28 ((const std::pair*)LHS)->first;
29 const MCSymbol *RHSS =
30 ((const std::pair*)RHS)->first;
27 typedef std::pair PairTy;
28 const MCSymbol *LHSS = ((const PairTy *)LHS)->first;
29 const MCSymbol *RHSS = ((const PairTy *)RHS)->first;
3130 return LHSS->getName().compare(RHSS->getName());
3231 }
3332
3534 /// sorted orer.
3635 MachineModuleInfoImpl::SymbolListTy
3736 MachineModuleInfoImpl::GetSortedStubs(const DenseMap
38 MCSymbol*> &Map) {
37 MachineModuleInfoImpl::StubValueTy>&Map) {
3938 MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
4039
4140 if (!List.empty())
403403 // Add information about the stub reference to ELFMMI so that the stub
404404 // gets emitted by the asmprinter.
405405 MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str());
406 MCSymbol *&StubSym = ELFMMI.getGVStubEntry(Sym);
407 if (StubSym == 0) {
406 MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(Sym);
407 if (StubSym.getPointer() == 0) {
408408 Name.clear();
409409 Mang->getNameWithPrefix(Name, GV, false);
410
410411 if (GV->hasPrivateLinkage())
411 StubSym = getContext().GetOrCreateTemporarySymbol(Name.str());
412 StubSym = MachineModuleInfoImpl::
413 StubValueTy(getContext().GetOrCreateTemporarySymbol(Name.str()),
414 false);
412415 else
413 StubSym = getContext().GetOrCreateSymbol(Name.str());
416 StubSym = MachineModuleInfoImpl::
417 StubValueTy(getContext().GetOrCreateSymbol(Name.str()),
418 !GV->hasInternalLinkage());
414419 }
415420
416421 return TargetLoweringObjectFile::
760765 // Add information about the stub reference to MachOMMI so that the stub
761766 // gets emitted by the asmprinter.
762767 MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str());
763 MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
764 if (StubSym == 0) {
768 MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(Sym);
769 if (StubSym.getPointer() == 0) {
765770 Name.clear();
766771 Mang->getNameWithPrefix(Name, GV, false);
772
767773 if (GV->hasPrivateLinkage())
768 StubSym = getContext().GetOrCreateTemporarySymbol(Name.str());
774 StubSym = MachineModuleInfoImpl::
775 StubValueTy(getContext().GetOrCreateTemporarySymbol(Name.str()),
776 false);
769777 else
770 StubSym = getContext().GetOrCreateSymbol(Name.str());
778 StubSym = MachineModuleInfoImpl::
779 StubValueTy(getContext().GetOrCreateSymbol(Name.str()),
780 !GV->hasInternalLinkage());
771781 }
772782
773783 return TargetLoweringObjectFile::
204204
205205 MachineModuleInfoMachO &MMIMachO =
206206 MMI->getObjFileInfo();
207 MCSymbol *&StubSym =
207 MachineModuleInfoImpl::StubValueTy &StubSym =
208208 GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(Sym) :
209209 MMIMachO.getGVStubEntry(Sym);
210 if (StubSym == 0)
211 StubSym = GetGlobalValueSymbol(GV);
210 if (StubSym.getPointer() == 0)
211 StubSym = MachineModuleInfoImpl::
212 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
212213 }
213214 } else {
214215 assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
11251126
11261127 // Output non-lazy-pointers for external and common global variables.
11271128 MachineModuleInfoMachO::SymbolListTy Stubs = MMIMacho.GetGVStubList();
1128
1129
11291130 if (!Stubs.empty()) {
11301131 // Switch with ".non_lazy_symbol_pointer" directive.
11311132 OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
11341135 // L_foo$stub:
11351136 OutStreamer.EmitLabel(Stubs[i].first);
11361137 // .indirect_symbol _foo
1137 MCSymbol *MCSym = Stubs[i].second;
1138 MCSymbol *MCSym = Stubs[i].second.getPointer();
11381139 OutStreamer.EmitSymbolAttribute(MCSym, MCSA_IndirectSymbol);
11391140
11401141 if (MCSym->isUndefined())
11581159 // L_foo$stub:
11591160 OutStreamer.EmitLabel(Stubs[i].first);
11601161 // .long _foo
1161 OutStreamer.EmitValue(MCSymbolRefExpr::Create(Stubs[i].second,
1162 OutContext),
1162 OutStreamer.EmitValue(MCSymbolRefExpr::
1163 Create(Stubs[i].second.getPointer(),
1164 OutContext),
11631165 4/*size*/, 0/*addrspace*/);
11641166 }
11651167
197197 if (GV->isDeclaration() || GV->isWeakForLinker()) {
198198 // Dynamically-resolved functions need a stub for the function.
199199 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
200 MCSymbol *&StubSym =
200 MachineModuleInfoImpl::StubValueTy &StubSym =
201201 MMI->getObjFileInfo().getFnStubEntry(Sym);
202 if (StubSym == 0)
203 StubSym = GetGlobalValueSymbol(GV);
202 if (StubSym.getPointer() == 0)
203 StubSym = MachineModuleInfoImpl::
204 StubValueTy(GetGlobalValueSymbol(GV),!GV->hasInternalLinkage());
204205 O << *Sym;
205206 return;
206207 }
211212 TempNameStr += StringRef("$stub");
212213
213214 MCSymbol *Sym = GetExternalSymbolSymbol(TempNameStr.str());
214 MCSymbol *&StubSym =
215 MachineModuleInfoImpl::StubValueTy &StubSym =
215216 MMI->getObjFileInfo().getFnStubEntry(Sym);
216 if (StubSym == 0)
217 StubSym = GetExternalSymbolSymbol(MO.getSymbolName());
217 if (StubSym.getPointer() == 0)
218 StubSym = MachineModuleInfoImpl::
219 StubValueTy(GetExternalSymbolSymbol(MO.getSymbolName()), true);
218220 O << *Sym;
219221 return;
220222 }
403405 MCSymbol *NLPSym =
404406 OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
405407 MO.getSymbolName()+"$non_lazy_ptr");
406 MCSymbol *&StubSym =
408 MachineModuleInfoImpl::StubValueTy &StubSym =
407409 MMI->getObjFileInfo().getGVStubEntry(NLPSym);
408 if (StubSym == 0)
409 StubSym = GetExternalSymbolSymbol(MO.getSymbolName());
410 if (StubSym.getPointer() == 0)
411 StubSym = MachineModuleInfoImpl::
412 StubValueTy(GetExternalSymbolSymbol(MO.getSymbolName()), true);
410413
411414 O << *NLPSym;
412415 return;
421424 (GV->isDeclaration() || GV->isWeakForLinker())) {
422425 if (!GV->hasHiddenVisibility()) {
423426 SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
424 MCSymbol *&StubSym =
425 MMI->getObjFileInfo().getGVStubEntry(SymToPrint);
426 if (StubSym == 0)
427 StubSym = GetGlobalValueSymbol(GV);
427 MachineModuleInfoImpl::StubValueTy &StubSym =
428 MMI->getObjFileInfo()
429 .getGVStubEntry(SymToPrint);
430 if (StubSym.getPointer() == 0)
431 StubSym = MachineModuleInfoImpl::
432 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
428433 } else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
429434 GV->hasAvailableExternallyLinkage()) {
430435 SymToPrint = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
431436
432 MCSymbol *&StubSym =
437 MachineModuleInfoImpl::StubValueTy &StubSym =
433438 MMI->getObjFileInfo().
434439 getHiddenGVStubEntry(SymToPrint);
435 if (StubSym == 0)
436 StubSym = GetGlobalValueSymbol(GV);
440 if (StubSym.getPointer() == 0)
441 StubSym = MachineModuleInfoImpl::
442 StubValueTy(GetGlobalValueSymbol(GV),
443 !GV->hasInternalLinkage());
437444 } else {
438445 SymToPrint = GetGlobalValueSymbol(GV);
439446 }
703710 EmitAlignment(4);
704711
705712 const MCSymbol *Stub = Stubs[i].first;
706 const MCSymbol *RawSym = Stubs[i].second;
713 const MCSymbol *RawSym = Stubs[i].second.getPointer();
707714 const MCSymbol *LazyPtr = GetLazyPtr(Stub, OutContext);
708715 const MCSymbol *AnonSymbol = GetAnonSym(Stub, OutContext);
709716
737744 16, SectionKind::getText());
738745 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
739746 const MCSymbol *Stub = Stubs[i].first;
740 const MCSymbol *RawSym = Stubs[i].second;
747 const MCSymbol *RawSym = Stubs[i].second.getPointer();
741748 const MCSymbol *LazyPtr = GetLazyPtr(Stub, OutContext);
742749
743750 OutStreamer.SwitchSection(StubSection);
780787 E = Personalities.end(); I != E; ++I) {
781788 if (*I) {
782789 MCSymbol *NLPSym = GetSymbolWithGlobalValueBase(*I, "$non_lazy_ptr");
783 MCSymbol *&StubSym = MMIMacho.getGVStubEntry(NLPSym);
784 StubSym = GetGlobalValueSymbol(*I);
790 MachineModuleInfoImpl::StubValueTy &StubSym =
791 MMIMacho.getGVStubEntry(NLPSym);
792 StubSym = MachineModuleInfoImpl::
793 StubValueTy(GetGlobalValueSymbol(*I), true);
785794 }
786795 }
787796 }
797806
798807 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
799808 O << *Stubs[i].first << ":\n";
800 O << "\t.indirect_symbol " << *Stubs[i].second << '\n';
809 O << "\t.indirect_symbol " << *Stubs[i].second.getPointer() << '\n';
810 // FIXME: This should use the "GV is external" bit.
801811 O << (isPPC64 ? "\t.quad\t0\n" : "\t.long\t0\n");
802812 }
803813 }
809819
810820 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
811821 O << *Stubs[i].first << ":\n";
812 O << (isPPC64 ? "\t.quad\t" : "\t.long\t") << *Stubs[i].second << '\n';
822 O << (isPPC64 ? "\t.quad\t" : "\t.long\t")
823 << *Stubs[i].second.getPointer() << '\n';
813824 }
814825 }
815826
132132 if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
133133 MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE) {
134134 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
135
136 MCSymbol *&StubSym =
135 MachineModuleInfoImpl::StubValueTy &StubSym =
137136 MMI->getObjFileInfo().getGVStubEntry(Sym);
138 if (StubSym == 0)
139 StubSym = GetGlobalValueSymbol(GV);
140
137 if (StubSym.getPointer() == 0)
138 StubSym = MachineModuleInfoImpl::
139 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
141140 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
142141 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
143 MCSymbol *&StubSym =
142 MachineModuleInfoImpl::StubValueTy &StubSym =
144143 MMI->getObjFileInfo().getHiddenGVStubEntry(Sym);
145 if (StubSym == 0)
146 StubSym = GetGlobalValueSymbol(GV);
144 if (StubSym.getPointer() == 0)
145 StubSym = MachineModuleInfoImpl::
146 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
147147 } else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
148148 MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$stub");
149 MCSymbol *&StubSym =
149 MachineModuleInfoImpl::StubValueTy &StubSym =
150150 MMI->getObjFileInfo().getFnStubEntry(Sym);
151 if (StubSym == 0)
152 StubSym = GetGlobalValueSymbol(GV);
151 if (StubSym.getPointer() == 0)
152 StubSym = MachineModuleInfoImpl::
153 StubValueTy(GetGlobalValueSymbol(GV), !GV->hasInternalLinkage());
153154 }
154155
155156 // If the name begins with a dollar-sign, enclose it in parens. We do this
169170 TempNameStr += StringRef("$stub");
170171
171172 MCSymbol *Sym = GetExternalSymbolSymbol(TempNameStr.str());
172 MCSymbol *&StubSym =
173 MachineModuleInfoImpl::StubValueTy &StubSym =
173174 MMI->getObjFileInfo().getFnStubEntry(Sym);
174 if (StubSym == 0) {
175 if (StubSym.getPointer() == 0) {
175176 TempNameStr.erase(TempNameStr.end()-5, TempNameStr.end());
176 StubSym = OutContext.GetOrCreateSymbol(TempNameStr.str());
177 }
178 SymToPrint = StubSym;
177 StubSym = MachineModuleInfoImpl::
178 StubValueTy(OutContext.GetOrCreateSymbol(TempNameStr.str()),
179 true);
180 }
181 SymToPrint = StubSym.getPointer();
179182 } else {
180183 SymToPrint = GetExternalSymbolSymbol(MO.getSymbolName());
181184 }
506509 // L_foo$stub:
507510 OutStreamer.EmitLabel(Stubs[i].first);
508511 // .indirect_symbol _foo
509 OutStreamer.EmitSymbolAttribute(Stubs[i].second, MCSA_IndirectSymbol);
512 OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
513 MCSA_IndirectSymbol);
510514 // hlt; hlt; hlt; hlt; hlt hlt = 0xf4 = -12.
511515 const char HltInsts[] = { -12, -12, -12, -12, -12 };
512516 OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/);
529533 // L_foo$non_lazy_ptr:
530534 OutStreamer.EmitLabel(Stubs[i].first);
531535 // .indirect_symbol _foo
532 OutStreamer.EmitSymbolAttribute(Stubs[i].second, MCSA_IndirectSymbol);
536 OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
537 MCSA_IndirectSymbol);
533538 // .long 0
534539 OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
535540 }
546551 // L_foo$non_lazy_ptr:
547552 OutStreamer.EmitLabel(Stubs[i].first);
548553 // .long _foo
549 OutStreamer.EmitValue(MCSymbolRefExpr::Create(Stubs[i].second,
550 OutContext),
554 OutStreamer.EmitValue(MCSymbolRefExpr::
555 Create(Stubs[i].second.getPointer(),
556 OutContext),
551557 4/*size*/, 0/*addrspace*/);
552558 }
553559 Stubs.clear();
623629 O << *Stubs[i].first << ":\n"
624630 << (TD->getPointerSize() == 8 ?
625631 MAI->getData64bitsDirective() : MAI->getData32bitsDirective())
626 << *Stubs[i].second << '\n';
632 << *Stubs[i].second.getPointer() << '\n';
627633
628634 Stubs.clear();
629635 }
9090 Name += "$non_lazy_ptr";
9191 MCSymbol *Sym = Ctx.GetOrCreateTemporarySymbol(Name.str());
9292
93 MCSymbol *&StubSym = getMachOMMI().getGVStubEntry(Sym);
94 if (StubSym == 0) {
93 MachineModuleInfoImpl::StubValueTy &StubSym =
94 getMachOMMI().getGVStubEntry(Sym);
95 if (StubSym.getPointer() == 0) {
9596 assert(MO.isGlobal() && "Extern symbol not handled yet");
96 StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal());
97 StubSym =
98 MachineModuleInfoImpl::
99 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
100 !MO.getGlobal()->hasInternalLinkage());
97101 }
98102 return Sym;
99103 }
100104 case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: {
101105 Name += "$non_lazy_ptr";
102106 MCSymbol *Sym = Ctx.GetOrCreateTemporarySymbol(Name.str());
103 MCSymbol *&StubSym = getMachOMMI().getHiddenGVStubEntry(Sym);
104 if (StubSym == 0) {
107 MachineModuleInfoImpl::StubValueTy &StubSym =
108 getMachOMMI().getHiddenGVStubEntry(Sym);
109 if (StubSym.getPointer() == 0) {
105110 assert(MO.isGlobal() && "Extern symbol not handled yet");
106 StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal());
111 StubSym =
112 MachineModuleInfoImpl::
113 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
114 !MO.getGlobal()->hasInternalLinkage());
107115 }
108116 return Sym;
109117 }
110118 case X86II::MO_DARWIN_STUB: {
111119 Name += "$stub";
112120 MCSymbol *Sym = Ctx.GetOrCreateTemporarySymbol(Name.str());
113 MCSymbol *&StubSym = getMachOMMI().getFnStubEntry(Sym);
114 if (StubSym)
121 MachineModuleInfoImpl::StubValueTy &StubSym =
122 getMachOMMI().getFnStubEntry(Sym);
123 if (StubSym.getPointer())
115124 return Sym;
116125
117126 if (MO.isGlobal()) {
118 StubSym = AsmPrinter.GetGlobalValueSymbol(MO.getGlobal());
127 StubSym =
128 MachineModuleInfoImpl::
129 StubValueTy(AsmPrinter.GetGlobalValueSymbol(MO.getGlobal()),
130 !MO.getGlobal()->hasInternalLinkage());
119131 } else {
120132 Name.erase(Name.end()-5, Name.end());
121 StubSym = Ctx.GetOrCreateTemporarySymbol(Name.str());
133 StubSym =
134 MachineModuleInfoImpl::
135 StubValueTy(Ctx.GetOrCreateTemporarySymbol(Name.str()), false);
122136 }
123137 return Sym;
124138 }