diff options
author | Jan Hubicka <jh@suse.cz> | 2003-10-11 19:38:29 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-10-11 17:38:29 +0000 |
commit | 8af11e80aa5fbe9112783beef097aa1d64e96981 (patch) | |
tree | 3b744ee75319df0d768020fed1cc0144a2856fb1 | |
parent | a28e846b41b95044bbb09408ec8de8a7e5400c63 (diff) | |
download | gcc-8af11e80aa5fbe9112783beef097aa1d64e96981.zip gcc-8af11e80aa5fbe9112783beef097aa1d64e96981.tar.gz gcc-8af11e80aa5fbe9112783beef097aa1d64e96981.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/varasm.c | 30 |
2 files changed, 24 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 825eafa..33f366c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sat Oct 11 12:24:23 CEST 2003 Jan Hubicka <jh@suse.cz> + + * varasm.c (notice_global_symbol): Fix handling of variables; avoid + re-computing of variable. + 2003-10-11 Richard Henderson <rth@redhat.com> * config/alpha/alpha.c (alpha_return_in_memory): Rename from diff --git a/gcc/varasm.c b/gcc/varasm.c index 3538072..561dc4a 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; } } |