xref: /minix/external/bsd/llvm/dist/llvm/test/MC/ELF/merge.s (revision 83133719)
1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -r | FileCheck  %s
2
3// Test that PIC relocations with local symbols in a mergeable section are done
4// with a reference to the symbol. Not sure if this is a linker limitation,
5// but this matches the behavior of gas.
6
7// Non-PIC relocations with 0 offset don't use the symbol.
8
9
10        movsd   .Lfoo(%rip), %xmm1
11        movl	$.Lfoo, %edi
12        movl	$.Lfoo+2, %edi
13        jmp	foo@PLT
14        movq 	foo@GOTPCREL, %rax
15        movq    zed, %rax
16
17        .section        .sec1,"aM",@progbits,16
18.Lfoo:
19zed:
20        .global zed
21
22        .section	bar,"ax",@progbits
23foo:
24
25// CHECK:      Relocations [
26// CHECK-NEXT:   Section (2) .rela.text {
27// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_PC32    .Lfoo 0x{{[^ ]+}}
28// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32      .sec1 0x{{[^ ]+}}
29// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32      .Lfoo 0x{{[^ ]+}}
30// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_PLT32    foo  0x{{[^ ]+}}
31// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_GOTPCREL foo  0x{{[^ ]+}}
32// CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32S      zed  0x{{[^ ]+}}
33// CHECK-NEXT:   }
34// CHECK-NEXT: ]
35