[PATCH] D157673: [PowerPC] Support local-dynamic TLS relocation on AIX

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 20:17:56 PDT 2023


tingwang created this revision.
tingwang added reviewers: amyk, hubert.reinterpretcast, nemanjai, shchenz, stefanp, lkail, qiucf, Esme, PowerPC.
tingwang added a project: LLVM.
Herald added subscribers: kbarton, hiraditya.
Herald added a project: All.
tingwang requested review of this revision.
Herald added a subscriber: llvm-commits.

To enable TLS local-dynamic on AIX, according to docs, this patch need to generate below sequence of code:

.tc foo[TC],foo[TL]@ld              # Variable offset, ld relocation specifier
.tc mh[TC],mh[TC]@ml             # Module handle for the caller
lwz 3,mh[TC](2)      $$ For 64-bit: ld 3,mh[TC](2)
bla .__tls_get_mod                    # Modifies r0,r3,r4,r5,r11,lr,cr0
#r3 = &TLS for module
lwz 4,foo[TC](2)     $$ For 64-bit: ld 4,foo[TC](2)
add 5,3,4                                   # Compute &foo
.rename mh[TC], "_$TLSML"   # Symbol for the module handle must have the name "_$TLSML"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157673

Files:
  llvm/include/llvm/MC/MCExpr.h
  llvm/lib/MC/MCExpr.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/lib/Target/PowerPC/PPCInstr64Bit.td
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
  llvm/test/CodeGen/PowerPC/aix-tls-gd-double.ll
  llvm/test/CodeGen/PowerPC/aix-tls-gd-int.ll
  llvm/test/CodeGen/PowerPC/aix-tls-gd-longlong.ll
  llvm/test/CodeGen/PowerPC/aix-tls-local-dynamic.ll
  llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll
  llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157673.549230.patch
Type: text/x-patch
Size: 130667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230811/6c744152/attachment-0001.bin>


More information about the llvm-commits mailing list