From: Jan Hubicka Date: Sat, 11 Oct 2003 17:38:29 +0000 (+0200) Subject: varasm.c (notice_global_symbol): Fix handling of variables; avoid re-computing of... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8af11e80aa5fbe9112783beef097aa1d64e96981;p=gcc.git varasm.c (notice_global_symbol): Fix handling of variables; avoid re-computing of variable. * varasm.c (notice_global_symbol): Fix handling of variables; avoid re-computing of variable. From-SVN: r72343 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 825eafa3073..33f366c4b38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 11 12:24:23 CEST 2003 Jan Hubicka + + * varasm.c (notice_global_symbol): Fix handling of variables; avoid + re-computing of variable. + 2003-10-11 Richard Henderson * config/alpha/alpha.c (alpha_return_in_memory): Rename from diff --git a/gcc/varasm.c b/gcc/varasm.c index 3538072b144..561dc4ace22 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1041,13 +1041,24 @@ default_ctor_section_asm_out_constructor (rtx symbol, void notice_global_symbol (tree decl) { - if ((!first_global_object_name || !weak_global_object_name) - && TREE_PUBLIC (decl) && !DECL_COMMON (decl) - && !DECL_EXTERNAL (decl) - && (TREE_CODE (decl) == FUNCTION_DECL - || (TREE_CODE (decl) == VAR_DECL - && (DECL_INITIAL (decl) != 0 - && DECL_INITIAL (decl) != error_mark_node)))) + const char **type = &first_global_object_name; + + if (first_global_object_name + || !TREE_PUBLIC (decl) || DECL_EXTERNAL (decl) + || !DECL_NAME (decl) + || (TREE_CODE (decl) != FUNCTION_DECL + && (TREE_CODE (decl) != VAR_DECL + || (DECL_COMMON (decl) + && (DECL_INITIAL (decl) == 0 + || DECL_INITIAL (decl) == error_mark_node))))) + return; + + /* We win when global object is found, but it is usefull to know about weak + symbol as well so we can produce nicer unique names. */ + if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl)) + type = &weak_global_object_name; + + if (!*type) { const char *p; char *name; @@ -1056,10 +1067,7 @@ notice_global_symbol (tree decl) p = (* targetm.strip_name_encoding) (XSTR (XEXP (decl_rtl, 0), 0)); name = xstrdup (p); - if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl)) - first_global_object_name = name; - else - weak_global_object_name = name; + *type = name; } }