147 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o3# RUN: ld.lld %t.o -o %t14# RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s5# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefix=DISASM %s6 7## There is no relocations.8# SYMRELOC: Relocations [9# SYMRELOC-NEXT: ]10# SYMRELOC: Symbols [11# SYMRELOC: Symbol {12# SYMRELOC: Name: bar13# SYMRELOC-NEXT: Value: 0x20329014 15## 2105751 = 0x202197 (bar)16# DISASM: Disassembly of section .text:17# DISASM-EMPTY:18# DISASM-NEXT: <_start>:19# DISASM-NEXT: 2011c8: adcl {{.*}}(%rip), %eax # 0x20228820# DISASM-NEXT: addl {{.*}}(%rip), %ebx # 0x20228821# DISASM-NEXT: andl {{.*}}(%rip), %ecx # 0x20228822# DISASM-NEXT: cmpl {{.*}}(%rip), %edx # 0x20228823# DISASM-NEXT: orl {{.*}}(%rip), %edi # 0x20228824# DISASM-NEXT: sbbl {{.*}}(%rip), %esi # 0x20228825# DISASM-NEXT: subl {{.*}}(%rip), %ebp # 0x20228826# DISASM-NEXT: xorl $0x203290, %r8d27# DISASM-NEXT: testl $0x203290, %r15d28# DISASM-NEXT: 201200: adcq $0x203290, %rax29# DISASM-NEXT: addq $0x203290, %rbx30# DISASM-NEXT: andq $0x203290, %rcx31# DISASM-NEXT: cmpq $0x203290, %rdx32# DISASM-NEXT: orq $0x203290, %rdi33# DISASM-NEXT: sbbq $0x203290, %rsi34# DISASM-NEXT: subq $0x203290, %rbp35# DISASM-NEXT: xorq $0x203290, %r836# DISASM-NEXT: testq $0x203290, %r1537# DISASM-NEXT: 20123f: adcq $0x203290, %r1638# DISASM-NEXT: addq $0x203290, %r1739# DISASM-NEXT: andq $0x203290, %r1840# DISASM-NEXT: cmpq $0x203290, %r1941# DISASM-NEXT: orq $0x203290, %r2042# DISASM-NEXT: sbbq $0x203290, %r2143# DISASM-NEXT: subq $0x203290, %r2244# DISASM-NEXT: xorq $0x203290, %r2345# DISASM-NEXT: testq $0x203290, %r2446 47# RUN: ld.lld --hash-style=sysv -shared %t.o -o %t248# RUN: llvm-readobj -S -r -d %t2 | FileCheck --check-prefix=SEC-PIC %s49# RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck --check-prefix=DISASM-PIC %s50# SEC-PIC: Section {51# SEC-PIC: Index:52# SEC-PIC: Name: .got53# SEC-PIC-NEXT: Type: SHT_PROGBITS54# SEC-PIC-NEXT: Flags [55# SEC-PIC-NEXT: SHF_ALLOC56# SEC-PIC-NEXT: SHF_WRITE57# SEC-PIC-NEXT: ]58# SEC-PIC-NEXT: Address: 0x23C859# SEC-PIC-NEXT: Offset: 0x3C860# SEC-PIC-NEXT: Size: 861# SEC-PIC-NEXT: Link:62# SEC-PIC-NEXT: Info:63# SEC-PIC-NEXT: AddressAlignment:64# SEC-PIC-NEXT: EntrySize:65# SEC-PIC-NEXT: }66# SEC-PIC: 0x000000006FFFFFF9 RELACOUNT 167# SEC-PIC: Relocations [68# SEC-PIC-NEXT: Section ({{.*}}) .rela.dyn {69# SEC-PIC-NEXT: 0x23C8 R_X86_64_RELATIVE - 0x33D070# SEC-PIC-NEXT: }71# SEC-PIC-NEXT: ]72 73## Check that there was no relaxation performed. All values refer to got entry.74# DISASM-PIC: Disassembly of section .text:75# DISASM-PIC-EMPTY:76# DISASM-PIC-NEXT: <_start>:77# DISASM-PIC-NEXT: 1268: adcl {{.*}}(%rip), %eax # 0x23c878# DISASM-PIC-NEXT: addl {{.*}}(%rip), %ebx # 0x23c879# DISASM-PIC-NEXT: andl {{.*}}(%rip), %ecx # 0x23c880# DISASM-PIC-NEXT: cmpl {{.*}}(%rip), %edx # 0x23c881# DISASM-PIC-NEXT: orl {{.*}}(%rip), %edi # 0x23c882# DISASM-PIC-NEXT: sbbl {{.*}}(%rip), %esi # 0x23c883# DISASM-PIC-NEXT: subl {{.*}}(%rip), %ebp # 0x23c884# DISASM-PIC-NEXT: xorl {{.*}}(%rip), %r8d # 0x23c885# DISASM-PIC-NEXT: testl %r15d, {{.*}}(%rip) # 0x23c886# DISASM-PIC-NEXT: 12a0: adcq {{.*}}(%rip), %rax # 0x23c887# DISASM-PIC-NEXT: addq {{.*}}(%rip), %rbx # 0x23c888# DISASM-PIC-NEXT: andq {{.*}}(%rip), %rcx # 0x23c889# DISASM-PIC-NEXT: cmpq {{.*}}(%rip), %rdx # 0x23c890# DISASM-PIC-NEXT: orq {{.*}}(%rip), %rdi # 0x23c891# DISASM-PIC-NEXT: sbbq {{.*}}(%rip), %rsi # 0x23c892# DISASM-PIC-NEXT: subq {{.*}}(%rip), %rbp # 0x23c893# DISASM-PIC-NEXT: xorq {{.*}}(%rip), %r8 # 0x23c894# DISASM-PIC-NEXT: testq %r15, {{.*}}(%rip) # 0x23c895# DISASM-PIC-NEXT: 12df: adcq {{.*}}(%rip), %r16 # 0x23c896# DISASM-PIC-NEXT: addq {{.*}}(%rip), %r17 # 0x23c897# DISASM-PIC-NEXT: andq {{.*}}(%rip), %r18 # 0x23c898# DISASM-PIC-NEXT: cmpq {{.*}}(%rip), %r19 # 0x23c899# DISASM-PIC-NEXT: orq {{.*}}(%rip), %r20 # 0x23c8100# DISASM-PIC-NEXT: sbbq {{.*}}(%rip), %r21 # 0x23c8101# DISASM-PIC-NEXT: subq {{.*}}(%rip), %r22 # 0x23c8102# DISASM-PIC-NEXT: xorq {{.*}}(%rip), %r23 # 0x23c8103# DISASM-PIC-NEXT: testq %r24, {{.*}}(%rip) # 0x23c8104 105.data106.type bar, @object107bar:108 .byte 1109 .size bar, .-bar110 111.text112.globl _start113.type _start, @function114_start:115## R_X86_64_GOTPCRELX116 adcl bar@GOTPCREL(%rip), %eax117 addl bar@GOTPCREL(%rip), %ebx118 andl bar@GOTPCREL(%rip), %ecx119 cmpl bar@GOTPCREL(%rip), %edx120 orl bar@GOTPCREL(%rip), %edi121 sbbl bar@GOTPCREL(%rip), %esi122 subl bar@GOTPCREL(%rip), %ebp123 xorl bar@GOTPCREL(%rip), %r8d124 testl %r15d, bar@GOTPCREL(%rip)125 126## R_X86_64_REX_GOTPCRELX127 adcq bar@GOTPCREL(%rip), %rax128 addq bar@GOTPCREL(%rip), %rbx129 andq bar@GOTPCREL(%rip), %rcx130 cmpq bar@GOTPCREL(%rip), %rdx131 orq bar@GOTPCREL(%rip), %rdi132 sbbq bar@GOTPCREL(%rip), %rsi133 subq bar@GOTPCREL(%rip), %rbp134 xorq bar@GOTPCREL(%rip), %r8135 testq %r15, bar@GOTPCREL(%rip)136 137## R_X86_64_CODE_4_GOTPCRELX138 adcq bar@GOTPCREL(%rip), %r16139 addq bar@GOTPCREL(%rip), %r17140 andq bar@GOTPCREL(%rip), %r18141 cmpq bar@GOTPCREL(%rip), %r19142 orq bar@GOTPCREL(%rip), %r20143 sbbq bar@GOTPCREL(%rip), %r21144 subq bar@GOTPCREL(%rip), %r22145 xorq bar@GOTPCREL(%rip), %r23146 testq %r24, bar@GOTPCREL(%rip)147