1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s 2 3 // Test that we produce the correct relocation. 4 5 bar: 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 17 pushq $bar 18 movq foo(%rip), %rdx 19 leaq foo-bar(%r14),%r14 20 addq $bar,%rax # R_X86_64_32S 21 22 23 // CHECK: # Section 1 24 // CHECK: (('sh_name', 0x00000006) # '.text' 25 26 // CHECK: # Relocation 0 27 // CHECK-NEXT: (('r_offset', 0x0000000000000001) 28 // CHECK-NEXT: ('r_sym', 0x00000002) 29 // CHECK-NEXT: ('r_type', 0x0000000a) 30 // CHECK-NEXT: ('r_addend', 31 32 // CHECK: # Relocation 1 33 // CHECK-NEXT: (('r_offset', 0x0000000000000008) 34 // CHECK-NEXT: ('r_sym', 0x00000002) 35 // CHECK-NEXT: ('r_type', 0x0000000b) 36 // CHECK-NEXT: ('r_addend', 37 38 // CHECK: # Relocation 2 39 // CHECK-NEXT: (('r_offset', 0x0000000000000013) 40 // CHECK-NEXT: ('r_sym', 0x00000002) 41 // CHECK-NEXT: ('r_type', 0x0000000b) 42 // CHECK-NEXT: ('r_addend', 43 44 // CHECK: # Relocation 3 45 // CHECK-NEXT: (('r_offset', 0x000000000000001a) 46 // CHECK-NEXT: ('r_sym', 0x00000002) 47 // CHECK-NEXT: ('r_type', 0x0000000b) 48 // CHECK-NEXT: ('r_addend', 49 50 // CHECK: # Relocation 4 51 // CHECK-NEXT: (('r_offset', 0x0000000000000022) 52 // CHECK-NEXT: ('r_sym', 0x00000002) 53 // CHECK-NEXT: ('r_type', 0x0000000b) 54 // CHECK-NEXT: ('r_addend', 55 56 // CHECK: # Relocation 5 57 // CHECK-NEXT: (('r_offset', 0x0000000000000026) 58 // CHECK-NEXT: ('r_sym', 0x00000002) 59 // CHECK-NEXT: ('r_type', 0x0000000a) 60 // CHECK-NEXT: ('r_addend', 61 62 // CHECK: # Relocation 6 63 // CHECK-NEXT: (('r_offset', 0x000000000000002d) 64 // CHECK-NEXT: ('r_sym', 0x00000006) 65 // CHECK-NEXT: ('r_type', 0x00000016) 66 // CHECK-NEXT: ('r_addend', 0xfffffffffffffffc) 67 68 // CHECK: # Relocation 7 69 // CHECK-NEXT: (('r_offset', 0x0000000000000034) 70 // CHECK-NEXT: ('r_sym', 0x00000006) 71 // CHECK-NEXT: ('r_type', 0x00000013) 72 // CHECK-NEXT: ('r_addend', 0xfffffffffffffffc) 73 74 // CHECK: # Relocation 8 75 // CHECK-NEXT: (('r_offset', 0x000000000000003b) 76 // CHECK-NEXT: ('r_sym', 0x00000006) 77 // CHECK-NEXT: ('r_type', 0x00000017) 78 // CHECK-NEXT: ('r_addend', 0x0000000000000000) 79 80 // CHECK: # Relocation 9 81 // CHECK-NEXT: (('r_offset', 0x0000000000000042) 82 // CHECK-NEXT: ('r_sym', 0x00000006) 83 // CHECK-NEXT: ('r_type', 0x00000014) 84 // CHECK-NEXT: ('r_addend', 0xfffffffffffffffc) 85 86 // CHECK: # Relocation 10 87 // CHECK-NEXT: (('r_offset', 0x0000000000000049) 88 // CHECK-NEXT: ('r_sym', 0x00000006) 89 // CHECK-NEXT: ('r_type', 0x00000015) 90 // CHECK-NEXT: ('r_addend', 0x0000000000000000) 91 92 // CHECK: # Relocation 11 93 // CHECK-NEXT: (('r_offset', 0x000000000000004e) 94 // CHECK-NEXT: ('r_sym', 0x00000002) 95 // CHECK-NEXT: ('r_type', 0x0000000b) 96 // CHECK-NEXT: ('r_addend', 0x0000000000000000) 97 98 // CHECK: # Relocation 12 99 // CHECK-NEXT: (('r_offset', 0x0000000000000055) 100 // CHECK-NEXT: ('r_sym', 0x00000006) 101 // CHECK-NEXT: ('r_type', 0x00000002) 102 // CHECK-NEXT: ('r_addend', 0xfffffffffffffffc) 103 104 // CHECK: # Relocation 13 105 // CHECK-NEXT: (('r_offset', 0x000000000000005c) 106 // CHECK-NEXT: ('r_sym', 0x00000006) 107 // CHECK-NEXT: ('r_type', 0x00000002) 108 // CHECK-NEXT: ('r_addend', 0x000000000000005c) 109 110 // CHECK: # Relocation 14 111 // CHECK-NEXT: (('r_offset', 0x0000000000000063) 112 // CHECK-NEXT: ('r_sym', 0x00000002) 113 // CHECK-NEXT: ('r_type', 0x0000000b) 114 // CHECK-NEXT: ('r_addend', 0x0000000000000000) 115 116 // CHECK: # Symbol 2 117 // CHECK: (('st_name', 0x00000000) # '' 118 // CHECK: ('st_bind', 0x0) 119 // CHECK: ('st_type', 0x3) 120 // CHECK: ('st_other', 0x00) 121 // CHECK: ('st_shndx', 0x0001) 122