This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Moxie patch 1 of 4: new relocation for PC-relative branch instructions


The following patch adds a new relocation to BFD to support
PC-relative branching for the Moxie port.  It's the only patch 
in this series that touches shared source files, so I believe 
I need somebody to review and approve this patch before the 
rest can go in.

PC-relative branch instructions are a new addition to the Moxie 
ISA.  On the benchmarks I've tested, this reduces code size 
between 7 and 15%.

In addition to these binutils patches, I also have sim and gcc
patches which I'll commit once these are in.

Thanks,

AG


2009-06-10  Anthony Green  <green@moxielogic.com>

	* reloc.c: Add BFD_RELOC_MOXIE_10_PCREL.
	* bfd-in2.h: Rebuilt.
	* libbfd.h: Rebuilt.
	* elf32-moxie.c (moxie_elf_howto_table): Add R_MOXIE_PCREL10
	relocation support.
	(moxie_reloc_map): Ditto.
	Clean up copyright notice.

Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.482
diff -u -r1.482 bfd-in2.h
--- bfd/bfd-in2.h	1 Jun 2009 13:11:51 -0000	1.482
+++ bfd/bfd-in2.h	10 Jun 2009 15:34:32 -0000
@@ -2736,6 +2736,10 @@
   BFD_RELOC_MIPS_JUMP_SLOT,
 
 
+/* Moxie ELF relocations.  */
+  BFD_RELOC_MOXIE_10_PCREL,
+
+
 /* Fujitsu Frv Relocations.  */
   BFD_RELOC_FRV_LABEL16,
   BFD_RELOC_FRV_LABEL24,
Index: bfd/elf32-moxie.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-moxie.c,v
retrieving revision 1.1
diff -u -r1.1 elf32-moxie.c
--- bfd/elf32-moxie.c	16 Apr 2009 15:39:42 -0000	1.1
+++ bfd/elf32-moxie.c	10 Jun 2009 15:34:32 -0000
@@ -1,5 +1,4 @@
 /* moxie-specific support for 32-bit ELF.
-   Copyright 2008 Anthony Green.
    Copyright 2009 Free Software Foundation, Inc.
 
    Copied from elf32-fr30.c which is..
@@ -62,6 +61,21 @@
 	 0x00000000,		/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
+
+  /* A 10 bit PC-relative relocation.  */
+  HOWTO (R_MOXIE_PCREL10,	/* type.  */
+	 1,			/* rightshift.  */
+	 1,			/* size (0 = byte, 1 = short, 2 = long).  */
+	 10,			/* bitsize.  */
+	 TRUE,			/* pc_relative.  */
+	 0,			/* bitpos.  */
+	 complain_overflow_signed, /* complain_on_overflow.  */
+	 bfd_elf_generic_reloc,	/* special_function.  */
+	 "R_MOXIE_PCREL10",		/* name.  */
+	 FALSE,			/* partial_inplace.  */
+	 0,			/* src_mask.  */
+	 0x000003FF,		/* dst_mask.  */
+	 TRUE),			/* pcrel_offset.  */
 };
 
 /* Map BFD reloc types to MOXIE ELF reloc types.  */
@@ -74,8 +88,9 @@
 
 static const struct moxie_reloc_map moxie_reloc_map [] =
 {
-  { BFD_RELOC_NONE,           R_MOXIE_NONE },
-  { BFD_RELOC_32,             R_MOXIE_32 },
+  { BFD_RELOC_NONE,            R_MOXIE_NONE },
+  { BFD_RELOC_32,              R_MOXIE_32 },
+  { BFD_RELOC_MOXIE_10_PCREL,  R_MOXIE_PCREL10 },
 };
 
 static reloc_howto_type *
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.216
diff -u -r1.216 libbfd.h
--- bfd/libbfd.h	1 Jun 2009 13:11:52 -0000	1.216
+++ bfd/libbfd.h	10 Jun 2009 15:34:32 -0000
@@ -1030,6 +1030,8 @@
   "BFD_RELOC_MIPS_COPY",
   "BFD_RELOC_MIPS_JUMP_SLOT",
 
+  "BFD_RELOC_MOXIE_10_PCREL",
+
   "BFD_RELOC_FRV_LABEL16",
   "BFD_RELOC_FRV_LABEL24",
   "BFD_RELOC_FRV_LO16",
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.187
diff -u -r1.187 reloc.c
--- bfd/reloc.c	1 Jun 2009 13:11:52 -0000	1.187
+++ bfd/reloc.c	10 Jun 2009 15:34:34 -0000
@@ -2316,6 +2316,12 @@
 COMMENT
 
 ENUM
+  BFD_RELOC_MOXIE_10_PCREL
+ENUMDOC
+  Moxie ELF relocations.
+COMMENT
+
+ENUM
   BFD_RELOC_FRV_LABEL16
 ENUMX
   BFD_RELOC_FRV_LABEL24



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]