aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2015-07-01 15:55:28 -0700
committerSandra Loosemore <sandra@codesourcery.com>2015-07-01 15:55:28 -0700
commit965b1d80832fde9ba17a8b5f11b578a8f9e10581 (patch)
tree050d75d12b3342269911e3db42256309a1adaac1 /ld
parentdfc87947b5ac6d6382c225449d4fdce411c7ee66 (diff)
downloadgdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.zip
gdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.tar.gz
gdb-965b1d80832fde9ba17a8b5f11b578a8f9e10581.tar.bz2
Add Nios II arch flags and compatibility tests
2015-07-01 Sandra Loosemore <sandra@codesourcery.com> Cesar Philippidis <cesar@codesourcery.com> bfd/ * archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New. * bfd-in2.h: Regenerated. * cpu-nios2.c (nios2_compatible): New. (N): Use nios2_compatible instead of bfd_default_compatible. (NIOS2R1_NEXT, NIOS2R2_NEXT): Define. (arch_info_struct): New. (bfd_nios2_arch): Chain to NIOS2R1_NEXT. * elf32-nios2.c (is_nios2_elf): New. (nios2_elf32_merge_private_bfd_data): New. (nios2_elf32_object_p): New. (bfd_elf32_bfd_merge_private_bfd_data): Define. (elf_backend_object_p): Define. gas/ * config/tc-nios2.c: Adjust includes. (OPTION_MARCH): Define. (md_longopts): Add -march option. (nios2_architecture): New. (nios2_use_arch): New. (md_parse_option): Handle OPTION_MARCH. (md_show_usage): Document -march. (md_begin): Set arch in BFD. (nios2_elf_final_processing): New. * config/tc-nios2.h (elf_tc_final_processing): Define. (nios2_elf_final_processing): New. * doc/c-nios2.texi (-march): Add documentation. include/elf/ * nios2.h (EF_NIOS2_ARCH_R1, EF_NIOS2_ARCH_R2): Define. ld/testsuite/ * ld-nios2/mixed1a.d: New. * ld-nios2/mixed1a.s: New. * ld-nios2/mixed1b.d: New. * ld-nios2/mixed1b.s: New. * ld-nios2/nios2.exp: Build the new compatibility tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-nios2/mixed1a.d9
-rw-r--r--ld/testsuite/ld-nios2/mixed1a.s9
-rw-r--r--ld/testsuite/ld-nios2/mixed1b.d9
-rw-r--r--ld/testsuite/ld-nios2/mixed1b.s3
-rw-r--r--ld/testsuite/ld-nios2/nios2.exp26
6 files changed, 64 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index e4f913f..0e611b9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2015-07-01 Sandra Loosemore <sandra@codesourcery.com>
+ Cesar Philippidis <cesar@codesourcery.com>
+
+ * ld-nios2/mixed1a.d: New.
+ * ld-nios2/mixed1a.s: New.
+ * ld-nios2/mixed1b.d: New.
+ * ld-nios2/mixed1b.s: New.
+ * ld-nios2/nios2.exp: Build the new compatibility tests.
+
2015-06-27 H.J. Lu <hongjiu.lu@intel.com>
* ld-xtensa/tlsbin.rd: Updated.
diff --git a/ld/testsuite/ld-nios2/mixed1a.d b/ld/testsuite/ld-nios2/mixed1a.d
new file mode 100644
index 0000000..0c7d666
--- /dev/null
+++ b/ld/testsuite/ld-nios2/mixed1a.d
@@ -0,0 +1,9 @@
+#name: NIOS2 mixed1a
+#source: mixed1a.s
+#as: -march=r2
+#readelf: -h
+
+ELF Header:
+#...
+ Flags: 0x1
+#...
diff --git a/ld/testsuite/ld-nios2/mixed1a.s b/ld/testsuite/ld-nios2/mixed1a.s
new file mode 100644
index 0000000..8742f1c
--- /dev/null
+++ b/ld/testsuite/ld-nios2/mixed1a.s
@@ -0,0 +1,9 @@
+# Test linking incompatible object file types.
+
+.text
+.global _start
+_start:
+ movhi r2, %hiadj(foo)
+ addi r2, r2, %lo(foo)
+ ldw r2, 0(r2)
+ cmpeq r2, r2, zero
diff --git a/ld/testsuite/ld-nios2/mixed1b.d b/ld/testsuite/ld-nios2/mixed1b.d
new file mode 100644
index 0000000..a702c5a
--- /dev/null
+++ b/ld/testsuite/ld-nios2/mixed1b.d
@@ -0,0 +1,9 @@
+#name: NIOS2 mixed1b
+#source: mixed1b.s
+#as: -march=r1
+#readelf: -h
+
+ELF Header:
+#...
+ Flags: 0x0
+#...
diff --git a/ld/testsuite/ld-nios2/mixed1b.s b/ld/testsuite/ld-nios2/mixed1b.s
new file mode 100644
index 0000000..0d07590
--- /dev/null
+++ b/ld/testsuite/ld-nios2/mixed1b.s
@@ -0,0 +1,3 @@
+# Test linking incompatible object file types.
+
+.comm foo,4,4
diff --git a/ld/testsuite/ld-nios2/nios2.exp b/ld/testsuite/ld-nios2/nios2.exp
index 22080b4..b8ffd49 100644
--- a/ld/testsuite/ld-nios2/nios2.exp
+++ b/ld/testsuite/ld-nios2/nios2.exp
@@ -1,7 +1,31 @@
if { ! [istarget nios2-*-*] } {
- return
+ return
}
foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.d]] {
run_dump_test [file rootname $test]
}
+
+global link_output
+global ld
+
+set test_name "NIOS2 Mixed R1 and R2 objects"
+set test mixed1
+
+if ![ld_assemble $as "-march=r1 $srcdir/$subdir/${test}a.s" tmpdir/${test}a.o] {
+ unresolved "Build mixed1a.o"
+ return
+}
+
+if ![ld_assemble $as "-march=r2 $srcdir/$subdir/${test}b.s" tmpdir/${test}b.o] {
+ unresolved "Build mixed1b.o"
+ return
+}
+
+if { ![ld_simple_link $ld tmpdir/$test "tmpdir/${test}a.o tmpdir/${test}b.o"] } {
+ if [string match "*architecture * is incompatible*" $link_output] {
+ pass "$test_name"
+ } {
+ fail "$test_name"
+ }
+}