2015-06-03 13:14:22 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr | FileCheck %s
|
2010-09-21 03:20:47 +08:00
|
|
|
|
2010-10-28 04:28:07 +08:00
|
|
|
// Test that we produce the correct relocation.
|
2010-09-21 03:20:47 +08:00
|
|
|
|
2015-04-18 04:05:17 +08:00
|
|
|
|
|
|
|
.section .pr23272,"aGw",@progbits,pr23272,comdat
|
|
|
|
.globl pr23272
|
|
|
|
pr23272:
|
|
|
|
pr23272_2:
|
2015-04-20 20:44:06 +08:00
|
|
|
pr23272_3 = pr23272_2
|
2015-04-18 04:05:17 +08:00
|
|
|
|
|
|
|
.text
|
2010-09-30 11:11:42 +08:00
|
|
|
bar:
|
2010-10-28 04:28:07 +08:00
|
|
|
movl $bar, %edx # R_X86_64_32
|
|
|
|
movq $bar, %rdx # R_X86_64_32S
|
|
|
|
movq $bar, bar(%rip) # R_X86_64_32S
|
|
|
|
movl bar, %edx # R_X86_64_32S
|
|
|
|
movq bar, %rdx # R_X86_64_32S
|
|
|
|
.long bar # R_X86_64_32
|
|
|
|
leaq foo@GOTTPOFF(%rip), %rax # R_X86_64_GOTTPOFF
|
|
|
|
leaq foo@TLSGD(%rip), %rax # R_X86_64_TLSGD
|
|
|
|
leaq foo@TPOFF(%rax), %rax # R_X86_64_TPOFF32
|
2010-10-28 23:02:40 +08:00
|
|
|
leaq foo@TLSLD(%rip), %rdi # R_X86_64_TLSLD
|
2011-01-24 00:11:25 +08:00
|
|
|
leaq foo@dtpoff(%rax), %rcx # R_X86_64_DTPOFF32
|
2013-10-31 02:47:25 +08:00
|
|
|
movabs foo@GOT, %rax # R_X86_64_GOT64
|
|
|
|
movabs foo@GOTOFF, %rax # R_X86_64_GOTOFF64
|
2010-12-17 06:50:01 +08:00
|
|
|
pushq $bar
|
2010-12-27 10:03:24 +08:00
|
|
|
movq foo(%rip), %rdx
|
2011-01-02 03:05:35 +08:00
|
|
|
leaq foo-bar(%r14),%r14
|
2011-05-20 04:32:34 +08:00
|
|
|
addq $bar,%rax # R_X86_64_32S
|
2013-06-28 12:24:32 +08:00
|
|
|
.quad foo@DTPOFF
|
2013-09-22 13:30:16 +08:00
|
|
|
movabsq $baz@TPOFF, %rax
|
2014-01-08 20:58:40 +08:00
|
|
|
.word foo-bar
|
|
|
|
.byte foo-bar
|
2010-09-21 03:20:47 +08:00
|
|
|
|
2014-05-04 03:57:04 +08:00
|
|
|
# this should probably be an error...
|
2014-03-20 10:12:01 +08:00
|
|
|
zed = foo +2
|
|
|
|
call zed@PLT
|
|
|
|
|
2014-04-15 00:50:22 +08:00
|
|
|
leaq -1+foo(%rip), %r11
|
|
|
|
|
2014-04-22 05:15:45 +08:00
|
|
|
movl $_GLOBAL_OFFSET_TABLE_, %eax
|
|
|
|
movabs $_GLOBAL_OFFSET_TABLE_, %rax
|
|
|
|
|
2015-03-04 14:49:39 +08:00
|
|
|
.quad blah@SIZE # R_X86_64_SIZE64
|
|
|
|
.quad blah@SIZE + 32 # R_X86_64_SIZE64
|
|
|
|
.quad blah@SIZE - 32 # R_X86_64_SIZE64
|
|
|
|
movl blah@SIZE, %eax # R_X86_64_SIZE32
|
|
|
|
movl blah@SIZE + 32, %eax # R_X86_64_SIZE32
|
|
|
|
movl blah@SIZE - 32, %eax # R_X86_64_SIZE32
|
|
|
|
|
2015-03-21 03:48:54 +08:00
|
|
|
.long foo@gotpcrel
|
|
|
|
.long foo@plt
|
2015-04-18 04:05:17 +08:00
|
|
|
|
|
|
|
.quad pr23272_2 - pr23272
|
2015-04-20 20:44:06 +08:00
|
|
|
.quad pr23272_3 - pr23272
|
2015-06-06 10:29:56 +08:00
|
|
|
|
|
|
|
.code16
|
|
|
|
call pr23771
|
|
|
|
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Section {
|
2013-05-30 11:05:14 +08:00
|
|
|
// CHECK: Name: .rela.text
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK: Relocations [
|
|
|
|
// CHECK-NEXT: 0x1 R_X86_64_32 .text
|
|
|
|
// CHECK-NEXT: 0x8 R_X86_64_32S .text
|
|
|
|
// CHECK-NEXT: 0x13 R_X86_64_32S .text
|
|
|
|
// CHECK-NEXT: 0x1A R_X86_64_32S .text
|
|
|
|
// CHECK-NEXT: 0x22 R_X86_64_32S .text
|
|
|
|
// CHECK-NEXT: 0x26 R_X86_64_32 .text
|
|
|
|
// CHECK-NEXT: 0x2D R_X86_64_GOTTPOFF foo 0xFFFFFFFFFFFFFFFC
|
|
|
|
// CHECK-NEXT: 0x34 R_X86_64_TLSGD foo 0xFFFFFFFFFFFFFFFC
|
|
|
|
// CHECK-NEXT: 0x3B R_X86_64_TPOFF32 foo 0x0
|
|
|
|
// CHECK-NEXT: 0x42 R_X86_64_TLSLD foo 0xFFFFFFFFFFFFFFFC
|
|
|
|
// CHECK-NEXT: 0x49 R_X86_64_DTPOFF32 foo 0x0
|
2013-10-31 02:47:25 +08:00
|
|
|
// CHECK-NEXT: 0x4F R_X86_64_GOT64 foo 0x0
|
|
|
|
// CHECK-NEXT: 0x59 R_X86_64_GOTOFF64 foo 0x0
|
|
|
|
// CHECK-NEXT: 0x62 R_X86_64_32S .text 0x0
|
|
|
|
// CHECK-NEXT: 0x69 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC
|
|
|
|
// CHECK-NEXT: 0x70 R_X86_64_PC32 foo 0x70
|
|
|
|
// CHECK-NEXT: 0x77 R_X86_64_32S .text 0x0
|
|
|
|
// CHECK-NEXT: 0x7B R_X86_64_DTPOFF64 foo 0x0
|
|
|
|
// CHECK-NEXT: 0x85 R_X86_64_TPOFF64 baz 0x0
|
2014-01-08 20:58:40 +08:00
|
|
|
// CHECK-NEXT: 0x8D R_X86_64_PC16 foo 0x8D
|
|
|
|
// CHECK-NEXT: 0x8F R_X86_64_PC8 foo 0x8F
|
2014-05-04 03:57:04 +08:00
|
|
|
// CHECK-NEXT: 0x91 R_X86_64_PLT32 zed 0xFFFFFFFFFFFFFFFC
|
2014-04-15 00:50:22 +08:00
|
|
|
// CHECK-NEXT: 0x98 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFB
|
2014-04-22 05:15:45 +08:00
|
|
|
// CHECK-NEXT: 0x9D R_X86_64_GOTPC32 _GLOBAL_OFFSET_TABLE_ 0x1
|
|
|
|
// CHECK-NEXT: 0xA3 R_X86_64_GOTPC64 _GLOBAL_OFFSET_TABLE_ 0x2
|
2015-03-04 14:49:39 +08:00
|
|
|
// CHECK-NEXT: 0xAB R_X86_64_SIZE64 blah 0x0
|
|
|
|
// CHECK-NEXT: 0xB3 R_X86_64_SIZE64 blah 0x20
|
|
|
|
// CHECK-NEXT: 0xBB R_X86_64_SIZE64 blah 0xFFFFFFFFFFFFFFE0
|
|
|
|
// CHECK-NEXT: 0xC6 R_X86_64_SIZE32 blah 0x0
|
|
|
|
// CHECK-NEXT: 0xCD R_X86_64_SIZE32 blah 0x20
|
|
|
|
// CHECK-NEXT: 0xD4 R_X86_64_SIZE32 blah 0xFFFFFFFFFFFFFFE0
|
2015-03-21 03:48:54 +08:00
|
|
|
// CHECK-NEXT: 0xD8 R_X86_64_GOTPCREL foo 0x0
|
|
|
|
// CHECK-NEXT: 0xDC R_X86_64_PLT32 foo 0x0
|
2015-06-06 10:29:56 +08:00
|
|
|
// CHECK-NEXT: 0xF1 R_X86_64_PC16 pr23771 0xFFFFFFFFFFFFFFFE
|
2013-04-12 12:06:46 +08:00
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: }
|