aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index f0436a78291..acfeb49c738 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5934,7 +5934,26 @@ get_file_function_name_long (const char *type)
char *q;
if (first_global_object_name)
- p = first_global_object_name;
+ {
+ p = first_global_object_name;
+
+ /* For type 'F', the generated name must be unique not only to this
+ translation unit but also to any given link. Since global names
+ can be overloaded, we concatenate the first global object name
+ with a string derived from the file name of this object. */
+ if (!strcmp (type, "F"))
+ {
+ const char *file = main_input_filename;
+
+ if (! file)
+ file = input_filename;
+
+ q = alloca (strlen (p) + 10);
+ sprintf (q, "%s_%08X", p, crc32_string (0, file));
+
+ p = q;
+ }
+ }
else
{
/* We don't have anything that we know to be unique to this translation