1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
3 // Test that we produce the correct relocation.
6 movl $bar, %edx # R_X86_64_32
7 movq $bar, %rdx # R_X86_64_32S
8 movq $bar, bar(%rip) # R_X86_64_32S
9 movl bar, %edx # R_X86_64_32S
10 movq bar, %rdx # R_X86_64_32S
11 .long bar # R_X86_64_32
12 leaq foo@GOTTPOFF(%rip), %rax # R_X86_64_GOTTPOFF
13 leaq foo@TLSGD(%rip), %rax # R_X86_64_TLSGD
14 leaq foo@TPOFF(%rax), %rax # R_X86_64_TPOFF32
15 leaq foo@TLSLD(%rip), %rdi # R_X86_64_TLSLD
16 leaq foo@DTPOFF(%rax), %rcx # R_X86_64_DTPOFF32
21 // CHECK: # Section 0x00000001
22 // CHECK: (('sh_name', 0x00000001) # '.text'
24 // CHECK: # Symbol 0x00000002
25 // CHECK: (('st_name', 0x00000000) # ''
26 // CHECK: ('st_bind', 0x00000000)
27 // CHECK: ('st_type', 0x00000003)
28 // CHECK: ('st_other', 0x00000000)
29 // CHECK: ('st_shndx', 0x00000001)
31 // CHECK: # Relocation 0x00000000
32 // CHECK-NEXT: (('r_offset', 0x00000001)
33 // CHECK-NEXT: ('r_sym', 0x00000002)
34 // CHECK-NEXT: ('r_type', 0x0000000a)
35 // CHECK-NEXT: ('r_addend',
37 // CHECK: # Relocation 0x00000001
38 // CHECK-NEXT: (('r_offset', 0x00000008)
39 // CHECK-NEXT: ('r_sym', 0x00000002)
40 // CHECK-NEXT: ('r_type', 0x0000000b)
41 // CHECK-NEXT: ('r_addend',
43 // CHECK: # Relocation 0x00000002
44 // CHECK-NEXT: (('r_offset', 0x00000013)
45 // CHECK-NEXT: ('r_sym', 0x00000002)
46 // CHECK-NEXT: ('r_type', 0x0000000b)
47 // CHECK-NEXT: ('r_addend',
49 // CHECK: # Relocation 0x00000003
50 // CHECK-NEXT: (('r_offset', 0x0000001a)
51 // CHECK-NEXT: ('r_sym', 0x00000002)
52 // CHECK-NEXT: ('r_type', 0x0000000b)
53 // CHECK-NEXT: ('r_addend',
55 // CHECK: # Relocation 0x00000004
56 // CHECK-NEXT: (('r_offset', 0x00000022)
57 // CHECK-NEXT: ('r_sym', 0x00000002)
58 // CHECK-NEXT: ('r_type', 0x0000000b)
59 // CHECK-NEXT: ('r_addend',
61 // CHECK: # Relocation 0x00000005
62 // CHECK-NEXT: (('r_offset', 0x00000026)
63 // CHECK-NEXT: ('r_sym', 0x00000002)
64 // CHECK-NEXT: ('r_type', 0x0000000a)
65 // CHECK-NEXT: ('r_addend',
67 // CHECK: # Relocation 0x00000006
68 // CHECK-NEXT: (('r_offset', 0x0000002d)
69 // CHECK-NEXT: ('r_sym', 0x00000006)
70 // CHECK-NEXT: ('r_type', 0x00000016)
71 // CHECK-NEXT: ('r_addend', 0xfffffffc)
73 // CHECK: # Relocation 0x00000007
74 // CHECK-NEXT: (('r_offset', 0x00000034)
75 // CHECK-NEXT: ('r_sym', 0x00000006)
76 // CHECK-NEXT: ('r_type', 0x00000013)
77 // CHECK-NEXT: ('r_addend', 0xfffffffc)
79 // CHECK: # Relocation 0x00000008
80 // CHECK-NEXT: (('r_offset', 0x0000003b)
81 // CHECK-NEXT: ('r_sym', 0x00000006)
82 // CHECK-NEXT: ('r_type', 0x00000017)
83 // CHECK-NEXT: ('r_addend', 0x00000000)
85 // CHECK: # Relocation 0x00000009
86 // CHECK-NEXT: (('r_offset', 0x00000042)
87 // CHECK-NEXT: ('r_sym', 0x00000006)
88 // CHECK-NEXT: ('r_type', 0x00000014)
89 // CHECK-NEXT: ('r_addend', 0xfffffffc)
91 // CHECK: # Relocation 0x0000000a
92 // CHECK-NEXT: (('r_offset', 0x00000049)
93 // CHECK-NEXT: ('r_sym', 0x00000006)
94 // CHECK-NEXT: ('r_type', 0x00000015)
95 // CHECK-NEXT: ('r_addend', 0x00000000)
97 // CHECK: # Relocation 0x0000000b
98 // CHECK-NEXT: (('r_offset', 0x0000004e)
99 // CHECK-NEXT: ('r_sym', 0x00000002)
100 // CHECK-NEXT: ('r_type', 0x0000000b)
101 // CHECK-NEXT: ('r_addend', 0x00000000)
103 // CHECK: # Relocation 0x0000000c
104 // CHECK-NEXT: (('r_offset', 0x00000055)
105 // CHECK-NEXT: ('r_sym', 0x00000006)
106 // CHECK-NEXT: ('r_type', 0x00000002)
107 // CHECK-NEXT: ('r_addend', 0xfffffffc)