@@ -1333,18 +1333,20 @@ aarch64_expand_builtin (tree exp,
case AARCH64_PAUTH_BUILTIN_PACIA1716:
case AARCH64_PAUTH_BUILTIN_XPACLRI:
arg0 = CALL_EXPR_ARG (exp, 0);
- op0 = force_reg (Pmode, expand_normal (arg0));
+ /* Operand0 should have ptr_mode as its a ptr_type_node, this makes both
+ LP64 and ILP32 expand correctly. */
+ op0 = force_reg (ptr_mode, expand_normal (arg0));
if (!target)
- target = gen_reg_rtx (Pmode);
+ target = gen_reg_rtx (ptr_mode);
else
- target = force_reg (Pmode, target);
+ target = force_reg (ptr_mode, target);
emit_move_insn (target, op0);
if (fcode == AARCH64_PAUTH_BUILTIN_XPACLRI)
{
- rtx lr = gen_rtx_REG (Pmode, R30_REGNUM);
+ rtx lr = gen_rtx_REG (ptr_mode, R30_REGNUM);
icode = CODE_FOR_xpaclri;
emit_move_insn (lr, op0);
emit_insn (GEN_FCN (icode) ());
@@ -1353,12 +1355,13 @@ aarch64_expand_builtin (tree exp,
else
{
tree arg1 = CALL_EXPR_ARG (exp, 1);
- rtx op1 = force_reg (Pmode, expand_normal (arg1));
+ /* Operand1 for either PAC or AUT is a unsigned_intDI_type_node. */
+ rtx op1 = force_reg (DImode, expand_normal (arg1));
icode = (fcode == AARCH64_PAUTH_BUILTIN_PACIA1716
? CODE_FOR_paci1716 : CODE_FOR_auti1716);
- rtx x16_reg = gen_rtx_REG (Pmode, R16_REGNUM);
- rtx x17_reg = gen_rtx_REG (Pmode, R17_REGNUM);
+ rtx x16_reg = gen_rtx_REG (DImode, R16_REGNUM);
+ rtx x17_reg = gen_rtx_REG (ptr_mode, R17_REGNUM);
emit_move_insn (x17_reg, op0);
emit_move_insn (x16_reg, op1);
emit_insn (GEN_FCN (icode) ());
@@ -35,6 +35,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define MD_FROB_UPDATE_CONTEXT(context, fs) \
aarch64_frob_update_context (context, fs)
+typedef unsigned _uw64 __attribute__((mode(__DI__)));
+
/* Do AArch64 private extraction on ADDR based on context info CONTEXT and
unwind frame info FS. If ADDR is signed, we do address authentication on it
using CFA of current frame. */
@@ -45,7 +47,7 @@ aarch64_post_extract_frame_addr (struct _Unwind_Context *context,
{
if (fs->regs.reg[DWARF_REGNUM_AARCH64_RA_STATE].loc.offset & 0x1)
{
- _Unwind_Word salt = (_Unwind_Word) context->cfa;
+ _uw64 salt = (_uw64) context->cfa;
return __builtin_aarch64_autia1716 (addr, salt);
}
else
@@ -64,7 +66,7 @@ aarch64_post_frob_eh_handler_addr (struct _Unwind_Context *current,
{
if (current->flags & RA_A_SIGNED_BIT)
return __builtin_aarch64_pacia1716 (handler_addr,
- (_Unwind_Word) current->cfa);
+ (_uw64) current->cfa);
else
return handler_addr;
}