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]

fix alpha glibc build


We failed to frob the string properly, and so wound up
emitting "%T__libc_res" to the assembly file.  Oops.


r~


        * config/alpha/alpha.c (alpha_encode_section_info): Adjust symbol_str
        properly when changing "local-ness".
        * config/alpha/alpha.md (movdi_er_high_g): Allow all symbols.

        * gcc.dg/tls/alias-1.c: New.

Index: gcc/config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.284
diff -c -p -d -u -r1.284 alpha.c
--- gcc/config/alpha/alpha.c	20 Dec 2002 19:42:40 -0000	1.284
+++ gcc/config/alpha/alpha.c	6 Jan 2003 22:55:10 -0000
@@ -1974,18 +1974,22 @@ alpha_encode_section_info (decl, first)
     {
       char *newstr;
       size_t len;
+      char want_prefix = (is_local ? '@' : '%');
+      char other_prefix = (is_local ? '%' : '@');
 
-      if (symbol_str[0] == (is_local ? '@' : '%'))
+      if (symbol_str[0] == want_prefix)
 	{
 	  if (symbol_str[1] == encoding)
 	    return;
 	  symbol_str += 2;
 	}
+      else if (symbol_str[0] == other_prefix)
+	symbol_str += 2;
 
       len = strlen (symbol_str) + 1;
       newstr = alloca (len + 2);
 
-      newstr[0] = (is_local ? '@' : '%');
+      newstr[0] = want_prefix;
       newstr[1] = encoding;
       memcpy (newstr + 2, symbol_str, len);
 	  
Index: gcc/config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.201
diff -c -p -d -u -r1.201 alpha.md
--- gcc/config/alpha/alpha.md	20 Dec 2002 19:42:41 -0000	1.201
+++ gcc/config/alpha/alpha.md	6 Jan 2003 22:55:10 -0000
@@ -5330,10 +5330,12 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi
   [(match_dup 0)]
   "operands[0] = split_small_symbolic_operand (operands[0]);")
 
+;; Accepts any symbolic, not just global, since function calls that
+;; don't go via bsr still use !literal in hopes of linker relaxation.
 (define_insn "movdi_er_high_g"
   [(set (match_operand:DI 0 "register_operand" "=r")
 	(unspec:DI [(match_operand:DI 1 "register_operand" "r")
-		    (match_operand:DI 2 "global_symbolic_operand" "")
+		    (match_operand:DI 2 "symbolic_operand" "")
 		    (match_operand 3 "const_int_operand" "")]
 		   UNSPEC_LITERAL))]
   "TARGET_EXPLICIT_RELOCS"
Index: gcc/testsuite/gcc.dg/tls/alias-1.c
===================================================================
RCS file: gcc/testsuite/gcc.dg/tls/alias-1.c
diff -N gcc/testsuite/gcc.dg/tls/alias-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/gcc.dg/tls/alias-1.c	6 Jan 2003 22:55:14 -0000
@@ -0,0 +1,21 @@
+/* { dg-do link } */
+/* Test that encode_section_info handles the change from externally
+   defined to locally defined (via hidden).   Extracted from glibc.  */
+
+struct __res_state {
+	char x[123];
+};
+
+extern __thread struct __res_state bar
+  __attribute__ ((tls_model ("initial-exec")));
+
+int main()
+{
+  bar.x[0] = 0;
+  return 0;
+}
+
+__thread struct __res_state foo;
+extern __thread struct __res_state bar
+  __attribute__ ((alias ("foo")))
+  __attribute__ ((visibility ("hidden")));


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