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

Commit

Permalink
RISC-V/GAS: Support more relocs against constant addresses
Browse files Browse the repository at this point in the history
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."
  • Loading branch information
aswaterman authored and palmer-dabbelt committed Jan 1, 2017
1 parent af99952 commit 2917a9f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gas/config/tc-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,6 @@ append_insn (struct riscv_cl_insn *ip, expressionS *address_expr,
address_expr->X_add_number);
return;
}
else if (address_expr->X_op == O_constant)
ip->insn_opcode |= riscv_apply_const_reloc (reloc_type,
address_expr->X_add_number);
else
{
howto = bfd_reloc_type_lookup (stdoutput, reloc_type);
Expand Down Expand Up @@ -1861,6 +1858,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_RISCV_LO12_S:
bfd_putl32 (riscv_apply_const_reloc (fixP->fx_r_type, *valP)
| bfd_getl32 (buf), buf);
if (fixP->fx_addsy == NULL)
fixP->fx_done = TRUE;
relaxable = TRUE;
break;

Expand Down

0 comments on commit 2917a9f

Please sign in to comment.