C++ Issue on GCC 3.0 branch

John David Anglin dave@hiauly1.hia.nrc.ca
Mon Apr 23 08:29:00 GMT 2001


>   > Regarding the constructors for global initialization, I think that
>   > Jeff's patch truncating the length of section (subspace) names
>   > needs to be reverted.  I am getting a bunch of unresolved symbol
>   > references from the dynamic loader involving global constructor
>   > names that have been truncated.
> This sounds like you haven't rebuilt collect2 after my change for NM_FLAGS.

No, collect was definitely rebuilt.

> The whole purpose of the change is to not get false hits when collect2
> search for ctors/dtors which lead to undefined symbols.
> 
> I'd rather not remove "-p" just because hpux's nm core dumps with the option
> unless having the option gives us no benefit.  I'm not likely revert the
> truncation of section names, even if we remove -p.  Once bitten, twice shy.

The patch was to remove " -n", not "-p" from NM_FLAGS.  HP nm doesn't dump
core on objects with long subspace names when "-p" is used.  This allows
using the long subspace names again, although I would have prefered not to
because of the bug in HP nm.  With "-p", the subspaces aren't output and
there are no false hits.

This is the change to the subspace output.  It fixes various missing
global names.  I don't fully understand the problem but I did see that
the missing constructors in the shared library had truncated names.
I use GNU nm rather than HP nm for my builds.  Thus, there is no possibilty
for false hits.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-04-22  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* som.h: Don't truncate subspace names.

--- som.h.save	Sun Apr 22 15:18:51 2001
+++ som.h	Sun Apr 22 19:32:15 2001
@@ -135,7 +135,7 @@
       fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
     else if (TARGET_GAS)						\
       fprintf (FILE,							\
-	       "\t.SUBSPA .%.30s\n", name);				\
+	       "\t.SUBSPA .%s\n", name);				\
   }
     
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
@@ -280,10 +280,10 @@
       fputs ("\t.SPACE $TEXT$\n", FILE);			\
       if (TARGET_GAS)						\
 	fprintf (FILE,						\
-	       "\t.NSUBSPA %.31s,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24\n", NAME);\
+	       "\t.NSUBSPA %s,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24\n", NAME);\
       else							\
 	fprintf (FILE,						\
-	       "\t.NSUBSPA $%.29s$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24\n", NAME);\
+	       "\t.NSUBSPA $%s$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24\n", NAME);\
     }								\
   else if (!RELOC && DECL && DECL_READONLY_SECTION (DECL, RELOC))\
     {								\



More information about the Gcc mailing list