summaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorClément Chigot <chigot@adacore.com>2022-11-28 09:29:37 +0100
committerClément Chigot <chigot@adacore.com>2023-03-16 15:01:05 +0100
commitb119512977bbdbdce84493dfa6321f6d1f82dbf0 (patch)
tree1dd2c5eda3a219325869bcf30c98a64ba71094b9 /ld/testsuite
parente263a66b01a697632a51ad5ec1e6c08071e3e5ec (diff)
ld: add support of QNX stack arguments for aarch64nto
QNX is handling the stack argument using a .note section. Generate it according to ELF argument -zexecstack, -zstack-size and a new NTO argument --lazy-stack. Another NTO argument --stack mimicking -zstack-size is added in order to ensure compatibility with previously made NTO linkers. This requires a new emultempl nto.em which is applied above the default ${ARCH}elf.em. ld/ChangeLog: * emulparams/aarch64nto.sh: Move to nto.em. * emultempl/nto.em: New file. * testsuite/ld-aarch64/aarch64-nto.exp: New test. * testsuite/ld-aarch64/nto-stack-note-1.d: New test. * testsuite/ld-aarch64/nto-stack-note-2.d: New test. * testsuite/ld-aarch64/start.s: New test.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-nto.exp28
-rw-r--r--ld/testsuite/ld-aarch64/nto-stack-note-1.d12
-rw-r--r--ld/testsuite/ld-aarch64/nto-stack-note-2.d12
-rw-r--r--ld/testsuite/ld-aarch64/start.s4
4 files changed, 56 insertions, 0 deletions
diff --git a/ld/testsuite/ld-aarch64/aarch64-nto.exp b/ld/testsuite/ld-aarch64/aarch64-nto.exp
new file mode 100644
index 00000000000..4fd6245e9a2
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/aarch64-nto.exp
@@ -0,0 +1,28 @@
+
+# Expect script for various AARCH64 NTO tests.
+# Copyright (C) 2009-2022 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# Exclude non-aarch64-NTO targets.
+if { ![istarget "aarch64*-*-nto*"] } {
+ return
+}
+
+run_dump_test "nto-stack-note-1"
+run_dump_test "nto-stack-note-2"
diff --git a/ld/testsuite/ld-aarch64/nto-stack-note-1.d b/ld/testsuite/ld-aarch64/nto-stack-note-1.d
new file mode 100644
index 00000000000..d85dbcadb6b
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/nto-stack-note-1.d
@@ -0,0 +1,12 @@
+#name: nto-stack-note-1
+#source: start.s
+#as:
+#ld: -z stack-size=0x10000
+#readelf: -n
+
+Displaying notes found in: .note
+[ ]+Owner[ ]+Data size[ ]+Description
+ QNX 0x0000000c QNX stack
+ Stack Size: 0x10000
+ Stack allocated: 10000
+ Executable: no
diff --git a/ld/testsuite/ld-aarch64/nto-stack-note-2.d b/ld/testsuite/ld-aarch64/nto-stack-note-2.d
new file mode 100644
index 00000000000..9e446ccea5c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/nto-stack-note-2.d
@@ -0,0 +1,12 @@
+#name: nto-stack-note-2
+#source: start.s
+#as:
+#ld: -z stack-size=0x10000 --lazy-stack -z execstack
+#readelf: -n
+
+Displaying notes found in: .note
+[ ]+Owner[ ]+Data size[ ]+Description
+ QNX 0x0000000c QNX stack
+ Stack Size: 0x10000
+ Stack allocated: 1000
+ Executable: yes
diff --git a/ld/testsuite/ld-aarch64/start.s b/ld/testsuite/ld-aarch64/start.s
new file mode 100644
index 00000000000..58d42a60324
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/start.s
@@ -0,0 +1,4 @@
+ .global _start
+ .text
+_start:
+ nop