aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-x86-64/pr20800a.S17
-rw-r--r--ld/testsuite/ld-x86-64/pr20800b.S21
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp8
3 files changed, 46 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr20800a.S b/ld/testsuite/ld-x86-64/pr20800a.S
new file mode 100644
index 0000000..c4bcd80
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr20800a.S
@@ -0,0 +1,17 @@
+ .text
+ .globl main
+ .type main, @function
+main:
+.L2:
+ leaq .L2(%rip), %rax
+ movabsq $_GLOBAL_OFFSET_TABLE_-.L2, %r11
+ movabsq $bar@PLTOFF, %rdx
+ pushq %r15
+ addq %r11, %rax
+ movq %rax, %r15
+ addq %rax, %rdx
+ call *%rdx
+ xorl %eax, %eax
+ popq %r15
+ ret
+ .size main, .-main
diff --git a/ld/testsuite/ld-x86-64/pr20800b.S b/ld/testsuite/ld-x86-64/pr20800b.S
new file mode 100644
index 0000000..c4eeb4f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr20800b.S
@@ -0,0 +1,21 @@
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "PASS\n"
+ .text
+ .globl bar
+ .type bar, @function
+bar:
+.L2:
+ leaq .L2(%rip), %rdx
+ movabsq $_GLOBAL_OFFSET_TABLE_-.L2, %r11
+ movabsq $.LC0@GOTOFF, %rax
+ pushq %r15
+ movabsq $printf@PLTOFF, %rcx
+ addq %r11, %rdx
+ popq %r15
+ leaq (%rdx,%rax), %rdi
+ addq %rdx, %rcx
+ xorl %eax, %eax
+ jmp *%rcx
+ .size bar, .-bar
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index c84bdf1..9a4bdb9 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -991,6 +991,14 @@ if { [isnative] && [which $CC] != 0 } {
"plt-main.out" \
"-fPIC" \
] \
+ [list \
+ "Run pr20800" \
+ "-pie -z now" \
+ "" \
+ { pr20800a.S pr20800b.S } \
+ "pr20800" \
+ "pass.out" \
+ ] \
]
}