2 # RUN: llvm-mc -filetype=obj -relax-relocations -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: 0x203248
15 ## 2105751 = 0x202197 (bar)
16 # DISASM: Disassembly of section .text:
18 # DISASM-NEXT: <_start>:
19 # DISASM-NEXT: 2011c8: adcl {{.*}}(%rip), %eax # 0x202240
20 # DISASM-NEXT: addl {{.*}}(%rip), %ebx # 0x202240
21 # DISASM-NEXT: andl {{.*}}(%rip), %ecx # 0x202240
22 # DISASM-NEXT: cmpl {{.*}}(%rip), %edx # 0x202240
23 # DISASM-NEXT: orl {{.*}}(%rip), %edi # 0x202240
24 # DISASM-NEXT: sbbl {{.*}}(%rip), %esi # 0x202240
25 # DISASM-NEXT: subl {{.*}}(%rip), %ebp # 0x202240
26 # DISASM-NEXT: xorl $0x203248, %r8d
27 # DISASM-NEXT: testl $0x203248, %r15d
28 # DISASM-NEXT: 201200: adcq $0x203248, %rax
29 # DISASM-NEXT: addq $0x203248, %rbx
30 # DISASM-NEXT: andq $0x203248, %rcx
31 # DISASM-NEXT: cmpq $0x203248, %rdx
32 # DISASM-NEXT: orq $0x203248, %rdi
33 # DISASM-NEXT: sbbq $0x203248, %rsi
34 # DISASM-NEXT: subq $0x203248, %rbp
35 # DISASM-NEXT: xorq $0x203248, %r8
36 # DISASM-NEXT: testq $0x203248, %r15
38 # RUN: ld.lld --hash-style=sysv -shared %t.o -o %t2
39 # RUN: llvm-readobj -S -r -d %t2 | FileCheck --check-prefix=SEC-PIC %s
40 # RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck --check-prefix=DISASM-PIC %s
44 # SEC-PIC-NEXT: Type: SHT_PROGBITS
45 # SEC-PIC-NEXT: Flags [
46 # SEC-PIC-NEXT: SHF_ALLOC
47 # SEC-PIC-NEXT: SHF_WRITE
49 # SEC-PIC-NEXT: Address: 0x2380
50 # SEC-PIC-NEXT: Offset: 0x380
51 # SEC-PIC-NEXT: Size: 8
54 # SEC-PIC-NEXT: AddressAlignment:
55 # SEC-PIC-NEXT: EntrySize:
57 # SEC-PIC: 0x000000006FFFFFF9 RELACOUNT 1
58 # SEC-PIC: Relocations [
59 # SEC-PIC-NEXT: Section ({{.*}}) .rela.dyn {
60 # SEC-PIC-NEXT: 0x2380 R_X86_64_RELATIVE - 0x3388
64 ## Check that there was no relaxation performed. All values refer to got entry.
65 # DISASM-PIC: Disassembly of section .text:
67 # DISASM-PIC-NEXT: <_start>:
68 # DISASM-PIC-NEXT: 1268: adcl {{.*}}(%rip), %eax # 0x2380
69 # DISASM-PIC-NEXT: addl {{.*}}(%rip), %ebx # 0x2380
70 # DISASM-PIC-NEXT: andl {{.*}}(%rip), %ecx # 0x2380
71 # DISASM-PIC-NEXT: cmpl {{.*}}(%rip), %edx # 0x2380
72 # DISASM-PIC-NEXT: orl {{.*}}(%rip), %edi # 0x2380
73 # DISASM-PIC-NEXT: sbbl {{.*}}(%rip), %esi # 0x2380
74 # DISASM-PIC-NEXT: subl {{.*}}(%rip), %ebp # 0x2380
75 # DISASM-PIC-NEXT: xorl {{.*}}(%rip), %r8d # 0x2380
76 # DISASM-PIC-NEXT: testl %r15d, {{.*}}(%rip) # 0x2380
77 # DISASM-PIC-NEXT: 12a0: adcq {{.*}}(%rip), %rax # 0x2380
78 # DISASM-PIC-NEXT: addq {{.*}}(%rip), %rbx # 0x2380
79 # DISASM-PIC-NEXT: andq {{.*}}(%rip), %rcx # 0x2380
80 # DISASM-PIC-NEXT: cmpq {{.*}}(%rip), %rdx # 0x2380
81 # DISASM-PIC-NEXT: orq {{.*}}(%rip), %rdi # 0x2380
82 # DISASM-PIC-NEXT: sbbq {{.*}}(%rip), %rsi # 0x2380
83 # DISASM-PIC-NEXT: subq {{.*}}(%rip), %rbp # 0x2380
84 # DISASM-PIC-NEXT: xorq {{.*}}(%rip), %r8 # 0x2380
85 # DISASM-PIC-NEXT: testq %r15, {{.*}}(%rip) # 0x2380
95 .type _start, @function
98 adcl bar@GOTPCREL
(%rip
), %eax
99 addl bar@GOTPCREL
(%rip
), %ebx
100 andl bar@GOTPCREL
(%rip
), %ecx
101 cmpl bar@GOTPCREL
(%rip
), %edx
102 orl bar@GOTPCREL
(%rip
), %edi
103 sbbl bar@GOTPCREL
(%rip
), %esi
104 subl bar@GOTPCREL
(%rip
), %ebp
105 xorl bar@GOTPCREL
(%rip
), %r8d
106 testl
%r15d
, bar@GOTPCREL
(%rip
)
108 ## R_X86_64_REX_GOTPCRELX
109 adcq bar@GOTPCREL
(%rip
), %rax
110 addq bar@GOTPCREL
(%rip
), %rbx
111 andq bar@GOTPCREL
(%rip
), %rcx
112 cmpq bar@GOTPCREL
(%rip
), %rdx
113 orq bar@GOTPCREL
(%rip
), %rdi
114 sbbq bar@GOTPCREL
(%rip
), %rsi
115 subq bar@GOTPCREL
(%rip
), %rbp
116 xorq bar@GOTPCREL
(%rip
), %r8
117 testq
%r15, bar@GOTPCREL
(%rip
)