[committed] Fix handling of TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC symbol references on PA

John David Anglin dave@hiauly1.hia.nrc.ca
Sat Oct 29 18:38:00 GMT 2011


TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC symbol references
are not legitimate constants because they may require a function call.

This change fixes a bug exposed by the mpfr-3.1.0 testsuite.

Tested on hppa-unknown-linux, hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.
Committed to trunk.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2011-10-29  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR target/50691
	config/pa/pa.c (emit_move_sequence): Legitimize TLS symbol references.
	(pa_legitimate_constant_p): Return false for TLS_MODEL_GLOBAL_DYNAMIC
	and TLS_MODEL_LOCAL_DYNAMIC symbol references.

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 180156)
+++ config/pa/pa.c	(working copy)
@@ -1781,6 +1781,11 @@
   /* Handle the most common case: storing into a register.  */
   else if (register_operand (operand0, mode))
     {
+      /* Legitimize TLS symbol references.  This happens for references
+	 that aren't a legitimate constant.  */
+      if (PA_SYMBOL_REF_TLS_P (operand1))
+	operand1 = legitimize_tls_address (operand1);
+
       if (register_operand (operand1, mode)
 	  || (GET_CODE (operand1) == CONST_INT
 	      && cint_ok_for_move (INTVAL (operand1)))
@@ -10271,6 +10276,16 @@
   if (!NEW_HP_ASSEMBLER && !TARGET_GAS && GET_CODE (x) == LABEL_REF)
     return false;
 
+  /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not
+     legitimate constants.  */
+  if (PA_SYMBOL_REF_TLS_P (x))
+   {
+     enum tls_model model = SYMBOL_REF_TLS_MODEL (x);
+
+     if (model == TLS_MODEL_GLOBAL_DYNAMIC || model == TLS_MODEL_LOCAL_DYNAMIC)
+       return false;
+   }
+
   if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE)
     return false;
 



More information about the Gcc-patches mailing list