This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] x86-64 TLS support
- From: Andreas Jaeger <aj at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 27 Sep 2002 08:51:12 +0200
- Subject: Re: [PATCH] x86-64 TLS support
- References: <20020926182620.M2194@sunsite.ms.mff.cuni.cz>
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> The following patch adds x86-64 TLS support. I also moved run_ld_link_tests
> (the version with 6 fields) to lib/ld-lib.exp, so that it can be shared and
> adjusted sh64.exp (added the 6th fields into the array).
> Ok to commit?
The x86-64 part is ok to commit but I cannot approve the generic
parts.
> Andreas, if you have time, could you double check the testcases that
> they really do what will be in tls.pdf. I went once over all the
> instructions (and caught some bugs on it), but more eyes see
> more definitely.
I added a few small questions below but I didn't caught anything real
I guess.
thanks for the excellent work!
Andreas
> [...]
> --- ld/testsuite/ld-x86-64/tlspic1.s.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic1.s 2002-09-26 16:11:31.000000000 +0200
> @@ -0,0 +1,171 @@
> + /* Force .data aligned to 4K, so .got very likely gets at 0x102190
> + (0x60 bytes .tdata and 0x130 bytes .dynamic) */
> + .data
> + .balign 4096
> + .section ".tdata", "awT", @progbits
> + .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
> + .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
> + .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
> +sg1: .long 17
> +sg2: .long 18
> +sg3: .long 19
> +sg4: .long 20
> +sg5: .long 21
> +sg6: .long 22
> +sg7: .long 23
> +sg8: .long 24
> +sl1: .long 65
> +sl2: .long 66
> +sl3: .long 67
> +sl4: .long 68
> +sl5: .long 69
> +sl6: .long 70
> +sl7: .long 71
> +sl8: .long 72
> +sh1: .long 257
> +sh2: .long 258
> +sh3: .long 259
> +sh4: .long 260
> +sh5: .long 261
> +sh6: .long 262
> +sh7: .long 263
> +sh8: .long 264
> + /* Force .text aligned to 4K, so it very likely gets at 0x1000. */
> + .text
> + .balign 4096
> + .globl fn1
> + .type fn1,@function
> +fn1:
> + pushq %rbp
> + movq %rsp, %rbp
> + nop;nop;nop;nop
> +
> + /* GD */
> + .long 0x66666666
> + leaq sg1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
One quick question: These nops are just fillers to separate the
entries and not part of the GD - correct? A nop with 4 bytes can be
written in a better way performancewise.
> +
> + /* GD -> IE because variable is referenced through IE too */
> + .long 0x66666666
> + leaq sg2@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD against local variable */
> + .long 0x66666666
> + leaq sl1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> IE against local variable referenced through IE too */
> + .long 0x66666666
> + leaq sl2@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD against hidden and local variable */
> + .long 0x66666666
> + leaq sh1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> IE against hidden and local variable referenced through
> + IE too */
> + .long 0x66666666
> + leaq sh2@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD against hidden but not local variable */
> + .long 0x66666666
> + leaq sH1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> IE against hidden but not local variable referenced through
> + IE too */
> + .long 0x66666666
> + leaq sH2@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* LD */
> + leaq sl1@tlsld(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop
> + leaq sl1@dtpoff(%rax), %rdx
> + nop;nop
> + leaq 2+sl2@dtpoff(%rax), %r9
> + nop;nop;nop;nop
> +
> + /* LD against hidden and local variables */
> + leaq sh1@tlsld(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop
> + leaq sh1@dtpoff(%rax), %rdx
> + nop;nop
> + leaq sh2@dtpoff+3(%rax), %rcx
> + nop;nop;nop;nop
> +
> + /* LD against hidden but not local variables */
> + leaq sH1@tlsld(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop
> + leaq sH1@dtpoff(%rax), %r12
> + nop;nop
> + leaq sH2@dtpoff+1(%rax), %rcx
> + nop;nop
> +
> + /* IE against global var */
> + movq %fs:0, %rcx
> + nop;nop
> + addq sg2@gottpoff(%rip), %rcx
> + nop;nop;nop;nop
> +
> + /* IE against local var */
> + movq %fs:0, %r14
> + nop;nop
> + addq sl2@gottpoff(%rip), %r14
> + nop;nop;nop;nop
> +
> + /* IE against hidden and local var */
> + movq %fs:0, %rcx
> + nop;nop
> + addq sh2@gottpoff(%rip), %rcx
> + nop;nop;nop;nop
> +
> + /* IE against hidden but not local var */
> + movq %fs:0, %rcx
> + nop;nop
> + addq sH2@gottpoff(%rip), %rcx
> + nop;nop;nop;nop
> +
> + /* Direct access through %fs */
> +
> + /* IE against global var */
> + movq sg5@gottpoff(%rip), %rcx
> + nop;nop
> + movq %fs:(%rcx), %rdx
> + nop;nop;nop;nop
> +
> + /* IE against local var */
> + movq sl5@gottpoff(%rip), %r10
> + nop;nop
> + movq %fs:(%r10), %r12
> + nop;nop;nop;nop
> +
> + /* IE against hidden and local var */
> + movq sh5@gottpoff(%rip), %rdx
> + nop;nop
> + movq %fs:(%rdx), %rdx
> + nop;nop;nop;nop
> +
> + /* IE against hidden but not local var */
> + movq sH5@gottpoff(%rip), %rcx
> + nop;nop
> + movq %fs:(%rcx), %rdx
> + nop;nop;nop;nop
> +
> + leave
> + ret
> --- ld/testsuite/ld-x86-64/x86-64.exp.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/x86-64.exp 2002-09-26 13:18:22.000000000 +0200
> @@ -0,0 +1,51 @@
> +# Expect script for ld-x86_64 tests
> +# Copyright (C) 2002 Free Software Foundation
> +#
> +# This file is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> +#
> +
> +# Test x86_64 linking; all types of relocs. This tests the assembler and
> +# tools like objdump as well as the linker.
> +
> +if { !([istarget "x86_64-*-elf*"]
> + || [istarget "x86_64-*-linux*"]) } {
> + return
> +}
> +
> +# List contains test-items with 3 items followed by 2 lists:
> +# 0:name 1:ld options 2:assembler options
> +# 3:filenames of assembler files 4: action and options. 5: name of output file
> +
> +# Actions:
> +# objdump: Apply objdump options on result. Compare with regex (last arg).
> +# nm: Apply nm options on result. Compare with regex (last arg).
> +# readelf: Apply readelf options on result. Compare with regex (last arg).
> +
> +set x86_64tests {
> + {"TLS -fpic -shared transitions" "-shared -melf_x86_64"
> + "--64" {tlspic1.s tlspic2.s}
> + {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd}
> + {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
> + "libtlspic.so"}
> + {"Helper shared library" "-shared -melf_x86_64"
> + "--64" {tlslib.s} {} "libtlslib.so"}
> + {"TLS -fpic and -fno-pic exec transitions"
> + "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbinpic.s tlsbin.s}
> + {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
> + {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
> + "tlsbin"}
> +}
> +
> +run_ld_link_tests $x86_64tests
> --- ld/testsuite/ld-x86-64/tlspic2.s.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic2.s 2002-09-25 11:30:19.000000000 +0200
> @@ -0,0 +1,11 @@
> + .section ".tbss", "awT", @nobits
> + .globl sH1, sH2, sH3, sH4, sH5, sH6, sH7, sH8
> + .hidden sH1, sH2, sH3, sH4, sH5, sH6, sH7, sH8
> +sH1: .space 4
> +sH2: .space 4
> +sH3: .space 4
> +sH4: .space 4
> +sH5: .space 4
> +sH6: .space 4
> +sH7: .space 4
> +sH8: .space 4
> --- ld/testsuite/ld-x86-64/tlsbin.s.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlsbin.s 2002-09-26 16:18:32.000000000 +0200
> @@ -0,0 +1,97 @@
> + .section ".tbss", "awT", @nobits
> + .globl bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8
> +bg1: .space 4
> +bg2: .space 4
> +bg3: .space 4
> +bg4: .space 4
> +bg5: .space 4
> +bg6: .space 4
> +bg7: .space 4
> +bg8: .space 4
> +bl1: .space 4
> +bl2: .space 4
> +bl3: .space 4
> +bl4: .space 4
> +bl5: .space 4
> +bl6: .space 4
> +bl7: .space 4
> +bl8: .space 4
> + .text
> + .globl _start
> + .type _start,@function
> +_start:
> + pushq %rbp
> + movq %rsp, %rbp
> +
> + /* IE against global var */
> + movq %fs:0, %r11
> + nop;nop
> + addq sG6@gottpoff(%rip), %r11
> + nop;nop;nop;nop
> +
> + /* IE -> LE against global var defined in exec */
> + movq %fs:0, %rdx
> + nop;nop
> + addq bg6@gottpoff(%rip), %rdx
> + nop;nop;nop;nop
> +
> + /* IE -> LE against local var */
> + movq %fs:0, %r12
> + nop;nop
> + addq bl6@gottpoff(%rip), %r12
> + nop;nop;nop;nop
> +
> + /* direct %fs access IE -> LE against local var */
> + movq bl8@gottpoff(%rip), %rdx
> + nop;nop
> + movq %fs:(%rdx), %rax
> + nop;nop;nop;nop
> +
> + /* IE -> LE against hidden but not local var */
> + movq %fs:0, %rdx
> + nop;nop
> + addq sh6@gottpoff(%rip), %rdx
> + nop;nop;nop;nop
> +
> + /* direct %fs access IE -> LE against hidden but not local var */
> + movq sh8@gottpoff(%rip), %rdx
> + nop;nop
> + movq %fs:(%rdx), %rax
> + nop;nop;nop;nop
> +
> + /* LE, global var defined in exec */
> + movq %fs:0, %rax
> + nop;nop
> + leaq sg2@tpoff(%rax), %rdx
> + nop;nop;nop;nop
> +
> + /* LE, local var, non-canonical sequence */
> + movq $2+bl2@tpoff, %r9
> + nop;nop
> + movq %fs:0, %rdx
> + nop;nop
> + addq %r9, %rdx
> + nop;nop;nop;nop
> +
> + /* LE, hidden var defined in exec, non-canonical sequence */
> + movq %fs:0, %rdx
> + nop;nop
> + addq $sh2@tpoff+1, %rdx
> + nop;nop;nop;nop
> +
> + /* Direct %fs access */
> +
> + /* LE, global var defined in exec */
> + movq %fs:sg3@tpoff, %rax
> + nop;nop;nop;nop
> +
> + /* LE, local var */
> + movq %fs:bl3@tpoff+3, %r10
> + nop;nop;nop;nop
> +
> + /* LE, hidden var defined in exec */
> + movq %fs:1+sh3@tpoff, %rdx
> + nop;nop;nop;nop
> +
> + leave
> + ret
> --- ld/testsuite/ld-x86-64/tlslib.s.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlslib.s 2002-09-25 11:30:19.000000000 +0200
> @@ -0,0 +1,18 @@
> + .section ".tdata", "awT", @progbits
> + .globl sG1, sG2, sG3, sG4, sG5, sG6, sG7, sG8
> +sG1: .long 513
> +sG2: .long 514
> +sG3: .long 515
> +sG4: .long 516
> +sG5: .long 517
> +sG6: .long 518
> +sG7: .long 519
> +sG8: .long 520
> +
> + .text
> + /* Dummy. */
> + .globl __tls_get_addr
> + .type __tls_get_addr,@function
> +__tls_get_addr:
> + movq %rdi, %rax
> + ret
> --- ld/testsuite/ld-x86-64/tlsbinpic.s.jj 2002-09-25 11:29:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlsbinpic.s 2002-09-26 16:29:52.000000000 +0200
> @@ -0,0 +1,136 @@
> + /* Force .data aligned to 4K, so that .got very likely gets at
> + 0x5021a0 (0x60 bytes .tdata and 0x140 bytes .dynamic) */
> + .data
> + .balign 4096
> + .section ".tdata", "awT", @progbits
> + .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8
> + .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
> + .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8
> +sg1: .long 17
> +sg2: .long 18
> +sg3: .long 19
> +sg4: .long 20
> +sg5: .long 21
> +sg6: .long 22
> +sg7: .long 23
> +sg8: .long 24
> +sl1: .long 65
> +sl2: .long 66
> +sl3: .long 67
> +sl4: .long 68
> +sl5: .long 69
> +sl6: .long 70
> +sl7: .long 71
> +sl8: .long 72
> +sh1: .long 257
> +sh2: .long 258
> +sh3: .long 259
> +sh4: .long 260
> +sh5: .long 261
> +sh6: .long 262
> +sh7: .long 263
> +sh8: .long 264
> + /* Force .text aligned to 4K, so it very likely gets at 0x401000. */
> + .text
> + .balign 4096
> + .globl fn2
> + .type fn2,@function
> +fn2:
> + pushq %rbp
> + movq %rsp, %rbp
> +
> + /* GD -> IE because variable is not defined in executable */
> + .long 0x66666666
> + leaq sG1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> IE because variable is not defined in executable where
> + the variable is referenced through IE too */
> + .long 0x66666666
> + leaq sG2@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> LE with global variable defined in executable */
> + .long 0x66666666
> + leaq sg1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> LE with local variable defined in executable */
> + .long 0x66666666
> + leaq sl1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* GD -> LE with hidden variable defined in executable */
> + .long 0x66666666
> + leaq sh1@tlsgd(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop;nop;nop
> +
> + /* LD */
> + leaq sl1@tlsld(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop
> + leaq 1+sl1@dtpoff(%rax), %rdx
> + nop;nop
> + leaq sl2@dtpoff+2(%rax), %r9
> + nop;nop;nop;nop
> +
> + /* LD against hidden variables */
> + leaq sh1@tlsld(%rip), %rdi
> + call __tls_get_addr@plt
> + nop;nop
> + leaq sh1@dtpoff(%rax), %rdx
> + nop;nop
> + leaq 3+sh2@dtpoff(%rax), %rcx
> + nop;nop;nop;nop
> +
> + /* IE against global var */
> + movq %fs:0, %r9
> + nop;nop
> + addq sG2@gottpoff(%rip), %r9
> + nop;nop;nop;nop
> +
> + /* IE -> LE against global var defined in exec */
> + movq %fs:0, %r10
> + nop;nop
> + addq sg1@gottpoff(%rip), %r10
> + nop;nop;nop;nop
> +
> + /* IE -> LE against local var */
> + movq %fs:0, %rax
> + nop;nop
> + addq sl1@gottpoff(%rip), %rax
> + nop;nop;nop;nop
> +
> + /* IE -> LE against hidden var */
> + movq %fs:0, %rcx
> + nop;nop
> + addq sh1@gottpoff(%rip), %rcx
> + nop;nop;nop;nop
> +
> + /* Direct access through %fs */
> +
> + /* IE against global var */
> + movq sG5@gottpoff(%rip), %rcx
> + nop;nop
> + movq %fs:(%rcx), %rdx
> + nop;nop;nop;nop
> +
> + /* IE->LE against local var */
> + movq sl5@gottpoff(%rip), %r11
> + nop;nop
> + movq %fs:(%r11), %r12
> + nop;nop;nop;nop
> +
> + /* IE->LE against hidden var */
> + movq sh5@gottpoff(%rip), %rdx
> + nop;nop
> + movq %fs:(%rdx), %rdx
> + nop;nop;nop;nop
> +
> + leave
> + ret
> --- ld/testsuite/ld-x86-64/tlsbin.rd.jj 2002-09-26 14:34:00.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlsbin.rd 2002-09-26 14:49:41.000000000 +0200
> @@ -0,0 +1,154 @@
> +#source: tlsbinpic.s
> +#source: tlsbin.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#readelf: -WSsrl
> +#target: x86_64-*-*
> +
> +There are 18 section headers, starting at offset 0x[0-9a-f]+:
> +
> +Section Headers:
> + \[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
> + \[ 0\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
> + \[ 1\] .interp +.*
> + \[ 2\] .hash +.*
> + \[ 3\] .dynsym +.*
> + \[ 4\] .dynstr +.*
> + \[ 5\] .rela.dyn +.*
> + \[ 6\] .rela.plt +.*
> + \[ 7\] .plt +.*
> + \[ 8\] .text +PROGBITS +0+401000 0+1000 0+22a 00 +AX +0 +0 +4096
> + \[ 9\] .data +.*
> + \[10\] .tdata +PROGBITS +0+502000 0+2000 0+60 00 WAT +0 +0 +1
> + \[11\] .tbss +NOBITS +0+502060 0+2060 0+40 00 WAT +0 +0 +1
> + \[12\] .dynamic +DYNAMIC +0+502060 0+2060 0+140 10 +WA +4 +0 +8
> + \[13\] .got +PROGBITS +0+5021a0 0+21a0 0+40 08 +WA +0 +0 +8
> + \[14\] .bss +.*
> + \[15\] .shstrtab +.*
> + \[16\] .symtab +.*
> + \[17\] .strtab +.*
> +Key to Flags:
> +.*
> +.*
> +.*
> +
> +Elf file type is EXEC \(Executable file\)
> +Entry point 0x40113c
> +There are 6 program headers, starting at offset [0-9]+
> +
> +Program Headers:
> + Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
> + PHDR +0x0+40 0x0+400040 0x0+400040 0x0+150 0x0+150 R E 0x8
> + INTERP +0x0+190 0x0+400190 0x0+400190 0x0+f 0x0+f R +0x1
> +.*Requesting program interpreter.*
> + LOAD +0x0+ 0x0+400000 0x0+400000 0x0+122a 0x0+122a R E 0x100000
> + LOAD +0x0+2000 0x0+502000 0x0+502000 0x0+1e0 0x0+1e0 RW 0x100000
> + DYNAMIC +0x0+2060 0x0+502060 0x0+502060 0x0+140 0x0+140 RW 0x8
> + TLS +0x0+2000 0x0+502000 0x0+502000 0x0+60 0x0+a0 R +0x1
> +
> + Section to Segment mapping:
> + Segment Sections...
> + 00 *
> + 01 +.interp *
> + 02 +.interp .hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
> + 03 +.tdata .tbss .dynamic .got *
> + 04 +.tbss .dynamic *
> + 05 +.tdata .tbss *
> +
> +Relocation section '.rela.dyn' at offset 0x358 contains 4 entries:
> + +Offset +Info +Type +Symbol's Value Symbol's Name \+ Addend
> +0+5021c0 0+100000012 R_X86_64_TPOFF64 +0+ sG5 \+ 0
> +0+5021c8 0+300000012 R_X86_64_TPOFF64 +0+ sG2 \+ 0
> +0+5021d0 0+600000012 R_X86_64_TPOFF64 +0+ sG6 \+ 0
> +0+5021d8 0+700000012 R_X86_64_TPOFF64 +0+ sG1 \+ 0
> +
> +Relocation section '.rela.plt' at offset 0x3b8 contains 1 entries:
> + +Offset +Info +Type +Symbol's Value Symbol's Name \+ Addend
> +0+[0-9a-f]+ 0+400000007 R_X86_64_JUMP_SLOT +0+[0-9a-f]+ __tls_get_addr \+ 0
> +
> +Symbol table '.dynsym' contains 11 entries:
> + +Num: +Value +Size Type +Bind +Vis +Ndx Name
> + +0: 0+ +0 NOTYPE LOCAL DEFAULT UND *
> + +1: 0+ +0 TLS +GLOBAL DEFAULT UND sG5
> + +2: 0+502060 +0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
> + +3: 0+ +0 TLS +GLOBAL DEFAULT UND sG2
> + +4: 0+[0-9a-f]+ +0 FUNC +GLOBAL DEFAULT UND __tls_get_addr
> + +5: 0+[0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
> + +6: 0+ +0 TLS +GLOBAL DEFAULT UND sG6
> + +7: 0+ +0 TLS +GLOBAL DEFAULT UND sG1
> + +8: 0+[0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
> + +9: 0+5021a0 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
> + +10: 0+[0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
> +
> +Symbol table '.symtab' contains 70 entries:
> + +Num: +Value +Size Type +Bind +Vis +Ndx Name
> + +0: 0+ +0 NOTYPE LOCAL DEFAULT UND *
> + +1: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +1 *
> + +2: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +2 *
> + +3: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +3 *
> + +4: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +4 *
> + +5: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +5 *
> + +6: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +6 *
> + +7: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +7 *
> + +8: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +8 *
> + +9: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +9 *
> + +10: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +10 *
> + +11: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +11 *
> + +12: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +12 *
> + +13: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +13 *
> + +14: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +14 *
> + +15: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +15 *
> + +16: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +16 *
> + +17: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +17 *
> + +18: 0+20 +0 TLS +LOCAL DEFAULT +10 sl1
> + +19: 0+24 +0 TLS +LOCAL DEFAULT +10 sl2
> + +20: 0+28 +0 TLS +LOCAL DEFAULT +10 sl3
> + +21: 0+2c +0 TLS +LOCAL DEFAULT +10 sl4
> + +22: 0+30 +0 TLS +LOCAL DEFAULT +10 sl5
> + +23: 0+34 +0 TLS +LOCAL DEFAULT +10 sl6
> + +24: 0+38 +0 TLS +LOCAL DEFAULT +10 sl7
> + +25: 0+3c +0 TLS +LOCAL DEFAULT +10 sl8
> + +26: 0+80 +0 TLS +LOCAL DEFAULT +11 bl1
> + +27: 0+84 +0 TLS +LOCAL DEFAULT +11 bl2
> + +28: 0+88 +0 TLS +LOCAL DEFAULT +11 bl3
> + +29: 0+8c +0 TLS +LOCAL DEFAULT +11 bl4
> + +30: 0+90 +0 TLS +LOCAL DEFAULT +11 bl5
> + +31: 0+94 +0 TLS +LOCAL DEFAULT +11 bl6
> + +32: 0+98 +0 TLS +LOCAL DEFAULT +11 bl7
> + +33: 0+9c +0 TLS +LOCAL DEFAULT +11 bl8
> + +34: 0+1c +0 TLS +GLOBAL DEFAULT +10 sg8
> + +35: 0+7c +0 TLS +GLOBAL DEFAULT +11 bg8
> + +36: 0+74 +0 TLS +GLOBAL DEFAULT +11 bg6
> + +37: 0+ +0 TLS +GLOBAL DEFAULT UND sG5
> + +38: 0+68 +0 TLS +GLOBAL DEFAULT +11 bg3
> + +39: 0+502060 +0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
> + +40: 0+8 +0 TLS +GLOBAL DEFAULT +10 sg3
> + +41: 0+48 +0 TLS +GLOBAL HIDDEN +10 sh3
> + +42: 0+ +0 TLS +GLOBAL DEFAULT UND sG2
> + +43: 0+c +0 TLS +GLOBAL DEFAULT +10 sg4
> + +44: 0+10 +0 TLS +GLOBAL DEFAULT +10 sg5
> + +45: 0+70 +0 TLS +GLOBAL DEFAULT +11 bg5
> + +46: [0-9a-f]+ +0 FUNC +GLOBAL DEFAULT UND __tls_get_addr
> + +47: 0+58 +0 TLS +GLOBAL HIDDEN +10 sh7
> + +48: 0+5c +0 TLS +GLOBAL HIDDEN +10 sh8
> + +49: 0+ +0 TLS +GLOBAL DEFAULT +10 sg1
> + +50: 0+40113c +0 FUNC +GLOBAL DEFAULT +8 _start
> + +51: 0+4c +0 TLS +GLOBAL HIDDEN +10 sh4
> + +52: 0+78 +0 TLS +GLOBAL DEFAULT +11 bg7
> + +53: 0+50 +0 TLS +GLOBAL HIDDEN +10 sh5
> + +54: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
> + +55: 0+ +0 TLS +GLOBAL DEFAULT UND sG6
> + +56: 0+401000 +0 FUNC +GLOBAL DEFAULT +8 fn2
> + +57: 0+4 +0 TLS +GLOBAL DEFAULT +10 sg2
> + +58: 0+ +0 TLS +GLOBAL DEFAULT UND sG1
> + +59: 0+40 +0 TLS +GLOBAL HIDDEN +10 sh1
> + +60: 0+14 +0 TLS +GLOBAL DEFAULT +10 sg6
> + +61: 0+18 +0 TLS +GLOBAL DEFAULT +10 sg7
> + +62: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
> + +63: 0+5021a0 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
> + +64: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
> + +65: 0+44 +0 TLS +GLOBAL HIDDEN +10 sh2
> + +66: 0+54 +0 TLS +GLOBAL HIDDEN +10 sh6
> + +67: 0+64 +0 TLS +GLOBAL DEFAULT +11 bg2
> + +68: 0+60 +0 TLS +GLOBAL DEFAULT +11 bg1
> + +69: 0+6c +0 TLS +GLOBAL DEFAULT +11 bg4
> --- ld/testsuite/ld-x86-64/tlspic.rd.jj 2002-09-25 18:47:12.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic.rd 2002-09-26 13:35:55.000000000 +0200
> @@ -0,0 +1,162 @@
> +#source: tlspic1.s
> +#source: tlspic2.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#readelf: -WSsrl
> +#target: x86_64-*-*
> +
> +There are 17 section headers, starting at offset 0x[0-9a-f]+:
> +
> +Section Headers:
> + \[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
> + \[ 0\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
> + \[ 1\] .hash +.*
> + \[ 2\] .dynsym +.*
> + \[ 3\] .dynstr +.*
> + \[ 4\] .rela.dyn +.*
> + \[ 5\] .rela.plt +.*
> + \[ 6\] .plt +.*
> + \[ 7\] .text +PROGBITS +0+1000 0+1000 0+1ac 00 +AX +0 +0 4096
> + \[ 8\] .data +.*
> + \[ 9\] .tdata +PROGBITS +0+102000 0+2000 0+60 00 WAT +0 +0 +1
> + \[10\] .tbss +NOBITS +0+102060 0+2060 0+20 00 WAT +0 +0 +1
> + \[11\] .dynamic +DYNAMIC +0+102060 0+2060 0+130 10 +WA +3 +0 +8
> + \[12\] .got +PROGBITS +0+102190 0+2190 0+b0 08 +WA +0 +0 +8
> + \[13\] .bss +.*
> + \[14\] .shstrtab +.*
> + \[15\] .symtab +.*
> + \[16\] .strtab +.*
> +Key to Flags:
> +.*
> +.*
> +.*
> +
> +Elf file type is DYN \(Shared object file\)
> +Entry point 0x1000
> +There are 4 program headers, starting at offset [0-9]+
> +
> +Program Headers:
> + Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
> + LOAD +0x0+ 0x0+ 0x0+ 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x100000
> + LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+240 0x0+240 RW +0x100000
> + DYNAMIC +0x0+2060 0x0+102060 0x0+102060 0x0+130 0x0+130 RW +0x8
> + TLS +0x0+2000 0x0+102000 0x0+102000 0x0+60 0x0+80 R +0x1
> +
> + Section to Segment mapping:
> + Segment Sections...
> + 00 +.hash .dynsym .dynstr .rela.dyn .rela.plt .plt .text *
> + 01 +.tdata .tbss .dynamic .got *
> + 02 +.tbss .dynamic *
> + 03 +.tdata .tbss *
> +
> +Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
> + +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
> +0+1021b0 0+10 R_X86_64_DTPMOD64 +0+
> +0+1021c0 0+12 R_X86_64_TPOFF64 +0+24
> +0+1021c8 0+12 R_X86_64_TPOFF64 +0+30
> +0+1021d0 0+10 R_X86_64_DTPMOD64 +0+
> +0+1021e0 0+10 R_X86_64_DTPMOD64 +0+
> +0+1021f0 0+12 R_X86_64_TPOFF64 +0+64
> +0+102210 0+12 R_X86_64_TPOFF64 +0+50
> +0+102218 0+12 R_X86_64_TPOFF64 +0+70
> +0+102228 0+10 R_X86_64_DTPMOD64 +0+
> +0+102238 0+12 R_X86_64_TPOFF64 +0+44
> +0+1021f8 0+1200000012 R_X86_64_TPOFF64 +0+10 sg5 \+ 0
> +0+102200 0+1400000010 R_X86_64_DTPMOD64 +0+ sg1 \+ 0
> +0+102208 0+1400000011 R_X86_64_DTPOFF64 +0+ sg1 \+ 0
> +0+102220 0+1700000012 R_X86_64_TPOFF64 +0+4 sg2 \+ 0
> +
> +Relocation section '.rela.plt' at offset 0x658 contains 1 entries:
> + +Offset +Info +Type +Symbol's Value Symbol's Name \+ Addend
> +0+[0-9a-f]+ 0+1300000007 R_X86_64_JUMP_SLOT +0+ __tls_get_addr \+ 0
> +
> +Symbol table '.dynsym' contains 29 entries:
> + +Num: +Value +Size Type +Bind +Vis +Ndx Name
> + +0: 0+ +0 NOTYPE LOCAL DEFAULT UND *
> + +1: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +1 *
> + +2: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +2 *
> + +3: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +3 *
> + +4: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +4 *
> + +5: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +5 *
> + +6: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +6 *
> + +7: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +7 *
> + +8: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +8 *
> + +9: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +9 *
> + +10: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +10 *
> + +11: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +11 *
> + +12: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +12 *
> + +13: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +13 *
> + +14: 0+1c +0 TLS +GLOBAL DEFAULT +9 sg8
> + +15: 0+102060 +0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
> + +16: 0+8 +0 TLS +GLOBAL DEFAULT +9 sg3
> + +17: 0+c +0 TLS +GLOBAL DEFAULT +9 sg4
> + +18: 0+10 +0 TLS +GLOBAL DEFAULT +9 sg5
> + +19: 0+ +0 NOTYPE GLOBAL DEFAULT UND __tls_get_addr
> + +20: 0+ +0 TLS +GLOBAL DEFAULT +9 sg1
> + +21: 0+1000 +0 FUNC +GLOBAL DEFAULT +7 fn1
> + +22: 0+102240 +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
> + +23: 0+4 +0 TLS +GLOBAL DEFAULT +9 sg2
> + +24: 0+14 +0 TLS +GLOBAL DEFAULT +9 sg6
> + +25: 0+18 +0 TLS +GLOBAL DEFAULT +9 sg7
> + +26: 0+102240 +0 NOTYPE GLOBAL DEFAULT ABS _edata
> + +27: 0+102190 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
> + +28: 0+102240 +0 NOTYPE GLOBAL DEFAULT ABS _end
> +
> +Symbol table '.symtab' contains 56 entries:
> + +Num: +Value +Size Type +Bind +Vis +Ndx Name
> + +0: 0+ +0 NOTYPE LOCAL DEFAULT UND *
> + +1: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +1 *
> + +2: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +2 *
> + +3: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +3 *
> + +4: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +4 *
> + +5: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +5 *
> + +6: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +6 *
> + +7: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +7 *
> + +8: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +8 *
> + +9: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +9 *
> + +10: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +10 *
> + +11: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +11 *
> + +12: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +12 *
> + +13: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +13 *
> + +14: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +14 *
> + +15: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +15 *
> + +16: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +16 *
> + +17: 0+20 +0 TLS +LOCAL DEFAULT +9 sl1
> + +18: 0+24 +0 TLS +LOCAL DEFAULT +9 sl2
> + +19: 0+28 +0 TLS +LOCAL DEFAULT +9 sl3
> + +20: 0+2c +0 TLS +LOCAL DEFAULT +9 sl4
> + +21: 0+30 +0 TLS +LOCAL DEFAULT +9 sl5
> + +22: 0+34 +0 TLS +LOCAL DEFAULT +9 sl6
> + +23: 0+38 +0 TLS +LOCAL DEFAULT +9 sl7
> + +24: 0+3c +0 TLS +LOCAL DEFAULT +9 sl8
> + +25: 0+60 +0 TLS +LOCAL HIDDEN +10 sH1
> + +26: 0+48 +0 TLS +LOCAL HIDDEN +9 sh3
> + +27: 0+64 +0 TLS +LOCAL HIDDEN +10 sH2
> + +28: 0+78 +0 TLS +LOCAL HIDDEN +10 sH7
> + +29: 0+58 +0 TLS +LOCAL HIDDEN +9 sh7
> + +30: 0+5c +0 TLS +LOCAL HIDDEN +9 sh8
> + +31: 0+6c +0 TLS +LOCAL HIDDEN +10 sH4
> + +32: 0+4c +0 TLS +LOCAL HIDDEN +9 sh4
> + +33: 0+68 +0 TLS +LOCAL HIDDEN +10 sH3
> + +34: 0+50 +0 TLS +LOCAL HIDDEN +9 sh5
> + +35: 0+70 +0 TLS +LOCAL HIDDEN +10 sH5
> + +36: 0+74 +0 TLS +LOCAL HIDDEN +10 sH6
> + +37: 0+7c +0 TLS +LOCAL HIDDEN +10 sH8
> + +38: 0+40 +0 TLS +LOCAL HIDDEN +9 sh1
> + +39: 0+44 +0 TLS +LOCAL HIDDEN +9 sh2
> + +40: 0+54 +0 TLS +LOCAL HIDDEN +9 sh6
> + +41: 0+1c +0 TLS +GLOBAL DEFAULT +9 sg8
> + +42: 0+102060 +0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
> + +43: 0+8 +0 TLS +GLOBAL DEFAULT +9 sg3
> + +44: 0+c +0 TLS +GLOBAL DEFAULT +9 sg4
> + +45: 0+10 +0 TLS +GLOBAL DEFAULT +9 sg5
> + +46: 0+ +0 NOTYPE GLOBAL DEFAULT UND __tls_get_addr
> + +47: 0+ +0 TLS +GLOBAL DEFAULT +9 sg1
> + +48: 0+1000 +0 FUNC +GLOBAL DEFAULT +7 fn1
> + +49: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
> + +50: 0+4 +0 TLS +GLOBAL DEFAULT +9 sg2
> + +51: 0+14 +0 TLS +GLOBAL DEFAULT +9 sg6
> + +52: 0+18 +0 TLS +GLOBAL DEFAULT +9 sg7
> + +53: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
> + +54: 0+102190 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
> + +55: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
> --- ld/testsuite/ld-x86-64/tlspic.dd.jj 2002-09-26 13:37:26.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic.dd 2002-09-26 16:20:08.000000000 +0200
> @@ -0,0 +1,226 @@
> +#source: tlspic1.s
> +#source: tlspic2.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#objdump: -drj.text
> +#target: x86_64-*-*
> +
> +.*: +file format elf64-x86-64
> +
> +Disassembly of section .text:
> +
> +0+1000 <fn1>:
> + +1000: 55[ ]+push %rbp
> + +1001: 48 89 e5[ ]+mov %rsp,%rbp
> + +1004: 90[ ]+nop *
> + +1005: 90[ ]+nop *
> + +1006: 90[ ]+nop *
> + +1007: 90[ ]+nop *
> +# GD
> + +1008: 66 66 66 66 48 8d 3d[ ]+lea 1053165\(%rip\),%rdi +# 102200 <_GLOBAL_OFFSET_TABLE_\+0x70>
> + +100f: ed 11 10 00 *
> +# -> R_X86_64_DTPMOD64 sg1
> + +1013: e8 68 f6 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +1018: 90[ ]+nop *
> + +1019: 90[ ]+nop *
> + +101a: 90[ ]+nop *
> + +101b: 90[ ]+nop *
> +# GD -> IE because variable is referenced through IE too
> + +101c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + +1023: 00 00 *
> + +1025: 48 03 05 f4 11 10 00[ ]+add 1053172\(%rip\),%rax +# 102220 <_GLOBAL_OFFSET_TABLE_\+0x90>
> +# -> R_X86_64_TPOFF64 sg2
Is the TPOFF64 correct here? Looking at your writeup I see a GOTTPOFF
> + +102c: 90[ ]+nop *
> + +102d: 90[ ]+nop *
> + +102e: 90[ ]+nop *
> + +102f: 90[ ]+nop *
> +# GD against local variable
> + +1030: 66 66 66 66 48 8d 3d[ ]+lea 1053045\(%rip\),%rdi +# 1021b0 <_GLOBAL_OFFSET_TABLE_\+0x20>
> + +1037: 75 11 10 00 *
> +# -> R_X86_64_DTPMOD64 [0 0x2000000000000000]
> + +103b: e8 40 f6 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +1040: 90[ ]+nop *
> + +1041: 90[ ]+nop *
> + +1042: 90[ ]+nop *
> + +1043: 90[ ]+nop *
> +# GD -> IE against local variable referenced through IE too
> + +1044: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + +104b: 00 00 *
> + +104d: 48 03 05 6c 11 10 00[ ]+add 1053036\(%rip\),%rax +# 1021c0 <_GLOBAL_OFFSET_TABLE_\+0x30>
> +# -> R_X86_64_TPOFF64 *ABS*+0x24
> + +1054: 90[ ]+nop *
> + +1055: 90[ ]+nop *
> + +1056: 90[ ]+nop *
> + +1057: 90[ ]+nop *
> +# GD against hidden and local variable
> + +1058: 66 66 66 66 48 8d 3d[ ]+lea 1053125\(%rip\),%rdi +# 102228 <_GLOBAL_OFFSET_TABLE_\+0x98>
> + +105f: c5 11 10 00 *
> +# -> R_X86_64_DTPMOD64 [0 0x4000000000000000]
> + +1063: e8 18 f6 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +1068: 90[ ]+nop *
> + +1069: 90[ ]+nop *
> + +106a: 90[ ]+nop *
> + +106b: 90[ ]+nop *
> +# GD -> IE against hidden and local variable referenced through IE too
> + +106c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + +1073: 00 00 *
> + +1075: 48 03 05 bc 11 10 00[ ]+add 1053116\(%rip\),%rax +# 102238 <_GLOBAL_OFFSET_TABLE_\+0xa8>
> +# -> R_X86_64_TPOFF64 *ABS*+0x44
> + +107c: 90[ ]+nop *
> + +107d: 90[ ]+nop *
> + +107e: 90[ ]+nop *
> + +107f: 90[ ]+nop *
> +# GD against hidden but not local variable
> + +1080: 66 66 66 66 48 8d 3d[ ]+lea 1053013\(%rip\),%rdi +# 1021e0 <_GLOBAL_OFFSET_TABLE_\+0x50>
> + +1087: 55 11 10 00 *
> +# -> R_X86_64_DTPMOD64 [0 0x6000000000000000]
> + +108b: e8 f0 f5 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +1090: 90[ ]+nop *
> + +1091: 90[ ]+nop *
> + +1092: 90[ ]+nop *
> + +1093: 90[ ]+nop *
> +# GD -> IE against hidden but not local variable referenced through IE too
> + +1094: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + +109b: 00 00 *
> + +109d: 48 03 05 4c 11 10 00[ ]+add 1053004\(%rip\),%rax +# 1021f0 <_GLOBAL_OFFSET_TABLE_\+0x60>
> +# -> R_X86_64_TPOFF64 *ABS*+0x64
> + +10a4: 90[ ]+nop *
> + +10a5: 90[ ]+nop *
> + +10a6: 90[ ]+nop *
> + +10a7: 90[ ]+nop *
> +# LD
> + +10a8: 48 8d 3d 21 11 10 00[ ]+lea 1052961\(%rip\),%rdi +# 1021d0 <_GLOBAL_OFFSET_TABLE_\+0x40>
> +# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
> + +10af: e8 cc f5 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +10b4: 90[ ]+nop *
> + +10b5: 90[ ]+nop *
> + +10b6: 48 8d 90 20 00 00 00[ ]+lea 0x20\(%rax\),%rdx
> + +10bd: 90[ ]+nop *
> + +10be: 90[ ]+nop *
> + +10bf: 4c 8d 88 26 00 00 00[ ]+lea 0x26\(%rax\),%r9
> + +10c6: 90[ ]+nop *
> + +10c7: 90[ ]+nop *
> + +10c8: 90[ ]+nop *
> + +10c9: 90[ ]+nop *
> +# LD against hidden and local variables
> + +10ca: 48 8d 3d ff 10 10 00[ ]+lea 1052927\(%rip\),%rdi +# 1021d0 <_GLOBAL_OFFSET_TABLE_\+0x40>
> +# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
> + +10d1: e8 aa f5 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +10d6: 90[ ]+nop *
> + +10d7: 90[ ]+nop *
> + +10d8: 48 8d 90 40 00 00 00[ ]+lea 0x40\(%rax\),%rdx
> + +10df: 90[ ]+nop *
> + +10e0: 90[ ]+nop *
> + +10e1: 48 8d 88 47 00 00 00[ ]+lea 0x47\(%rax\),%rcx
> + +10e8: 90[ ]+nop *
> + +10e9: 90[ ]+nop *
> + +10ea: 90[ ]+nop *
> + +10eb: 90[ ]+nop *
> +# LD against hidden but not local variables
> + +10ec: 48 8d 3d dd 10 10 00[ ]+lea 1052893\(%rip\),%rdi +# 1021d0 <_GLOBAL_OFFSET_TABLE_\+0x40>
> +# -> R_X86_64_DTPMOD64 [0 0x000000000000000]
> + +10f3: e8 88 f5 ff ff[ ]+callq [0-9a-f]+ <.*>
> +# -> R_X86_64_JUMP_SLOT __tls_get_addr
> + +10f8: 90[ ]+nop *
> + +10f9: 90[ ]+nop *
> + +10fa: 4c 8d a0 60 00 00 00[ ]+lea 0x60\(%rax\),%r12
> + +1101: 90[ ]+nop *
> + +1102: 90[ ]+nop *
> + +1103: 48 8d 88 65 00 00 00[ ]+lea 0x65\(%rax\),%rcx
> + +110a: 90[ ]+nop *
> + +110b: 90[ ]+nop *
> +# IE against global var
> + +110c: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
> + +1113: 00 00 *
> + +1115: 90[ ]+nop *
> + +1116: 90[ ]+nop *
> + +1117: 48 03 0d 02 11 10 00[ ]+add 1052930\(%rip\),%rcx +# 102220 <_GLOBAL_OFFSET_TABLE_\+0x90>
> +# -> R_X86_64_TPOFF64 sg2
> + +111e: 90[ ]+nop *
> + +111f: 90[ ]+nop *
> + +1120: 90[ ]+nop *
> + +1121: 90[ ]+nop *
> +# IE against local var
> + +1122: 64 4c 8b 34 25 00 00[ ]+mov %fs:0x0,%r14
> + +1129: 00 00 *
> + +112b: 90[ ]+nop *
> + +112c: 90[ ]+nop *
> + +112d: 4c 03 35 8c 10 10 00[ ]+add 1052812\(%rip\),%r14 +# 1021c0 <_GLOBAL_OFFSET_TABLE_\+0x30>
> +# -> R_X86_64_TPOFF64 *ABS*+0x24
> + +1134: 90[ ]+nop *
> + +1135: 90[ ]+nop *
> + +1136: 90[ ]+nop *
> + +1137: 90[ ]+nop *
> +# IE against hidden and local var
> + +1138: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
> + +113f: 00 00 *
> + +1141: 90[ ]+nop *
> + +1142: 90[ ]+nop *
> + +1143: 48 03 0d ee 10 10 00[ ]+add 1052910\(%rip\),%rcx +# 102238 <_GLOBAL_OFFSET_TABLE_\+0xa8>
> +# -> R_X86_64_TPOFF64 *ABS*+0x44
> + +114a: 90[ ]+nop *
> + +114b: 90[ ]+nop *
> + +114c: 90[ ]+nop *
> + +114d: 90[ ]+nop *
> +# IE against hidden but not local var
> + +114e: 64 48 8b 0c 25 00 00[ ]+mov %fs:0x0,%rcx
> + +1155: 00 00 *
> + +1157: 90[ ]+nop *
> + +1158: 90[ ]+nop *
> + +1159: 48 03 0d 90 10 10 00[ ]+add 1052816\(%rip\),%rcx +# 1021f0 <_GLOBAL_OFFSET_TABLE_\+0x60>
> +# -> R_X86_64_TPOFF64 *ABS*+0x64
> + +1160: 90[ ]+nop *
> + +1161: 90[ ]+nop *
> + +1162: 90[ ]+nop *
> + +1163: 90[ ]+nop *
> +# Direct access through %fs
> +# IE against global var
> + +1164: 48 8b 0d 8d 10 10 00[ ]+mov 1052813\(%rip\),%rcx +# 1021f8 <_GLOBAL_OFFSET_TABLE_\+0x68>
> +# -> R_X86_64_TPOFF64 sg5
> + +116b: 90[ ]+nop *
> + +116c: 90[ ]+nop *
> + +116d: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
> + +1171: 90[ ]+nop *
> + +1172: 90[ ]+nop *
> + +1173: 90[ ]+nop *
> + +1174: 90[ ]+nop *
> +# IE against local var
> + +1175: 4c 8b 15 4c 10 10 00[ ]+mov 1052748\(%rip\),%r10 +# 1021c8 <_GLOBAL_OFFSET_TABLE_\+0x38>
> +# -> R_X86_64_TPOFF64 *ABS*+0x30
> + +117c: 90[ ]+nop *
> + +117d: 90[ ]+nop *
> + +117e: 64 4d 8b 22[ ]+mov %fs:\(%r10\),%r12
> + +1182: 90[ ]+nop *
> + +1183: 90[ ]+nop *
> + +1184: 90[ ]+nop *
> + +1185: 90[ ]+nop *
> +# IE against hidden and local var
> + +1186: 48 8b 15 83 10 10 00[ ]+mov 1052803\(%rip\),%rdx +# 102210 <_GLOBAL_OFFSET_TABLE_\+0x80>
> +# -> R_X86_64_TPOFF64 *ABS*+0x50
> + +118d: 90[ ]+nop *
> + +118e: 90[ ]+nop *
> + +118f: 64 48 8b 12[ ]+mov %fs:\(%rdx\),%rdx
> + +1193: 90[ ]+nop *
> + +1194: 90[ ]+nop *
> + +1195: 90[ ]+nop *
> + +1196: 90[ ]+nop *
> +# IE against hidden but not local var
> + +1197: 48 8b 0d 7a 10 10 00[ ]+mov 1052794\(%rip\),%rcx +# 102218 <_GLOBAL_OFFSET_TABLE_\+0x88>
> +# -> R_X86_64_TPOFF64 *ABS*+0x70
> + +119e: 90[ ]+nop *
> + +119f: 90[ ]+nop *
> + +11a0: 64 48 8b 11[ ]+mov %fs:\(%rcx\),%rdx
> + +11a4: 90[ ]+nop *
> + +11a5: 90[ ]+nop *
> + +11a6: 90[ ]+nop *
> + +11a7: 90[ ]+nop *
> + +11a8: c9[ ]+leaveq *
> + +11a9: c3[ ]+retq *
> + +11aa: 90[ ]+nop *
> + +11ab: 90[ ]+nop *
> --- ld/testsuite/ld-x86-64/tlspic.sd.jj 2002-09-26 13:44:46.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic.sd 2002-09-26 14:15:16.000000000 +0200
> @@ -0,0 +1,21 @@
> +#source: tlspic1.s
> +#source: tlspic2.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#objdump: -sj.got
> +#target: x86_64-*-*
> +
> +.*: +file format elf64-x86-64
> +
> +Contents of section .got:
> + 102190 [0-9a-f]+ [0-9a-f]+ 00000000 00000000 .*
> + 1021a0 00000000 00000000 [0-9a-f]+ [0-9a-f]+ .*
> + 1021b0 00000000 00000000 20000000 00000000 .*
> + 1021c0 00000000 00000000 00000000 00000000 .*
> + 1021d0 00000000 00000000 00000000 00000000 .*
> + 1021e0 00000000 00000000 60000000 00000000 .*
> + 1021f0 00000000 00000000 00000000 00000000 .*
> + 102200 00000000 00000000 00000000 00000000 .*
> + 102210 00000000 00000000 00000000 00000000 .*
> + 102220 00000000 00000000 00000000 00000000 .*
> + 102230 40000000 00000000 00000000 00000000 .*
> --- ld/testsuite/ld-x86-64/tlspic.td.jj 2002-09-26 13:44:50.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlspic.td 2002-09-26 13:45:32.000000000 +0200
> @@ -0,0 +1,16 @@
> +#source: tlspic1.s
> +#source: tlspic2.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#objdump: -sj.tdata
> +#target: x86_64-*-*
> +
> +.*: +file format elf64-x86-64
> +
> +Contents of section .tdata:
> + 102000 11000000 12000000 13000000 14000000 .*
> + 102010 15000000 16000000 17000000 18000000 .*
> + 102020 41000000 42000000 43000000 44000000 .*
> + 102030 45000000 46000000 47000000 48000000 .*
> + 102040 01010000 02010000 03010000 04010000 .*
> + 102050 05010000 06010000 07010000 08010000 .*
> --- ld/testsuite/ld-x86-64/tlsbin.dd.jj 2002-09-26 14:51:28.000000000 +0200
> +++ ld/testsuite/ld-x86-64/tlsbin.dd 2002-09-26 17:27:09.000000000 +0200
> @@ -0,0 +1,310 @@
> +#source: tlsbinpic.s
> +#source: tlsbin.s
> +#as: --64
> +#ld: -shared -melf_x86_64
> +#objdump: -drj.text
> +#target: x86_64-*-*
> +
> +# PT_TLS layout is:
> +# Offset from Offset from Name
> +# TCB base TCB end
> +# 0x00 -0xa0 sg1..sg8
> +# 0x20 -0x80 sl1..sl8
> +# 0x40 -0x60 sh1..sh8
> +# 0x60 -0x40 bg1..bg8
> +# 0x80 -0x20 bl1..bl8
> +
> +.*: +file format elf64-x86-64
> +
> +Disassembly of section .text:
> +
> +0+401000 <fn2>:
> + 401000: 55[ ]+push %rbp
> + 401001: 48 89 e5[ ]+mov %rsp,%rbp
> +# GD -> IE because variable is not defined in executable
> + 401004: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + 40100b: 00 00 *
> + 40100d: 48 03 05 c4 11 10 00[ ]+add 1053124\(%rip\),%rax +# 5021d8 <_GLOBAL_OFFSET_TABLE_\+0x38>
> +# -> R_X86_64_TPOFF64 sG1
> + 401014: 90[ ]+nop *
> + 401015: 90[ ]+nop *
> + 401016: 90[ ]+nop *
> + 401017: 90[ ]+nop *
> +# GD -> IE because variable is not defined in executable where
> +# the variable is referenced through IE too
> + 401018: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + 40101f: 00 00 *
> + 401021: 48 03 05 a0 11 10 00[ ]+add 1053088\(%rip\),%rax +# 5021c8 <_GLOBAL_OFFSET_TABLE_\+0x28>
> +# -> R_X86_64_TPOFF64 sG2
> + 401028: 90[ ]+nop *
> + 401029: 90[ ]+nop *
> + 40102a: 90[ ]+nop *
> + 40102b: 90[ ]+nop *
> +# GD -> LE with global variable defined in executable
> + 40102c: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + 401033: 00 00 *
> + 401035: 48 8d 80 60 ff ff ff[ ]+lea 0xf+60\(%rax\),%rax
> +# sg1
> + 40103c: 90[ ]+nop *
> + 40103d: 90[ ]+nop *
> + 40103e: 90[ ]+nop *
> + 40103f: 90[ ]+nop *
> +# GD -> LE with local variable defined in executable
> + 401040: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + 401047: 00 00 *
> + 401049: 48 8d 80 80 ff ff ff[ ]+lea 0xf+80\(%rax\),%rax
> +# sl1
> + 401050: 90[ ]+nop *
> + 401051: 90[ ]+nop *
> + 401052: 90[ ]+nop *
> + 401053: 90[ ]+nop *
> +# GD -> LE with hidden variable defined in executable
> + 401054: 64 48 8b 04 25 00 00[ ]+mov %fs:0x0,%rax
> + 40105b: 00 00 *
> + 40105d: 48 8d 80 a0 ff ff ff[ ]+lea 0xf+a0\(%rax\),%rax
> +# sh1
> + 401064: 90[ ]+nop *
> + 401065: 90[ ]+nop *
> + 401066: 90[ ]+nop *
> + 401067: 90[ ]+nop *
> +# LD
Isn't this a LD -> LE transition? The header "LD" is misleading but
this might come from the fact that you assemble the file in different
ways.
> [...]
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj