[ARM/FDPIC v6 21/24] [ARM] FDPIC: Handle stack-protector combined patterns
authorChristophe Lyon <christophe.lyon@st.com>
Tue, 10 Sep 2019 08:09:27 +0000 (10:09 +0200)
committerChristophe Lyon <clyon@gcc.gnu.org>
Tue, 10 Sep 2019 08:09:27 +0000 (10:09 +0200)
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  <christophe.lyon@st.com>

gcc/
* config/arm/arm.md (stack_protect_combined_set_insn): Handle
FDPIC mode.
(stack_protect_combined_test_insn): Likewise.

From-SVN: r275582

gcc/ChangeLog
gcc/config/arm/arm.md

index afe73b59f5d471ec22b4bc2126c7d9d76367c7ba..3bf2a0b8628dcf6669f33292f1e6efd0ac27e453 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-10  Christophe Lyon  <christophe.lyon@st.com>
+
+       * config/arm/arm.md (stack_protect_combined_set_insn): Handle
+       FDPIC mode.
+       (stack_protect_combined_test_insn): Likewise.
+
 2019-09-10  Christophe Lyon  <christophe.lyon@st.com>
        Mickaël Guêné <mickael.guene@st.com>
 
index 918271d7ad5e263001a342d63f3ab07c076e3a47..6513c2d020301670c05a792fcdba91031d84c26d 100644 (file)
 {
   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
 
   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