[PATCH] Make global file function names link unique
Ian Lance Taylor
iant@google.com
Wed Jan 31 05:08:00 GMT 2007
"John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:
> Index: varasm.c
> ===================================================================
> --- varasm.c (revision 121370)
> +++ varasm.c (working copy)
> @@ -1307,6 +1307,7 @@
> void
> notice_global_symbol (tree decl)
> {
> + static bool shlib_global_object_flag = false;
> const char **type = &first_global_object_name;
>
> if (first_global_object_name
> @@ -1321,11 +1322,25 @@
> || !MEM_P (DECL_RTL (decl)))
> return;
>
> - /* We win when global object is found, but it is useful to know about weak
> - symbol as well so we can produce nicer unique names. */
> + /* We win when a global object is found that can't be overridden, but
> + it is useful to know about other global objects so we can produce
> + nicer unique names. */
> if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl))
> - type = &weak_global_object_name;
> + {
> + if (weak_global_object_name)
> + return;
>
> + type = &weak_global_object_name;
> + }
> + else if (flag_shlib)
> + {
> + if (shlib_global_object_flag)
> + return;
> +
> + shlib_global_object_flag = true;
> + type = &weak_global_object_name;
> + }
> +
> if (!*type)
> {
> const char *p;
This patch seems equivalent to the one line patch:
if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl) || flag_shlib)
I'll approve that patch, if it works, and if it passes bootstrap and
testsuite.
Thanks.
Ian
More information about the Gcc-patches
mailing list