aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r--ld/testsuite/ld-elf/binutils.exp2
-rw-r--r--ld/testsuite/ld-elf/elf.exp9
-rw-r--r--ld/testsuite/ld-elf/orphan-region.d6
-rw-r--r--ld/testsuite/ld-elf/stack-exec.rd3
-rw-r--r--ld/testsuite/ld-elf/stack-size.rd3
-rw-r--r--ld/testsuite/ld-elf/stack.s10
6 files changed, 29 insertions, 4 deletions
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 249fa2a..0101512 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -60,7 +60,7 @@ proc binutils_test { prog_name ld_options test {test_name ""}} {
return
}
- if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
+ if { ![ld_simple_link $ld tmpdir/$test "$ld_options -z stack-size=0 tmpdir/$test.o"] } {
if { [string match "*not supported*" $link_output]
|| [string match "*unrecognized option*" $link_output]
|| [string match "*-z relro ignored*" $link_output] } {
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index a97e3df..a33e3b6 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -126,6 +126,15 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } {
}
}
+if { [istarget *-*-*linux*] } {
+ run_ld_link_tests {
+ {"stack exec" "-z execstack" "" {stack.s}
+ {{readelf {-Wl} stack-exec.rd}} "stack-exec.exe"}
+ {"stack size" "-z stack-size=0x123400" "" {stack.s}
+ {{readelf {-Wl} stack-size.rd}} "stack-size.exe"}
+ }
+}
+
set LDFLAGS $old_ldflags
# The following tests require running the executable generated by ld.
diff --git a/ld/testsuite/ld-elf/orphan-region.d b/ld/testsuite/ld-elf/orphan-region.d
index 9d6c90c..d961a07 100644
--- a/ld/testsuite/ld-elf/orphan-region.d
+++ b/ld/testsuite/ld-elf/orphan-region.d
@@ -1,11 +1,11 @@
#source: orphan-region.s
-#ld: -T orphan-region.ld -N
+#ld: -T orphan-region.ld -N -z stack-size=0
#readelf: -S -l --wide
#xfail: arc-*-* d30v-*-* dlx-*-* fr30-*-* frv-*-elf i860-*-* i960-*-*
#xfail: iq*-*-* mn10200-*-* moxie-*-* msp*-*-* mt-*-* or32-*-* pj*-*-*
-#xfail: spu-*-* hppa*64*-*-* frv-*-*
+#xfail: spu-*-* hppa*64*-*-*
# if not using elf32.em, you don't get fancy orphan handling
-# spu twiddles LOAD range, hppa64 adds PHDR, frv-linux adds GNU_STACK
+# spu twiddles LOAD range, hppa64 adds PHDR
#...
\[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
diff --git a/ld/testsuite/ld-elf/stack-exec.rd b/ld/testsuite/ld-elf/stack-exec.rd
new file mode 100644
index 0000000..7f68a6c
--- /dev/null
+++ b/ld/testsuite/ld-elf/stack-exec.rd
@@ -0,0 +1,3 @@
+#...
+ GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RWE 0x[0-9a-f]+
+#pass
diff --git a/ld/testsuite/ld-elf/stack-size.rd b/ld/testsuite/ld-elf/stack-size.rd
new file mode 100644
index 0000000..413db3a9
--- /dev/null
+++ b/ld/testsuite/ld-elf/stack-size.rd
@@ -0,0 +1,3 @@
+#...
+ GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x123400 RW. 0x[0-9a-f]+
+#pass
diff --git a/ld/testsuite/ld-elf/stack.s b/ld/testsuite/ld-elf/stack.s
new file mode 100644
index 0000000..b92617b
--- /dev/null
+++ b/ld/testsuite/ld-elf/stack.s
@@ -0,0 +1,10 @@
+ .text
+ .globl start
+ .globl _start
+start:
+_start:
+ nop
+ nop
+ nop
+ nop
+