This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch, moxie] Change branch target offset encodings
- From: Anthony Green <green at moxielogic dot com>
- To: binutils at sourceware dot org
- Date: Fri, 7 Sep 2012 21:19:35 -0400
- Subject: [Patch, moxie] Change branch target offset encodings
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;