Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit 2917a9f

Browse files
aswatermanpalmer-dabbelt
authored andcommitted
RISC-V/GAS: Support more relocs against constant addresses
Previously, some pseudoinstructions like "call" only accepted symbolic addresses and rejected constant addresses with an esoteric internal error. This patch enables them by deferring application of constant relocations to md_apply_fix, rather than eagerly applying them during instruction assembly. gas/ChangeLog 2016-12-21 Andrew Waterman <[email protected]> * config/tc-riscv.c (append_insn): Don't eagerly apply relocations against constants. (md_apply_fix): Mark relocations against constants as "done."
1 parent af99952 commit 2917a9f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gas/config/tc-riscv.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,6 @@ append_insn (struct riscv_cl_insn *ip, expressionS *address_expr,
688688
address_expr->X_add_number);
689689
return;
690690
}
691-
else if (address_expr->X_op == O_constant)
692-
ip->insn_opcode |= riscv_apply_const_reloc (reloc_type,
693-
address_expr->X_add_number);
694691
else
695692
{
696693
howto = bfd_reloc_type_lookup (stdoutput, reloc_type);
@@ -1861,6 +1858,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
18611858
case BFD_RELOC_RISCV_LO12_S:
18621859
bfd_putl32 (riscv_apply_const_reloc (fixP->fx_r_type, *valP)
18631860
| bfd_getl32 (buf), buf);
1861+
if (fixP->fx_addsy == NULL)
1862+
fixP->fx_done = TRUE;
18641863
relaxable = TRUE;
18651864
break;
18661865

0 commit comments

Comments
 (0)