summaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorStephen Casner <casner@acm.org>2020-04-14 14:41:27 +0100
committerNick Clifton <nickc@redhat.com>2020-04-14 14:41:27 +0100
commitfa1477dc34e6ce19b90ff0171074c295133730a3 (patch)
tree165b1472d16c8efe22cacada145a841f5247ac28 /ld/testsuite
parent194d088fb1fa6c3c341994ca247d172c3f08c2da (diff)
downloadbinutils-gdb-fa1477dc34e6ce19b90ff0171074c295133730a3.tar.gz
Fixes for the magic number used in PDP11 AOUT binaries.
PR ld/25677 include * aout/aout64.h (N_DATADDR): Add IMAGIC case. bfd * pdp11.c: Add implementation of --imagic option. (adjust_o_magic): Fix objcopy --extract-symbol test. * libaout.h (enum aout_magic): Add i_magic. ld * emulparams/pdp11.sh (SCRIPT_NAME): Change to pdp11. (EXTRA_EM_FILE): New, add emulation file pdp11. * scripttempl/pdp11.sc: New, derived from aout.sc without irrelevant input sections. * emultempl/pdp11.em (_add_options, _handle_option) (_list_options): New. Add options -z, --imagic for pdp11-aout. (_before_parse): Make --omagic be default instead of --nmagic. (_get_script): Modify special-case linker script for --imagic. * lexsup.c (parse_args): Explictly set config.text_read_only for -n. * ld.texi (Options): Add documentation of PDP11-specific options. (Options): Fix unrelated typo to --no-compact-branches. * gen-doc.texi: @set PDP11. * testsuite/ld-pdp11/pdp11.exp: New, start pdp11 testing. * testsuite/ld-pdp11/sections.s: New, source for options tests. * testsuite/ld-pdp11/imagic.d: New, test --imagic format. * testsuite/ld-pdp11/imagicz.d: New, test -z (imagic) format. * testsuite/ld-pdp11/nmagic.d: New, test --nmagic format. * testsuite/ld-pdp11/omagic.d: New, test --omagic format.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-pdp11/imagic.d12
-rw-r--r--ld/testsuite/ld-pdp11/imagicz.d12
-rw-r--r--ld/testsuite/ld-pdp11/nmagic.d11
-rw-r--r--ld/testsuite/ld-pdp11/omagic.d12
-rw-r--r--ld/testsuite/ld-pdp11/pdp11.exp33
-rw-r--r--ld/testsuite/ld-pdp11/sections.s13
6 files changed, 93 insertions, 0 deletions
diff --git a/ld/testsuite/ld-pdp11/imagic.d b/ld/testsuite/ld-pdp11/imagic.d
new file mode 100644
index 00000000000..2e1566c2466
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/imagic.d
@@ -0,0 +1,12 @@
+#name: pdp11-aout imagic format
+# nm sort alphabetically since both _start and _data are 0
+#source: sections.s
+#ld: --imagic
+#DUMPPROG: nm
+#...
+0+2 B _bss
+#...
+0+0 D _data
+#...
+0+0 T _start
+#pass
diff --git a/ld/testsuite/ld-pdp11/imagicz.d b/ld/testsuite/ld-pdp11/imagicz.d
new file mode 100644
index 00000000000..38a11b46171
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/imagicz.d
@@ -0,0 +1,12 @@
+#name: pdp11-aout imagic format -z
+# nm sort alphabetically since both _start and _data are 0
+#source: sections.s
+#ld: -z
+#DUMPPROG: nm
+#...
+0+2 B _bss
+#...
+0+0 D _data
+#...
+0+0 T _start
+#pass
diff --git a/ld/testsuite/ld-pdp11/nmagic.d b/ld/testsuite/ld-pdp11/nmagic.d
new file mode 100644
index 00000000000..acdae245340
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/nmagic.d
@@ -0,0 +1,11 @@
+#name: pdp11-aout nmagic format
+#source: sections.s
+#ld: --nmagic
+#nm: -n
+#...
+0+0 T _start
+#...
+0*2000 D _data
+#...
+0*2002 B _bss
+#pass
diff --git a/ld/testsuite/ld-pdp11/omagic.d b/ld/testsuite/ld-pdp11/omagic.d
new file mode 100644
index 00000000000..ed3a4233d2a
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/omagic.d
@@ -0,0 +1,12 @@
+#name: pdp11-aout omagic format
+# also testing that --omagic is the default
+#source: sections.s
+#ld:
+#nm: -n
+#...
+0+0 T _start
+#...
+0+6 D _data
+#...
+0+8 B _bss
+#pass
diff --git a/ld/testsuite/ld-pdp11/pdp11.exp b/ld/testsuite/ld-pdp11/pdp11.exp
new file mode 100644
index 00000000000..90c82df19a8
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/pdp11.exp
@@ -0,0 +1,33 @@
+# Expect script for ld-pdp11 tests
+# Copyright (C) 2016-2020 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.
+#
+
+# Test pdp11 linking; at this point just the options for the three
+# a.out format variants.
+
+if ![istarget "pdp11-*-*"] then {
+ return
+}
+
+set pdp11_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach pdp11_test $pdp11_test_list {
+ verbose [file rootname $pdp11_test]
+ run_dump_test [file rootname $pdp11_test]
+}
diff --git a/ld/testsuite/ld-pdp11/sections.s b/ld/testsuite/ld-pdp11/sections.s
new file mode 100644
index 00000000000..c6e40a07c60
--- /dev/null
+++ b/ld/testsuite/ld-pdp11/sections.s
@@ -0,0 +1,13 @@
+ .globl _start
+ .text
+_start:
+ mov _data,_bss
+ .globl _data
+ .data
+_data:
+ .word 1
+ .globl _bss
+ .bss
+_bss:
+ .=.+2
+ .end