[clang] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)

Amy Kwan via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 22:05:21 PDT 2023


================
@@ -846,6 +872,17 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
       return MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGDM;
     if (MO.getTargetFlags() & PPCII::MO_TLSGD_FLAG)
       return MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGD;
+    if (MO.getTargetFlags() & PPCII::MO_TLSLD_FLAG) {
+      if (isSpecialAIXSymbolTLSML(MO, IsAIX))
+        // FIXME: Due to the size limit of MachineOperand::SubReg_TargetFlags,
+        // hacked this flag which should have been named MO_TLSLDM_FLAG: on AIX
+        // the ML relocation type is only valid for a reference to a TOC symbol
+        // from the symbol itself, and right now its only user is the symbol
+        // "_$TLSML". Use symbol name to decide that R_TLSML is expected.
----------------
amy-kwan wrote:

```suggestion
        // "_$TLSML". The symbol name is used to decide that R_TLSML is expected.
```

https://github.com/llvm/llvm-project/pull/66316


More information about the cfe-commits mailing list