Commit 52fd80fb by Richard Henderson Committed by Richard Henderson

alpha.c (alpha_encode_section_info): Adjust symbol_str properly when changing "local-ness".

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

From-SVN: r60961
parent a16b43c5
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> 2003-01-06 Dale Johannesen <dalej@apple.com>
* config/darwin-protos.h: Add prototypes for new section functions. * config/darwin-protos.h: Add prototypes for new section functions.
......
/* Subroutines used for code generation on the DEC Alpha. /* Subroutines used for code generation on the DEC Alpha.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 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) Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GNU CC. This file is part of GNU CC.
...@@ -1974,18 +1974,22 @@ alpha_encode_section_info (decl, first) ...@@ -1974,18 +1974,22 @@ alpha_encode_section_info (decl, first)
{ {
char *newstr; char *newstr;
size_t len; 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) if (symbol_str[1] == encoding)
return; return;
symbol_str += 2; symbol_str += 2;
} }
else if (symbol_str[0] == other_prefix)
symbol_str += 2;
len = strlen (symbol_str) + 1; len = strlen (symbol_str) + 1;
newstr = alloca (len + 2); newstr = alloca (len + 2);
newstr[0] = (is_local ? '@' : '%'); newstr[0] = want_prefix;
newstr[1] = encoding; newstr[1] = encoding;
memcpy (newstr + 2, symbol_str, len); memcpy (newstr + 2, symbol_str, len);
......
;; Machine description for DEC Alpha for GNU C compiler ;; Machine description for DEC Alpha for GNU C compiler
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ;; 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) ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
;; ;;
;; This file is part of GNU CC. ;; This file is part of GNU CC.
...@@ -5330,10 +5330,12 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" ...@@ -5330,10 +5330,12 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
[(match_dup 0)] [(match_dup 0)]
"operands[0] = split_small_symbolic_operand (operands[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" (define_insn "movdi_er_high_g"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(match_operand:DI 1 "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" "")] (match_operand 3 "const_int_operand" "")]
UNSPEC_LITERAL))] UNSPEC_LITERAL))]
"TARGET_EXPLICIT_RELOCS" "TARGET_EXPLICIT_RELOCS"
......
/* { 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")));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment