[PATCH] D85994: [LLD][PowerPC] Add check in LLD to produce an error for missing TLSGD/TLSLD

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 04:00:15 PDT 2020


stefanp updated this revision to Diff 286241.
stefanp added a comment.

I've merged a couple of the tests using `yaml2obj -D`. I would prefer not to merge the tests any further because the actual code in the `.text` section is different between TLSGD and TLSLD.

I am unable to use the assembly files. The problem is that `__tls_get_addr` is a special name for the PPC backend and we cannot generate an object file from incorrect assembly. For example:

  $ cat GeneralDynamic.s
  	.text
  GeneralDynamic:                         # @GeneralDynamic
  	addis 3, 2, x at got@tlsgd at ha
  	addi 3, 3, x at got@tlsgd at l
  	bl __tls_get_addr()
  	blr

Produces:

  $ llvm-mc GeneralDynamic.s --filetype=obj -o /dev/null
  GeneralDynamic.s:5:20: error: unknown token in expression
          bl __tls_get_addr()
                            ^
  GeneralDynamic.s:5:20: error: invalid TLS call expression
          bl __tls_get_addr()
                            ^

I am also a little confused about the `i - 2` overflow because I think I already check that `i - 1` is not the start of the array.

I believe I have addressed the other two comments that you had.


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

https://reviews.llvm.org/D85994

Files:
  lld/ELF/Relocations.cpp
  lld/test/ELF/ppc64-error-missing-tlsgdld.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85994.286241.patch
Type: text/x-patch
Size: 9545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200818/cc7fbf85/attachment.bin>


More information about the llvm-commits mailing list