[PATCH] 2/2: toolchain/52427: VAX text relocations

Kalvis Duckmanton <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
Hi all,

This is the second part of the change to address toolchain/52427 
(https://mail-index.netbsd.org/netbsd-bugs/2017/07/25/msg052924.html). 
This change to NetBSD 10.99.6 updates the GNU assembler in binutils.old, 
altering the behaviour of tc-vax.c:md_create_long_jump() to emit a jump 
to an address relative to the PC instead of a jump to an absolute address.

many thanks

kalvis


---
  .../gpl3/binutils.old/dist/gas/config/tc-vax.c  | 17 +++++++++--------
  1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/external/gpl3/binutils.old/dist/gas/config/tc-vax.c 
b/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
index 6a2ef16b1760..57863a55e882 100644
--- a/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
+++ b/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
@@ -2332,18 +2332,19 @@ md_create_short_jump (char *ptr,

  void
  md_create_long_jump (char *ptr,
-                    addressT from_addr ATTRIBUTE_UNUSED,
-                    addressT to_addr,
-                    fragS *frag,
-                    symbolS *to_symbol)
+                     addressT from_addr,
+                     addressT to_addr,
+                     fragS *frag ATTRIBUTE_UNUSED,
+                     symbolS *to_symbol ATTRIBUTE_UNUSED)
  {
    valueT offset;

-  offset = to_addr - S_GET_VALUE (to_symbol);
-  *ptr++ = VAX_JMP;            /* Arbitrary jump.  */
-  *ptr++ = VAX_ABSOLUTE_MODE;
+  /* account for 1 byte instruction, 1 byte of address specifier and
+     4 bytes of offset from PC */
+  offset = to_addr - (from_addr + 1 + 1 + 4);
+  *ptr++ = VAX_JMP;             /* long jump */
+  *ptr++ = VAX_PC_RELATIVE_MODE;
    md_number_to_chars (ptr, offset, 4);
-  fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, (long) 0, 0, 
NO_RELOC);
  }
  ^L
  #ifdef OBJ_VMS
-- 
2.20.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.