[PATCH] D82315: [PowerPC][PCRelative] Thread Local Storage Support for General Dynamic

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 14:45:16 PDT 2020


stefanp accepted this revision as: stefanp.
stefanp added a comment.
This revision is now accepted and ready to land.

I think the tests can be cleaned up a little but otherwise this LGTM.



================
Comment at: llvm/test/MC/PowerPC/pcrel-tls-general-dynamic-address-load-reloc.s:40
+	.section	".note.GNU-stack","", at progbits
+	.addrsig
----------------
This is something I've learned relatively recently but you can get rid of a lot of the "extras" that compiling from C code produces. For example you can reduce most of that assembly to:
```
GeneralDynamicAddrLoad:
	mflr 0
	std 0, 16(1)
	stdu 1, -32(1)
	paddi 3, 0, x at got@tlsgd at pcrel, 1
	bl __tls_get_addr at notoc(x at tlsgd)
	addi 1, 1, 32
	ld 0, 16(1)
	mtlr 0
	blr
```
And if you want to just look at the TLS relocation (which is what you are testing) you can even remove the stack setup and teardown and have the whole test be just:
```
# READOBJ:        0x0 R_PPC64_GOT_TLSGD_PCREL34 x 0x0
# READOBJ-NEXT:   0x8 R_PPC64_TLSGD x 0x0
# READOBJ-NEXT:   0x8 R_PPC64_REL24_NOTOC __tls_get_addr 0x0

GeneralDynamicAddrLoad:
	paddi 3, 0, x at got@tlsgd at pcrel, 1
	bl __tls_get_addr at notoc(x at tlsgd)
	blr
```



================
Comment at: llvm/test/MC/PowerPC/pcrel-tls-general-dynamic-value-load-reloc.s:24
+.Lfunc_begin0:
+# %bb.0:                                # %entry
+	mflr 0
----------------
Same thing for this test. You can remove a lot of the extra lines and just keep what you are testing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82315/new/

https://reviews.llvm.org/D82315





More information about the llvm-commits mailing list