diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 10 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.md | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/alias-1.c | 21 |
4 files changed, 38 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e23a008744..90ac3867982 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-01-06 Richard Henderson <rth@redhat.com> + + * 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. + 2003-01-06 Dale Johannesen <dalej@apple.com> * config/darwin-protos.h: Add prototypes for new section functions. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index e28f3195b3d..ce0810d0d26 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1,6 +1,6 @@ /* Subroutines used for code generation on the DEC Alpha. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GNU CC. @@ -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); diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 523b1d2b3eb..ed93441b8f6 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -1,6 +1,6 @@ ;; Machine description for DEC Alpha for GNU C compiler ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -;; 2000, 2001, 2002 Free Software Foundation, Inc. +;; 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) ;; ;; This file is part of GNU CC. @@ -5330,10 +5330,12 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" [(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" diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c new file mode 100644 index 00000000000..3372da3d10c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/alias-1.c @@ -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"))); |