[Patch, moxie] Change branch target offset encodings

Anthony Green green@moxielogic.com
Sat Sep 8 01:19:00 GMT 2012


Now that there's a hardware implementation of moxie, it was noticed
that the logic could be simplified by encoding PC relative branch
offsets relative to the address of the instruction following the
branch instead of relative to the branch instruction itself.  I'm
checking this change in.  There's a corresponding gdb sim patch I'll
be posting soon.

2012-09-07  Anthony Green  <green@moxielogic.com>

	* config/tc-moxie.c (md_pcrel_from): Branches are now relative
          to the address following the branch instruction.

diff --git a/src/gas/config/tc-moxie.c b/src/gas/config/tc-moxie.c
index 2fffc65..e73887d 100644
--- a/src/gas/config/tc-moxie.c
+++ b/src/gas/config/tc-moxie.c
@@ -774,7 +774,8 @@ md_pcrel_from (fixS *fixP)
     case BFD_RELOC_32:
       return addr + 4;
     case BFD_RELOC_MOXIE_10_PCREL:
-      return addr;
+      /* Offset is from the end of the instruction.  */
+      return addr + 2;
     default:
       abort ();
       return addr;



More information about the Binutils mailing list