This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix failure of g++.old-deja/g++.abi/cxa_vec.C on 32-bit hppa*-*-hpux*
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Dec 2005 23:30:59 -0500 (EST)
- Subject: [patch] Fix failure of g++.old-deja/g++.abi/cxa_vec.C on 32-bit hppa*-*-hpux*
As noted in PR target/25168, the failure of cxa_vec.C is caused by identical
symbol names being used for the start of the FDE for the cxa_vec.o object
and an object in libstdc++.sl. The breaks the fde search. This occurs
because cxa_vec.C overloads new. This only happens on systems using collect2
(collect2_eh_frame_section) with EH data in the data section.
get_file_function_name_long only promises to generate a name unique
to the object. So, the use of this function by get_file_function_name_long
is a bit of a stretch.
This change resolves the problem by adding an additional string derived
from the object's input file name to the global object name. There's
no perfect way to do this, but if a conflict occurs, a user could change
the file name of the object being used.
In my first crack at this, I just used the alternate path in this function
which handles the case where first_global_object_name is zero. This
approach caused a number of pch testsuite failures due to the randomness
introduced into the identifier name. This didn't actually seem to break
pch, but I decided that it would be better to stick with a deterministic
name.
Tested on hppa2.0w-hp-hpux11.11. Ok for 4.1 and 4.2?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2005-12-04 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/25168
* tree.c (get_file_function_name_long): Concatenate the first global
object name with a string derived from the input filename of the object
for type "F".
Index: tree.c
===================================================================
--- tree.c (revision 108015)
+++ tree.c (working copy)
@@ -5904,7 +5904,26 @@
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