d10v fixes

Alan Modra amodra@gmail.com
Thu Sep 23 11:52:00 GMT 2010


Most places in bfd treat bits_per_address as a measure of the range of
addressable bytes.  d10v is a Harvard architecture processor with 256k
of insn space and 64k of data space.  bfd_arch_info_type can't
describe this properly, but 18 works better.

bfd/
	* cpu-d10v.c: Make bits_per_address 18 for all arch_info entries.
ld/testsuite/
	* ld-d10v/reloc-007.d: Don't error.
	* ld-d10v/reloc-008.d: Likewise.
	* ld-d10v/reloc-015.d: Likewise.
	* ld-d10v/reloc-016.d: Likewise.
	* ld-d10v/reloc-012.ld: Use a sane offset.

Index: bfd/cpu-d10v.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-d10v.c,v
retrieving revision 1.10
diff -u -p -r1.10 cpu-d10v.c
--- bfd/cpu-d10v.c	3 Jul 2007 14:26:40 -0000	1.10
+++ bfd/cpu-d10v.c	23 Sep 2010 05:24:33 -0000
@@ -27,7 +27,7 @@
 static const bfd_arch_info_type d10v_ts3_info =
 {
   16,	/* 16 bits in a word.  */
-  16,	/* 16 bits in an address.  */
+  18,	/* really 16 bits in an address, but code has 18 bit range.  */
   8,	/* 8 bits in a byte.  */
   bfd_arch_d10v,
   bfd_mach_d10v_ts3,
@@ -42,14 +42,14 @@ static const bfd_arch_info_type d10v_ts3
 
 static const bfd_arch_info_type d10v_ts2_info =
 {
-  16,	/* 16 bits in a word.  */
-  16,	/* 16 bits in an address.  */
-  8,	/* 8 bits in a byte.  */
+  16,
+  18,
+  8,
   bfd_arch_d10v,
   bfd_mach_d10v_ts2,
   "d10v",
   "d10v:ts2",
-  4, 	/* Section alignment power.  */
+  4,
   FALSE,
   bfd_default_compatible,
   bfd_default_scan,
@@ -58,14 +58,14 @@ static const bfd_arch_info_type d10v_ts2
 
 const bfd_arch_info_type bfd_d10v_arch =
 {
-  16,	/* 16 bits in a word.  */
-  16,	/* 16 bits in an address.  */
-  8,	/* 8 bits in a byte.  */
+  16,
+  18,
+  8,
   bfd_arch_d10v,
   bfd_mach_d10v,
   "d10v",
   "d10v",
-  4, 	/* Section alignment power.  */
+  4,
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
Index: ld/testsuite/ld-d10v/reloc-007.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-d10v/reloc-007.d,v
retrieving revision 1.2
diff -u -p -r1.2 reloc-007.d
--- ld/testsuite/ld-d10v/reloc-007.d	10 Nov 2004 03:38:17 -0000	1.2
+++ ld/testsuite/ld-d10v/reloc-007.d	23 Sep 2010 05:25:09 -0000
@@ -1,7 +1,8 @@
 #source: reloc-005.s
 #ld: -T $srcdir/$subdir/reloc-007.ld
 #objdump: -D
+# now that we treat addresses as wrapping, it isn't possible to fail
 #error: relocation truncated to fit: R_D10V_18_PCREL
 
 # Test 18 bit pc rel reloc bad boundary
-
+#pass
Index: ld/testsuite/ld-d10v/reloc-008.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-d10v/reloc-008.d,v
retrieving revision 1.2
diff -u -p -r1.2 reloc-008.d
--- ld/testsuite/ld-d10v/reloc-008.d	10 Nov 2004 03:38:17 -0000	1.2
+++ ld/testsuite/ld-d10v/reloc-008.d	23 Sep 2010 05:25:09 -0000
@@ -1,7 +1,8 @@
 #source: reloc-005.s
 #ld: -T $srcdir/$subdir/reloc-008.ld
 #objdump: -D
+# now that we treat addresses as wrapping, it isn't possible to fail
 #error: relocation truncated to fit: R_D10V_18_PCREL
 
 # Test 18 bit pc rel reloc normal bad
-
+#pass
Index: ld/testsuite/ld-d10v/reloc-012.ld
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-d10v/reloc-012.ld,v
retrieving revision 1.1
diff -u -p -r1.1 reloc-012.ld
--- ld/testsuite/ld-d10v/reloc-012.ld	17 Jun 2002 14:05:52 -0000	1.1
+++ ld/testsuite/ld-d10v/reloc-012.ld	23 Sep 2010 05:25:09 -0000
@@ -1,10 +1,10 @@
 SECTIONS
 {
   .text 0x01014000 :
-  { 
+  {
 	foo = .;
-	. = (. + 0x80004);
-	*(.text)   
+	. = (. + 0x20004);
+	*(.text)
   }
 }
 
Index: ld/testsuite/ld-d10v/reloc-015.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-d10v/reloc-015.d,v
retrieving revision 1.2
diff -u -p -r1.2 reloc-015.d
--- ld/testsuite/ld-d10v/reloc-015.d	10 Nov 2004 03:38:17 -0000	1.2
+++ ld/testsuite/ld-d10v/reloc-015.d	23 Sep 2010 05:25:09 -0000
@@ -1,7 +1,8 @@
 #source: reloc-005.s
 #ld: -T $srcdir/$subdir/reloc-015.ld
 #objdump: -D
+# now that we treat addresses as wrapping, it isn't possible to fail
 #error: relocation truncated to fit: R_D10V_18_PCREL
 
 # Test 18 bit pc rel negative reloc bad boundary
-
+#pass
Index: ld/testsuite/ld-d10v/reloc-016.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-d10v/reloc-016.d,v
retrieving revision 1.2
diff -u -p -r1.2 reloc-016.d
--- ld/testsuite/ld-d10v/reloc-016.d	10 Nov 2004 03:38:17 -0000	1.2
+++ ld/testsuite/ld-d10v/reloc-016.d	23 Sep 2010 05:25:09 -0000
@@ -1,7 +1,8 @@
 #source: reloc-005.s
 #ld: -T $srcdir/$subdir/reloc-016.ld
 #objdump: -D
+# now that we treat addresses as wrapping, it isn't possible to fail
 #error: relocation truncated to fit: R_D10V_18_PCREL
 
 # Test 18 bit pc rel negative reloc normal bad
-
+#pass

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list