Module Name: src
Committed By: rin
Date: Sat Oct 7 12:04:09 UTC 2023
Modified Files:
src/external/gpl3/binutils/dist/gas/config: tc-vax.c
Log Message:
binutils/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
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/external/gpl3/binutils/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/dist/gas/config/tc-vax.c
diff -u src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.17 src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.18
--- src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.17 Sat Oct 7 12:02:50 2023
+++ src/external/gpl3/binutils/dist/gas/config/tc-vax.c Sat Oct 7 12:04:09 2023
@@ -3504,12 +3504,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 *