From fec08d85b0f38c46ef72606fb04ed05bc4821ffa Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 10 Sep 2019 10:09:27 +0200 Subject: [PATCH] [ARM/FDPIC v6 21/24] [ARM] FDPIC: Handle stack-protector combined patterns The recent stack_protect_combined_set_insn and stack_protect_combined_test_insn force recomputing of GOT base, but need to take into account that in FDPIC mode, the PIC register is fixed by the ABI (r9). 2019-09-10 Christophe Lyon gcc/ * config/arm/arm.md (stack_protect_combined_set_insn): Handle FDPIC mode. (stack_protect_combined_test_insn): Likewise. From-SVN: r275582 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.md | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afe73b59f5d..3bf2a0b8628 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-10 Christophe Lyon + + * config/arm/arm.md (stack_protect_combined_set_insn): Handle + FDPIC mode. + (stack_protect_combined_test_insn): Likewise. + 2019-09-10 Christophe Lyon Mickaël Guêné diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 918271d7ad5..6513c2d0203 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -8270,8 +8270,15 @@ { if (flag_pic) { + rtx pic_reg; + + if (TARGET_FDPIC) + pic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); + else + pic_reg = operands[3]; + /* Forces recomputing of GOT base now. */ - legitimize_pic_address (operands[1], SImode, operands[2], operands[3], + legitimize_pic_address (operands[1], SImode, operands[2], pic_reg, true /*compute_now*/); } else @@ -8346,8 +8353,15 @@ if (flag_pic) { + rtx pic_reg; + + if (TARGET_FDPIC) + pic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); + else + pic_reg = operands[4]; + /* Forces recomputing of GOT base now. */ - legitimize_pic_address (operands[1], SImode, operands[3], operands[4], + legitimize_pic_address (operands[1], SImode, operands[3], pic_reg, true /*compute_now*/); } else -- 2.30.2