1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S --sr - | FileCheck %s 2// RUN: not llvm-mc -filetype=obj -triple x86_64 --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error: 3 4// Test that we produce the correct relocation. 5 6 7 .section .pr23272,"awG",@progbits,pr23272,comdat 8 .globl pr23272 9pr23272: 10pr23272_2: 11pr23272_3 = pr23272_2 12 13 .text 14bar: 15 movl $bar, %edx # R_X86_64_32 16 movq $bar, %rdx # R_X86_64_32S 17 movq $bar, bar(%rip) # R_X86_64_32S 18 movl bar, %edx # R_X86_64_32S 19 movq bar, %rdx # R_X86_64_32S 20.long bar # R_X86_64_32 21 movabs $0, %rax 22 movabs $0, %rax 23 pushq $bar 24 movq foo(%rip), %rdx 25 leaq foo-bar(%r14),%r14 26 addq $bar,%rax # R_X86_64_32S 27 .word foo-bar 28 .byte foo-bar 29 call foo 30 31 leaq -1+foo(%rip), %r11 32 33 leaq _GLOBAL_OFFSET_TABLE_(%rax), %r15 34 leaq _GLOBAL_OFFSET_TABLE_(%rip), %r15 35 movl $_GLOBAL_OFFSET_TABLE_, %eax 36 movabs $_GLOBAL_OFFSET_TABLE_, %rax 37 38 .long foo@gotpcrel 39 .long foo@plt 40 41 .quad pr23272_2 - pr23272 42 .quad pr23272_3 - pr23272 43 44 .global pr24486 45pr24486: 46 pr24486_alias = pr24486 47 .long pr24486_alias 48 49 .code16 50 call pr23771 51 52 .weak weak_sym 53weak_sym: 54 .long pr23272-weak_sym 55 56// CHECK: Section { 57// CHECK: Name: .rela.text 58// CHECK: Relocations [ 59// CHECK-NEXT: 0x1 R_X86_64_32 .text 0x0 60// CHECK-NEXT: 0x8 R_X86_64_32S .text 0x0 61// CHECK-NEXT: 0x13 R_X86_64_32S .text 0x0 62// CHECK-NEXT: 0x1A R_X86_64_32S .text 0x0 63// CHECK-NEXT: 0x22 R_X86_64_32S .text 0x0 64// CHECK-NEXT: 0x26 R_X86_64_32 .text 0x0 65// CHECK-NEXT: 0x3F R_X86_64_32S .text 0x0 66// CHECK-NEXT: 0x46 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC 67// CHECK-NEXT: 0x4D R_X86_64_PC32 foo 0x4D 68// CHECK-NEXT: 0x54 R_X86_64_32S .text 0x0 69// CHECK-NEXT: 0x58 R_X86_64_PC16 foo 0x58 70// CHECK-NEXT: 0x5A R_X86_64_PC8 foo 0x5A 71// CHECK-NEXT: 0x5C R_X86_64_PLT32 foo 0xFFFFFFFFFFFFFFFC 72// CHECK-NEXT: 0x63 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFB 73// CHECK-NEXT: 0x6A R_X86_64_GOTPC32 _GLOBAL_OFFSET_TABLE_ 0x3 74// CHECK-NEXT: 0x71 R_X86_64_GOTPC32 _GLOBAL_OFFSET_TABLE_ 0xFFFFFFFFFFFFFFFC 75// CHECK-NEXT: 0x76 R_X86_64_GOTPC32 _GLOBAL_OFFSET_TABLE_ 0x1 76// CHECK-NEXT: 0x7C R_X86_64_GOTPC64 _GLOBAL_OFFSET_TABLE_ 0x2 77// CHECK-NEXT: 0x84 R_X86_64_GOTPCREL foo 0x0 78// CHECK-NEXT: 0x88 R_X86_64_PLT32 foo 0x0 79// CHECK-NEXT: 0x9C R_X86_64_32 .text 0x9C 80// CHECK-NEXT: 0xA1 R_X86_64_PC16 pr23771 0xFFFFFFFFFFFFFFFE 81// CHECK-NEXT: 0xA3 R_X86_64_PC32 pr23272 0x0 82// CHECK-NEXT: ] 83// CHECK-NEXT: } 84 85.ifdef ERR 86// ERR: [[#@LINE+1]]:7: error: unsupported relocation type 87.long foo@gotoff 88.endif 89