This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RS6000] Set uses_pic_offset_table on sysv secure-plt calls and tls.


Segher, you'll recognize these as your patches from pr88343.  All I've
done here is give you a testcase for the legitimize_tls_address change
(which you said you had no idea what the patch was for!)
----
Fixes lack of r30 save/restore on powerpc-linux.

// -m32 -fpic -ftls-model=initial-exec
__thread char* p;
char** f1 (void) { return &p; }

and

// -m32 -fpic -msecure-plt
extern int foo (int);
int f1 (int x) { return foo (x); }

	PR target/88343
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address),
	(rs6000_call_sysv): Set uses_pic_offset_table.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 883361cabbe..ab01dee9b68 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8705,7 +8705,10 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
       else
 	{
 	  if (flag_pic == 1)
-	    got = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
+	    {
+	      crtl->uses_pic_offset_table = 1;
+	      got = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
+	    }
 	  else
 	    {
 	      rtx gsym = rs6000_got_sym ();
@@ -38068,7 +38071,10 @@ rs6000_call_sysv (rtx value, rtx func_desc, rtx tlsarg, rtx cookie)
       && (!SYMBOL_REF_LOCAL_P (func_addr)
 	  || SYMBOL_REF_EXTERNAL_P (func_addr)
 	  || SYMBOL_REF_WEAK (func_addr)))
-    call[n++] = gen_rtx_USE (VOIDmode, pic_offset_table_rtx);
+    {
+      crtl->uses_pic_offset_table = 1;
+      call[n++] = gen_rtx_USE (VOIDmode, pic_offset_table_rtx);
+    }
 
   call[n++] = gen_hard_reg_clobber (Pmode, LR_REGNO);
 

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]