[PATCH] D16201: [ELF/AArch64] - Implemented set of R_AARCH64_TLSDESC_* relocations.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 01:37:50 PST 2016


grimar added a comment.

In http://reviews.llvm.org/D16201#371640, @ruiu wrote:

> Do you know the number of performance gains you can get with this optimization? I'm a bit worried about the complexity of the peephole optimizations we have in the linker as it is probably the most hard-to-read part. Also, as I wrote before, it hard to identify what we have to do and what are optional optimizations (so you can skip that code when reading) by just reading code.


Probably there is some misunderstanding here. That is not an optimization. I think we actually have no choice about implementing them, It is just the set of relocations that are used on aarch64 for tls. This relocations can be optimized, and that is optional path I believe, that was implemented separatelly (http://reviews.llvm.org/D17980). This patch just implements the basic not optimized way.

Consider the code from my comments above. When we compile it using clang without any additional options it creates such relocations. 
test.c

  __thread int foo;
  int method() {
    foo = 0;
  }

clang -target aarch64-linux-gnu -fPIC -c test.c -o test.o
aarch64-linux-gnu-readelf -r test.o

  Relocation section '.rela.text' at offset 0x160 contains 4 entries:
    Offset          Info           Type           Sym. Value    Sym. Name + Addend
  00000000000c  000600000232 R_AARCH64_TLSDESC 0000000000000000 foo + 0
  000000000010  000600000233 R_AARCH64_TLSDESC 0000000000000000 foo + 0
  000000000014  000600000234 R_AARCH64_TLSDESC 0000000000000000 foo + 0
  000000000018  000600000239 R_AARCH64_TLSDESC 0000000000000000 foo + 0

They requires .got entry, .got.plt and so on but that is not the optimization and just the way how TLSDECS implementation actually works.


================
Comment at: test/ELF/aarch64-tls-desc.s:6
@@ +5,3 @@
+# REQUIRES: aarch64
+
+#READOBJ:      Section {
----------------
I`ll move REQUIRES to be the first.

================
Comment at: test/ELF/aarch64-tls-desc.s:129
@@ +128,3 @@
+#CHECK-NEXT:  107c: {{.*}} nop
+
+.text
----------------
I will also add the space after # to be consistent in this test case.


http://reviews.llvm.org/D16201





More information about the llvm-commits mailing list