[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / x86-64-tls-ie.s
blob7475282b2dcffd21fffa3a986aaf11958ae01fac
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/tls-got.s -o %t2.o
4 // RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
5 // RUN: ld.lld -e main %t1.o %t2.so -o %t3
6 // RUN: llvm-readobj -S -r %t3 | FileCheck %s
7 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t3 | FileCheck --check-prefix=DISASM %s
9 // CHECK: Section {
10 // CHECK: Index: 9
11 // CHECK-NEXT: Name: .got
12 // CHECK-NEXT: Type: SHT_PROGBITS
13 // CHECK-NEXT: Flags [
14 // CHECK-NEXT: SHF_ALLOC
15 // CHECK-NEXT: SHF_WRITE
16 // CHECK-NEXT: ]
17 // CHECK-NEXT: Address: [[ADDR:.*]]
18 // CHECK-NEXT: Offset: 0x3F0
19 // CHECK-NEXT: Size: 16
20 // CHECK-NEXT: Link: 0
21 // CHECK-NEXT: Info: 0
22 // CHECK-NEXT: AddressAlignment: 8
23 // CHECK-NEXT: EntrySize: 0
24 // CHECK-NEXT: }
26 // CHECK: Relocations [
27 // CHECK-NEXT: Section (5) .rela.dyn {
28 // CHECK-NEXT: [[ADDR]] R_X86_64_TPOFF64 tls1 0x0
29 // CHECK-NEXT: 0x2023F8 R_X86_64_TPOFF64 tls0 0x0
30 // CHECK-NEXT: }
31 // CHECK-NEXT: ]
33 /// 0x2023F0 - 0x201307 = 4329
34 /// 0x2023F8 - 0x201311 = 4327
35 /// 0x2023F8 - 0x20131b = 4317
36 // DISASM: Disassembly of section .text:
37 // DISASM-EMPTY:
38 // DISASM-NEXT: <main>:
39 // DISASM-NEXT: movq 4329(%rip), %rax
40 // DISASM-NEXT: 201307: movl %fs:(%rax), %eax
41 // DISASM-NEXT: movq 4327(%rip), %rax
42 // DISASM-NEXT: 201311: movl %fs:(%rax), %eax
43 // DISASM-NEXT: movq 4317(%rip), %rax
44 // DISASM-NEXT: 20131b: movl %fs:(%rax), %eax
46 /// 0x2023F0 - 0x20132e = 4290
47 // DISASM-NEXT: movq %fs:0, %rax
48 // DISASM-NEXT: addq 4290(%rip), %rax
49 // DISASM-NEXT: 20132e: retq
51 .section .tdata,"awT",@progbits
53 .text
54 .globl main
55 .align 16, 0x90
56 .type main,@function
57 main:
58 movq tls1@GOTTPOFF(%rip), %rax
59 movl %fs:0(%rax), %eax
60 movq tls0@GOTTPOFF(%rip), %rax
61 movl %fs:0(%rax), %eax
62 movq tls0@GOTTPOFF(%rip), %rax
63 movl %fs:0(%rax), %eax
65 ## Relaxed to TLS IE. Share the GOT entry with GOTTPOFF.
66 .byte 0x66
67 leaq tls1@tlsgd(%rip), %rdi
68 .value 0x6666
69 rex64
70 call __tls_get_addr@PLT
71 ret