2013-04-12 06:06:46 +02:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -r | FileCheck %s
|
2010-09-25 07:42:19 +02:00
|
|
|
|
2010-10-05 17:43:32 +02:00
|
|
|
// Test that PIC relocations with local symbols in a mergeable section are done
|
2010-09-25 07:42:19 +02:00
|
|
|
// with a reference to the symbol. Not sure if this is a linker limitation,
|
|
|
|
// but this matches the behavior of gas.
|
|
|
|
|
2010-10-05 17:43:32 +02:00
|
|
|
// Non-PIC relocations with 0 offset don't use the symbol.
|
|
|
|
|
|
|
|
|
|
|
|
movsd .Lfoo(%rip), %xmm1
|
|
|
|
movl $.Lfoo, %edi
|
|
|
|
movl $.Lfoo+2, %edi
|
2010-10-06 01:57:26 +02:00
|
|
|
jmp foo@PLT
|
2010-10-06 18:23:36 +02:00
|
|
|
movq foo@GOTPCREL, %rax
|
2010-10-06 21:27:21 +02:00
|
|
|
movq zed, %rax
|
2010-10-05 17:43:32 +02:00
|
|
|
|
2010-09-25 07:42:19 +02:00
|
|
|
.section .sec1,"aM",@progbits,16
|
|
|
|
.Lfoo:
|
2010-10-06 21:27:21 +02:00
|
|
|
zed:
|
|
|
|
.global zed
|
2010-09-25 07:42:19 +02:00
|
|
|
|
2010-10-06 01:57:26 +02:00
|
|
|
.section bar,"ax",@progbits
|
|
|
|
foo:
|
|
|
|
|
2013-04-12 06:06:46 +02:00
|
|
|
// CHECK: Relocations [
|
2013-05-30 05:05:14 +02:00
|
|
|
// CHECK-NEXT: Section (2) .rela.text {
|
2013-04-12 06:06:46 +02:00
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_PC32 .Lfoo 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32 .sec1 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32 .Lfoo 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_PLT32 foo 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_GOTPCREL foo 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32S zed 0x{{[^ ]+}}
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|