@@ -171,11 +171,6 @@ class PPCAsmPrinter : public AsmPrinter {
171
171
TOCType_EHBlock
172
172
};
173
173
174
- // Controls whether or not to emit a .ref reference to __tls_get_addr.
175
- // This is currently used for TLS models that do not generate calls to
176
- // TLS functions, such as for the local-exec model on AIX 64-bit.
177
- bool HasRefGetTLSAddr = false ;
178
-
179
174
MCSymbol *lookUpOrCreateTOCEntry (const MCSymbol *Sym, TOCEntryType Type,
180
175
MCSymbolRefExpr::VariantKind Kind =
181
176
MCSymbolRefExpr::VariantKind::VK_None);
@@ -620,17 +615,12 @@ void PPCAsmPrinter::LowerPATCHPOINT(StackMaps &SM, const MachineInstr &MI) {
620
615
// / This helper function creates the TlsGetAddr MCSymbol for AIX. We will
621
616
// / create the csect and use the qual-name symbol instead of creating just the
622
617
// / external symbol.
623
- static MCSymbol *
624
- createMCSymbolForTlsGetAddr (MCContext &Ctx, unsigned MIOpc,
625
- XCOFF::StorageMappingClass SMC = XCOFF::XMC_PR) {
626
- StringRef SymName;
627
- if (MIOpc == PPC::GETtlsTpointer32AIX)
628
- SymName = " .__get_tpointer" ;
629
- else
630
- SymName = (SMC == XCOFF::XMC_DS) ? " __tls_get_addr" : " .__tls_get_addr" ;
618
+ static MCSymbol *createMCSymbolForTlsGetAddr (MCContext &Ctx, unsigned MIOpc) {
619
+ StringRef SymName =
620
+ MIOpc == PPC::GETtlsTpointer32AIX ? " .__get_tpointer" : " .__tls_get_addr" ;
631
621
return Ctx
632
622
.getXCOFFSection (SymName, SectionKind::getText (),
633
- XCOFF::CsectProperties (SMC , XCOFF::XTY_ER))
623
+ XCOFF::CsectProperties (XCOFF::XMC_PR , XCOFF::XTY_ER))
634
624
->getQualNameSymbol ();
635
625
}
636
626
@@ -842,11 +832,8 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
842
832
if (MO.getTargetFlags () & PPCII::MO_TPREL_FLAG) {
843
833
assert (MO.isGlobal () && " Only expecting a global MachineOperand here!\n " );
844
834
TLSModel::Model Model = TM.getTLSModel (MO.getGlobal ());
845
- if (Model == TLSModel::LocalExec) {
846
- if (IsPPC64)
847
- HasRefGetTLSAddr = true ;
835
+ if (Model == TLSModel::LocalExec)
848
836
return MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSLE;
849
- }
850
837
if (Model == TLSModel::InitialExec)
851
838
return MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSIE;
852
839
llvm_unreachable (" Only expecting local-exec or initial-exec accesses!" );
@@ -2875,22 +2862,6 @@ bool PPCAIXAsmPrinter::doFinalization(Module &M) {
2875
2862
OutStreamer->doFinalizationAtSectionEnd (
2876
2863
OutStreamer->getContext ().getObjectFileInfo ()->getTextSection ());
2877
2864
2878
- // Add a single .ref reference to __tls_get_addr[DS] for the local-exec TLS
2879
- // model on AIX 64-bit. For TLS models that do not generate calls to TLS
2880
- // functions, this reference to __tls_get_addr helps generate a linker error
2881
- // to an undefined symbol to __tls_get_addr, which indicates to the user that
2882
- // compiling with -pthread is required for programs that use TLS variables.
2883
- if (HasRefGetTLSAddr) {
2884
- // Specifically for 64-bit AIX, a load from the TOC is generated to load
2885
- // the variable offset needed for local-exec accesses.
2886
- MCSymbol *TlsGetAddrDescriptor =
2887
- createMCSymbolForTlsGetAddr (OutContext, PPC::GETtlsADDR64AIX,
2888
- XCOFF::XMC_DS);
2889
-
2890
- ExtSymSDNodeSymbols.insert (TlsGetAddrDescriptor);
2891
- OutStreamer->emitXCOFFRefDirective (TlsGetAddrDescriptor);
2892
- }
2893
-
2894
2865
for (MCSymbol *Sym : ExtSymSDNodeSymbols)
2895
2866
OutStreamer->emitSymbolAttribute (Sym, MCSA_Extern);
2896
2867
return PPCAsmPrinter::doFinalization (M);
0 commit comments