2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: ld.lld %t.o -o %t1
4 # RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s
5 # RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefix=DISASM %s
7 ## There is no relocations.
8 # SYMRELOC: Relocations [
13 # SYMRELOC-NEXT: Value: 0x203290
15 ## 2105751 = 0x202197 (bar)
16 # DISASM: Disassembly of section .text:
18 # DISASM-NEXT: <_start>:
19 # DISASM-NEXT: 2011c8: adcl {{.*}}(%rip), %eax # 0x202288
20 # DISASM-NEXT: addl {{.*}}(%rip), %ebx # 0x202288
21 # DISASM-NEXT: andl {{.*}}(%rip), %ecx # 0x202288
22 # DISASM-NEXT: cmpl {{.*}}(%rip), %edx # 0x202288
23 # DISASM-NEXT: orl {{.*}}(%rip), %edi # 0x202288
24 # DISASM-NEXT: sbbl {{.*}}(%rip), %esi # 0x202288
25 # DISASM-NEXT: subl {{.*}}(%rip), %ebp # 0x202288
26 # DISASM-NEXT: xorl $0x203290, %r8d
27 # DISASM-NEXT: testl $0x203290, %r15d
28 # DISASM-NEXT: 201200: adcq $0x203290, %rax
29 # DISASM-NEXT: addq $0x203290, %rbx
30 # DISASM-NEXT: andq $0x203290, %rcx
31 # DISASM-NEXT: cmpq $0x203290, %rdx
32 # DISASM-NEXT: orq $0x203290, %rdi
33 # DISASM-NEXT: sbbq $0x203290, %rsi
34 # DISASM-NEXT: subq $0x203290, %rbp
35 # DISASM-NEXT: xorq $0x203290, %r8
36 # DISASM-NEXT: testq $0x203290, %r15
37 # DISASM-NEXT: 20123f: adcq $0x203290, %r16
38 # DISASM-NEXT: addq $0x203290, %r17
39 # DISASM-NEXT: andq $0x203290, %r18
40 # DISASM-NEXT: cmpq $0x203290, %r19
41 # DISASM-NEXT: orq $0x203290, %r20
42 # DISASM-NEXT: sbbq $0x203290, %r21
43 # DISASM-NEXT: subq $0x203290, %r22
44 # DISASM-NEXT: xorq $0x203290, %r23
45 # DISASM-NEXT: testq $0x203290, %r24
47 # RUN: ld.lld --hash-style=sysv -shared %t.o -o %t2
48 # RUN: llvm-readobj -S -r -d %t2 | FileCheck --check-prefix=SEC-PIC %s
49 # RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck --check-prefix=DISASM-PIC %s
53 # SEC-PIC-NEXT: Type: SHT_PROGBITS
54 # SEC-PIC-NEXT: Flags [
55 # SEC-PIC-NEXT: SHF_ALLOC
56 # SEC-PIC-NEXT: SHF_WRITE
58 # SEC-PIC-NEXT: Address: 0x23C8
59 # SEC-PIC-NEXT: Offset: 0x3C8
60 # SEC-PIC-NEXT: Size: 8
63 # SEC-PIC-NEXT: AddressAlignment:
64 # SEC-PIC-NEXT: EntrySize:
66 # SEC-PIC: 0x000000006FFFFFF9 RELACOUNT 1
67 # SEC-PIC: Relocations [
68 # SEC-PIC-NEXT: Section ({{.*}}) .rela.dyn {
69 # SEC-PIC-NEXT: 0x23C8 R_X86_64_RELATIVE - 0x33D0
73 ## Check that there was no relaxation performed. All values refer to got entry.
74 # DISASM-PIC: Disassembly of section .text:
76 # DISASM-PIC-NEXT: <_start>:
77 # DISASM-PIC-NEXT: 1268: adcl {{.*}}(%rip), %eax # 0x23c8
78 # DISASM-PIC-NEXT: addl {{.*}}(%rip), %ebx # 0x23c8
79 # DISASM-PIC-NEXT: andl {{.*}}(%rip), %ecx # 0x23c8
80 # DISASM-PIC-NEXT: cmpl {{.*}}(%rip), %edx # 0x23c8
81 # DISASM-PIC-NEXT: orl {{.*}}(%rip), %edi # 0x23c8
82 # DISASM-PIC-NEXT: sbbl {{.*}}(%rip), %esi # 0x23c8
83 # DISASM-PIC-NEXT: subl {{.*}}(%rip), %ebp # 0x23c8
84 # DISASM-PIC-NEXT: xorl {{.*}}(%rip), %r8d # 0x23c8
85 # DISASM-PIC-NEXT: testl %r15d, {{.*}}(%rip) # 0x23c8
86 # DISASM-PIC-NEXT: 12a0: adcq {{.*}}(%rip), %rax # 0x23c8
87 # DISASM-PIC-NEXT: addq {{.*}}(%rip), %rbx # 0x23c8
88 # DISASM-PIC-NEXT: andq {{.*}}(%rip), %rcx # 0x23c8
89 # DISASM-PIC-NEXT: cmpq {{.*}}(%rip), %rdx # 0x23c8
90 # DISASM-PIC-NEXT: orq {{.*}}(%rip), %rdi # 0x23c8
91 # DISASM-PIC-NEXT: sbbq {{.*}}(%rip), %rsi # 0x23c8
92 # DISASM-PIC-NEXT: subq {{.*}}(%rip), %rbp # 0x23c8
93 # DISASM-PIC-NEXT: xorq {{.*}}(%rip), %r8 # 0x23c8
94 # DISASM-PIC-NEXT: testq %r15, {{.*}}(%rip) # 0x23c8
95 # DISASM-PIC-NEXT: 12df: adcq {{.*}}(%rip), %r16 # 0x23c8
96 # DISASM-PIC-NEXT: addq {{.*}}(%rip), %r17 # 0x23c8
97 # DISASM-PIC-NEXT: andq {{.*}}(%rip), %r18 # 0x23c8
98 # DISASM-PIC-NEXT: cmpq {{.*}}(%rip), %r19 # 0x23c8
99 # DISASM-PIC-NEXT: orq {{.*}}(%rip), %r20 # 0x23c8
100 # DISASM-PIC-NEXT: sbbq {{.*}}(%rip), %r21 # 0x23c8
101 # DISASM-PIC-NEXT: subq {{.*}}(%rip), %r22 # 0x23c8
102 # DISASM-PIC-NEXT: xorq {{.*}}(%rip), %r23 # 0x23c8
103 # DISASM-PIC-NEXT: testq %r24, {{.*}}(%rip) # 0x23c8
113 .type _start, @function
115 ## R_X86_64_GOTPCRELX
116 adcl bar@GOTPCREL
(%rip
), %eax
117 addl bar@GOTPCREL
(%rip
), %ebx
118 andl bar@GOTPCREL
(%rip
), %ecx
119 cmpl bar@GOTPCREL
(%rip
), %edx
120 orl bar@GOTPCREL
(%rip
), %edi
121 sbbl bar@GOTPCREL
(%rip
), %esi
122 subl bar@GOTPCREL
(%rip
), %ebp
123 xorl bar@GOTPCREL
(%rip
), %r8d
124 testl
%r15d
, bar@GOTPCREL
(%rip
)
126 ## R_X86_64_REX_GOTPCRELX
127 adcq bar@GOTPCREL
(%rip
), %rax
128 addq bar@GOTPCREL
(%rip
), %rbx
129 andq bar@GOTPCREL
(%rip
), %rcx
130 cmpq bar@GOTPCREL
(%rip
), %rdx
131 orq bar@GOTPCREL
(%rip
), %rdi
132 sbbq bar@GOTPCREL
(%rip
), %rsi
133 subq bar@GOTPCREL
(%rip
), %rbp
134 xorq bar@GOTPCREL
(%rip
), %r8
135 testq
%r15, bar@GOTPCREL
(%rip
)
137 ## R_X86_64_CODE_4_GOTPCRELX
138 adcq bar@GOTPCREL
(%rip
), %r16
139 addq bar@GOTPCREL
(%rip
), %r17
140 andq bar@GOTPCREL
(%rip
), %r18
141 cmpq bar@GOTPCREL
(%rip
), %r19
142 orq bar@GOTPCREL
(%rip
), %r20
143 sbbq bar@GOTPCREL
(%rip
), %r21
144 subq bar@GOTPCREL
(%rip
), %r22
145 xorq bar@GOTPCREL
(%rip
), %r23
146 testq
%r24, bar@GOTPCREL
(%rip
)