From bed1094157b2c146fc4e5f6470bf30c854df958e Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Wed, 24 Jul 2019 22:29:44 -0500 Subject: [PATCH] Completed first draft of TLS ABI changes for PC-relative. Under review. --- specification/ch_3.xml | 402 ++++++----------------------------------- 1 file changed, 60 insertions(+), 342 deletions(-) diff --git a/specification/ch_3.xml b/specification/ch_3.xml index 78cc0b8..e918990 100644 --- a/specification/ch_3.xml +++ b/specification/ch_3.xml @@ -5810,7 +5810,7 @@ extern void *__tls_get_addr (tls_index *ti); - bl __tls_get_addr(x@tlsgd) + bl __tls_get_addr@notoc(x@tlsgd) R_PPC64_TLSGD @@ -6125,7 +6125,7 @@ static __thread unsigned int x3; - bl __tls_get_addr(x1@tlsld) + bl __tls_get_addr@notoc(x1@tlsld) R_PPC64_TLSLD @@ -8319,21 +8319,10 @@ nop - addis r3, r2, x@got@tlsgd@ha - - - R_PPC64_GOT_TLSGD16_HA - - - x - - - - - addi r3, r3, x@got@tlsgd@l + pla r3, x@got@tlsgd@pcrel - R_PPC64_GOT_TLSGD16_LO + R_PPC64_GOT_TLSGD34 x @@ -8341,7 +8330,7 @@ nop - bl __tls_get_addr(x@tlsgd) + bl __tls_get_addr@notoc(x@tlsgd) R_PPC64_TLSGD @@ -8352,23 +8341,12 @@ nop - R_PPC64_REL24 + R_PPC64_REL24_NOTOC __tls_get_addr - - - nop - - - - - - - - @@ -8457,37 +8435,15 @@ nop - addis r3, r2, x@got@tprel@ha - - - R_PPC64_GOT_TPREL16_HA + pld r3, x@got@tprel@pcrel - x - - - - - ld r3, x@got@tprel@l(r3) - - - R_PPC64_GOT_TPREL16_LO_DS + R_PPC64_GOT_TPREL34 x - - - nop - - - - - - - - add r3, r3, r13 @@ -8576,21 +8532,10 @@ nop - addis r3, r2, x@got@tlsgd@ha - - - R_PPC64_GOT_TLSGD16_HA - - - x - - - - - addi r3, r3, x@got@tlsgd@l + pla r3, x@got@tlsgd@pcrel - R_PPC64_GOT_TLSGD16_LO + R_PPC64_GOT_TLSGD34 x @@ -8598,7 +8543,7 @@ nop - bl __tls_get_addr(x@tlsgd) + bl __tls_get_addr@notoc(x@tlsgd) R_PPC64_TLSGD @@ -8609,23 +8554,12 @@ nop - R_PPC64_REL24 + R_PPC64_REL24_NOTOC __tls_get_addr - - - nop - - - - - - - - @@ -8683,18 +8617,9 @@ nop The preceding code and global offset table entries are replaced by the following code, which makes no reference to GOT entries. The GOT - entries in - can be removed from the GOT by - the linker when performing this code transformation. - To further optimize the code in - , a linker may reschedule the - sequence to exploit fusion by generating a sequence that may be fused - by Power processors: - nop -addis r3, r13, x@tprel@ha -addi r3, r3, x@tprel@l -nop - + entries in can be + removed from the GOT by the linker when performing this code + transformation. General-Dynamic-to-Local-Exec Replacement Initial Relocations (PC-Relative) @@ -8724,21 +8649,10 @@ nop - nop - - - - - - - - - - - addis r3, r13, x@tprel@ha + paddi r3, r13, x@tprel - R_PPC64_TPREL16_HA + R_PPC64_TPREL34 x @@ -8755,17 +8669,6 @@ nop - - - addi r3, r3, x@tprel@l - - - R_PPC64_TPREL16_LO - - - x - -
@@ -8804,21 +8707,10 @@ nop - addis r3, r2, x1@got@tlsld@ha - - - R_PPC64_GOT_TLSLD16_HA - - - x1 - - - - - addi r3, r3, x1@got@tlsld@l + pla r3, x1@got@tlsld@pcrel - R_PPC64_GOT_TLSLD16_LO + R_PPC64_GOT_TLSLD34 x1 @@ -8826,7 +8718,7 @@ nop - bl __tls_get_addr(x1@tlsld) + bl __tls_get_addr@notoc(x1@tlsld) R_PPC64_TLSLD @@ -8840,45 +8732,12 @@ nop - R_PPC64_REL24 + R_PPC64_REL24_NOTOC __tls_get_addr - - - nop - - - - - - - - - - - ... - - - - - - - - - - - addi r9, r3, x1@dtprel - - - R_PPC64_DTPREL16 - - - x1 - - ... @@ -8892,21 +8751,10 @@ nop - addis r9, r3, x2@dtprel@ha - - - R_PPC64_DTPREL16_HA - - - x2 - - - - - addi r9, r9, x2@dtprel@l + paddi r9, r3, x2@dtprel - R_PPC64_DTPREL16_LO + R_PPC64_DTPREL34 x2 @@ -8925,21 +8773,10 @@ nop - addis r9, r2, x3@got@dtprel@ha - - - R_PPC64_GOT_DTPREL16_HA - - - x3 - - - - - ld r9, x3@got@dtprel@l(r9) + pld r9, x3@got@dtprel@pcrel - R_PPC64_GOT_DTPREL16_LO_DS + R_PPC64_GOT_DTPREL34 x3 @@ -9064,24 +8901,13 @@ nop - nop + paddi r3, r13, 0x1000 - + - - - - - - addis r3, r13, L@tprel@ha - - - R_PPC64_TPREL16_HA - - - link editor generated local symbol + @@ -9095,21 +8921,6 @@ nop - - - addi r3, r3, L@tprel@l - - - R_PPC64_TPREL16_LO - - - link editor generated local symbol - The linker may prefer to schedule the addis and addi - to be adjacent to take advantage of fusion as a - microarchitecture optimization opportunity. - - - .. @@ -9123,43 +8934,10 @@ nop - addi r9, r3, x1@dtprel - - - R_PPC64_DTPREL16 - - - x1 - - - - - .. - - - - - - - - - - - addis r9, r3, x2@dtprel@ha - - - R_PPC64_DTPREL16_HA - - - x2 - - - - - addi r9, r9, x2@dtprel@l + paddi r9, r3, x2@dtprel - R_PPC64_DTPREL16_LO + R_PPC64_DTPREL34 x2 @@ -9167,7 +8945,7 @@ nop - ... + .. @@ -9178,21 +8956,10 @@ nop - addis r9, r2, x3@got@dtprel@ha - - - R_PPC64_GOT_DTPREL16_HA - - - x3 - - - - - ld r9, x3@got@dtprel@l(r9) + pld r9, x3@got@dtprel@pcrel - R_PPC64_GOT_DTPREL16_LO_DS + R_PPC64_GOT_DTPREL34 x3 @@ -9214,7 +8981,7 @@ nop The GOT[n] and GOT[n+1] entries can be removed by the linker after the code transformation as shown in - . + . Local-Dynamic-to-Local-Exec Replacement GOT Entry Relocations (PC-Relative) @@ -9256,14 +9023,9 @@ nop
- The local symbol generated by the link editor points to the start - of the thread storage block plus 0x7000 bytes. In practice, a section - symbol with a suitable offset will be used.
Initial Exec to Local Exec (PC-Relative) - This transformation is only performed by the linker when the symbol - is within 2 GB + 28 KB of the thread pointer. Initial-Exec-to-Local-Exec Initial Relocations @@ -9292,21 +9054,10 @@ nop - addis r9, r2, x@got@tprel@ha - - - R_PPC64_GOT_TPREL16_HA - - - x - - - - - ld r9, x@got@tprel@l(r9) + pld r9, x@got@tprel@pcrel - R_PPC64_GOT_TPREL16_LO_DS + R_PPC64_GOT_TPREL34 x @@ -9314,10 +9065,10 @@ nop - add r9, r9, x@tls + add r9, r9, x@tls@pcrel - R_PPC64_TLS + R_PPC64_TLS with one-byte displacement x @@ -9368,7 +9119,8 @@ nop
The preceding code and global offset table entries are replaced by - the following code and global offset table entries. + the following code. The global offset entry GOT[n] can be + eliminated by the linker. Initial-Exec-to-Local-Exec Replacement Initial Relocations (PC-Relative) @@ -9390,21 +9142,10 @@ nop - nop - - - + paddi r9, r9, x@tprel@l - - - - - - addis r9, r13, x@tprel@ha - - - R_PPC64_TPREL16_HA + R_PPC64_TPREL34 x @@ -9412,22 +9153,20 @@ nop - addi r9, r9, x@tprel@l + nop - R_PPC64_TPREL16_LO + - x +
- Other sizes and types of thread-local variables may use any of the - X-form indexed load or store instructions. - shows how to access the + shows how to access the contents of a variable using the X-form indexed load and store instructions. @@ -9459,21 +9198,10 @@ nop - addis r9, r2, x@got@tprel@ha - - - R_PPC64_GOT_TPREL16_HA - - - x - - - - - ld r9, x@got@tprel@l(r9) + pld r9, x@got@tprel@pcrel - R_PPC64_GOT_TPREL16_LO_DS + R_PPC64_GOT_TPREL34 x @@ -9481,7 +9209,7 @@ nop - lbzx r10, r9, x@tls + lbzx r10, r9, x@tls@pcrel R_PPC64_TLS @@ -9503,7 +9231,7 @@ nop - stbx r10, r9, x@tls + stbx r10, r9, x@tls@pcrel R_PPC64_TLS @@ -9557,7 +9285,8 @@ nop
The preceding code and global offset table entries are replaced by - the following code and global offset table entries. + the following code. The global offset table entry GOT[n] can be + removed by the linker. Initial-Exec-to-Local-Exec X-form Replacement Initial Relocations (PC-Relative) @@ -9587,21 +9316,10 @@ nop - nop - - - - - - + paddi r9, r13, x@tprel - - - addis r9, r13, x@tprel@ha - - - R_PPC64_TPREL16_HA + R_PPC64_TPREL34 x @@ -9609,13 +9327,13 @@ nop - lbz r10, x@tprel@l(r9) + lbz r10, 0(r9) - R_PPC64_TPREL16_LO + - x + @@ -9631,13 +9349,13 @@ nop - stb r10, x@tprel@l(r9) + stb r10, 0(r9) - R_PPC64_TPREL16_LO + - x +