aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2016-03-30 00:02:19 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2016-04-14 17:16:46 +0100
commit4b0c052e456421a3c6d7b4c98be3ad0b3bd2ad27 (patch)
treeba2ad6919a72787b533fdc37c2694aa49522995d /ld
parent33cbe6c07ed7e66d65c106cffb496eff5d7e8fb5 (diff)
downloadgdb-4b0c052e456421a3c6d7b4c98be3ad0b3bd2ad27.zip
gdb-4b0c052e456421a3c6d7b4c98be3ad0b3bd2ad27.tar.gz
gdb-4b0c052e456421a3c6d7b4c98be3ad0b3bd2ad27.tar.bz2
arc/nps400 : New cmem instructions and associated relocation
Add support for arc/nps400 cmem instructions, these load and store instructions are hard-wired to access "0x57f00000 + 16-bit-offset". Supporting this relocation required some additions to the arc relocation handling in the bfd library, as well as the standard changes required to add a new relocation type. There's a test of the new instructions in the assembler, and a test of the relocation in the linker. bfd/ChangeLog: * reloc.c: Add BFD_RELOC_ARC_NPS_CMEM16 entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-arc.c: Add 'opcode/arc.h' include. (struct arc_relocation_data): Add symbol_name. (arc_special_overflow_checks): New function. (arc_do_relocation): Use arc_special_overflow_checks, reindent as required, add an extra comment. (elf_arc_relocate_section): Setup symbol_name in reloc_data. gas/ChangeLog: * testsuite/gas/arc/nps400-3.d: New file. * testsuite/gas/arc/nps400-3.s: New file. include/ChangeLog: * elf/arc-reloc.def: Add ARC_NPS_CMEM16 reloc. * opcode/arc.h (NPS_CMEM_HIGH_VALUE): Define. ld/ChangeLog: * testsuite/ld-arc/arc.exp: New file. * testsuite/ld-arc/nps-1.s: New file. * testsuite/ld-arc/nps-1a.d: New file. * testsuite/ld-arc/nps-1b.d: New file. * testsuite/ld-arc/nps-1b.err: New file. opcodes/ChangeLog: * arc-nps400-tbl.h: Add xldb, xldw, xld, xstb, xstw, and xst instructions. * arc-opc.c (insert_nps_cmem_uimm16): New function. (extract_nps_cmem_uimm16): New function. (arc_operands): Add NPS_XLDST_UIMM16 operand.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/testsuite/ld-arc/arc.exp30
-rw-r--r--ld/testsuite/ld-arc/nps-1.s10
-rw-r--r--ld/testsuite/ld-arc/nps-1a.d16
-rw-r--r--ld/testsuite/ld-arc/nps-1b.d4
-rw-r--r--ld/testsuite/ld-arc/nps-1b.err1
6 files changed, 69 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4458f99..ea4d20d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2016-04-14 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * testsuite/ld-arc/arc.exp: New file.
+ * testsuite/ld-arc/nps-1.s: New file.
+ * testsuite/ld-arc/nps-1a.d: New file.
+ * testsuite/ld-arc/nps-1b.d: New file.
+ * testsuite/ld-arc/nps-1b.err: New file.
+
2016-04-14 Nick Clifton <nickc@redhat.com>
PR 19457
diff --git a/ld/testsuite/ld-arc/arc.exp b/ld/testsuite/ld-arc/arc.exp
new file mode 100644
index 0000000..0cf6228
--- /dev/null
+++ b/ld/testsuite/ld-arc/arc.exp
@@ -0,0 +1,30 @@
+# Copyright (C) 2016 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.
+#
+
+if { ![istarget arc*-*-*] } {
+ return
+}
+
+set arc_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach arc_test $arc_test_list {
+ verbose [file rootname $arc_test]
+ run_dump_test [file rootname $arc_test]
+}
+
diff --git a/ld/testsuite/ld-arc/nps-1.s b/ld/testsuite/ld-arc/nps-1.s
new file mode 100644
index 0000000..295fa2c
--- /dev/null
+++ b/ld/testsuite/ld-arc/nps-1.s
@@ -0,0 +1,10 @@
+ .text
+ .global __start
+__start:
+ xldb r10, [ foo ]
+ xldw r10, [ foo ]
+ xld r10, [ foo ]
+ xstb r10, [ foo ]
+ xstw r10, [ foo ]
+ xst r10, [ foo ]
+
diff --git a/ld/testsuite/ld-arc/nps-1a.d b/ld/testsuite/ld-arc/nps-1a.d
new file mode 100644
index 0000000..120c71c
--- /dev/null
+++ b/ld/testsuite/ld-arc/nps-1a.d
@@ -0,0 +1,16 @@
+#source: nps-1.s
+#as: -mcpu=nps400
+#ld: -defsym=foo=0x57f03000
+#objdump: -d
+
+.*: +file format .*arc.*
+
+Disassembly of section .text:
+
+[0-9a-f]+ <.*>:
+ *[0-9a-f]+: 5948 3000 xldb r10,\[0x57f03000\]
+ *[0-9a-f]+: 5949 3000 xldw r10,\[0x57f03000\]
+ *[0-9a-f]+: 594a 3000 xld r10,\[0x57f03000\]
+ *[0-9a-f]+: 594c 3000 xstb r10,\[0x57f03000\]
+ *[0-9a-f]+: 594d 3000 xstw r10,\[0x57f03000\]
+ *[0-9a-f]+: 594e 3000 xst r10,\[0x57f03000\]
diff --git a/ld/testsuite/ld-arc/nps-1b.d b/ld/testsuite/ld-arc/nps-1b.d
new file mode 100644
index 0000000..56c29ae
--- /dev/null
+++ b/ld/testsuite/ld-arc/nps-1b.d
@@ -0,0 +1,4 @@
+#source: nps-1.s
+#as: -mcpu=nps400
+#ld: -defsym=foo=0x56f03000
+#error_output: nps-1b.err
diff --git a/ld/testsuite/ld-arc/nps-1b.err b/ld/testsuite/ld-arc/nps-1b.err
new file mode 100644
index 0000000..a44b3c1
--- /dev/null
+++ b/ld/testsuite/ld-arc/nps-1b.err
@@ -0,0 +1 @@
+.*\.o\(\.text\+0x0\): CMEM relocation to `foo' is invalid, 16 MSB should be 0x57f0 \(value is 0x56f03000\)