1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -t | 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 .quad foo@DTPOFF 22 23 // CHECK: Section { 24 // CHECK: Name: .rela.text 25 // CHECK: Relocations [ 26 // CHECK-NEXT: 0x1 R_X86_64_32 .text 27 // CHECK-NEXT: 0x8 R_X86_64_32S .text 28 // CHECK-NEXT: 0x13 R_X86_64_32S .text 29 // CHECK-NEXT: 0x1A R_X86_64_32S .text 30 // CHECK-NEXT: 0x22 R_X86_64_32S .text 31 // CHECK-NEXT: 0x26 R_X86_64_32 .text 32 // CHECK-NEXT: 0x2D R_X86_64_GOTTPOFF foo 0xFFFFFFFFFFFFFFFC 33 // CHECK-NEXT: 0x34 R_X86_64_TLSGD foo 0xFFFFFFFFFFFFFFFC 34 // CHECK-NEXT: 0x3B R_X86_64_TPOFF32 foo 0x0 35 // CHECK-NEXT: 0x42 R_X86_64_TLSLD foo 0xFFFFFFFFFFFFFFFC 36 // CHECK-NEXT: 0x49 R_X86_64_DTPOFF32 foo 0x0 37 // CHECK-NEXT: 0x4E R_X86_64_32S .text 0x0 38 // CHECK-NEXT: 0x55 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC 39 // CHECK-NEXT: 0x5C R_X86_64_PC32 foo 0x5C 40 // CHECK-NEXT: 0x63 R_X86_64_32S .text 0x0 41 // CHECK-NEXT: 0x67 R_X86_64_DTPOFF64 foo 0x0 42 // CHECK-NEXT: ] 43 // CHECK-NEXT: } 44 45 // CHECK: Symbol { 46 // CHECK: Name: .text (0) 47 // CHECK-NEXT: Value: 48 // CHECK-NEXT: Size: 49 // CHECK-NEXT: Binding: Local 50 // CHECK-NEXT: Type: Section 51 // CHECK-NEXT: Other: 0 52 // CHECK-NEXT: Section: .text (0x1) 53 // CHECK-NEXT: } 54