Module Name: src
Committed By: rin
Date: Sat Nov 25 12:07:58 UTC 2023
Modified Files:
src/external/gpl3/binutils.old/dist/gas/config: tc-vax.c
Log Message:
binutils.old/gas: vax: PR port-vax/57646 patch provided by Kalvis Duckmanton
[11/21]
PR toolchain/43314: pc relative relocations are "off by 1*size" on vax
Address http://gnats.netbsd.org/43314
Taken from binutils/gas:
https://mail-index.netbsd.org/source-changes/2023/10/07/msg147942.html
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c
diff -u src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.9 src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.10
--- src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c:1.9 Sat Nov 25 12:06:42 2023
+++ src/external/gpl3/binutils.old/dist/gas/config/tc-vax.c Sat Nov 25 12:07:58 2023
@@ -3581,12 +3581,39 @@ void
vax_cons_fix_new (fragS *frag, int where, unsigned int nbytes, expressionS *exp,
bfd_reloc_code_real_type r)
{
- if (r == NO_RELOC)
+ int pcrel;
+ // fix PC relative frags too ...
+ switch (r)
+ {
+ case BFD_RELOC_8_PCREL:
+ case BFD_RELOC_16_PCREL:
+ case BFD_RELOC_32_PCREL:
+ pcrel = 1;
+ /*
+ * Displacement mode addressing (of which PC relative is one
+ * type) uses the updated contents of the register as the base
+ * address. VARM, Leonard 1987, pp34
+ */
+ switch (exp->X_op)
+ {
+ case O_constant:
+ case O_symbol:
+ exp->X_add_number += nbytes;
+ break;
+ }
+ break;
+ case NO_RELOC:
r = (nbytes == 1 ? BFD_RELOC_8
: nbytes == 2 ? BFD_RELOC_16
: BFD_RELOC_32);
+ pcrel = 0;
+ break;
+ default:
+ pcrel = 0;
+ break;
+ }
- fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
+ fix_new_exp (frag, where, (int) nbytes, exp, pcrel, r);
}
const char *