[ARM/FDPIC,v6,21/24,ARM] FDPIC: Handle stack-protector combined patterns
diff mbox series

Message ID 20190909154526.11630-22-christophe.lyon@st.com
State New
Headers show
Series
  • FDPIC ABI for ARM
Related show

Commit Message

Christophe Lyon Sept. 9, 2019, 3:45 p.m. UTC
From: Christophe Lyon <christophe.lyon@linaro.org>

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-XX-XX  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.

Change-Id: I0e47cf30cfe0dc401f43bd728aaae07bffa4c9cc

Patch
diff mbox series

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 918271d..6513c2d 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