This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix unique symbol production in unit-at-a-time


> 
> On Wednesday, Aug 20, 2003, at 05:18 US/Eastern, Jan Hubicka wrote:
> 
> >>http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00991.html
> >>
> >>This is causing a regression, g++.old-deja/g++.pt/instantiate5.C on
> >>i686-unknown-openbsd3.1.
> >>The random number is still better in this case because it looks like
> >>the identifier is not unique enough.
> >Can you please send me the assembler dumps?  I have no idea how symbol
> >with same name can came out in two object files first and get no linker
> >failure.
> 
> I do get a linker failure:
> /tmp//ccfj9995.o: Definition of symbol `__GLOBAL__I__Z3barv' (multiply 
> defined)^M
> /tmp//ccxc9995.o: Definition of symbol `__GLOBAL__I__Z3barv' (multiply 
> defined)^M
> collect2: ld returned 1 exit status^M
> 
> Note openbsd is not ELF on i386 so there is no .ctors section.
> Here the assembler dumps of the two files, instantiate5.C and 
> instantiate5.cc:
> instantiate5.C: 
Hi,
the attached patch should fix the problem.  Can you please test it?
Sorry for the delay - I was traveling past few days so didn't had chance
to look into this earlier.

Honza

Sat Aug 23 23:31:58 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* varasm.c (notice_global_symbol):  Properly deal with weak symbols.
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.380
diff -c -3 -p -r1.380 varasm.c
*** varasm.c	19 Aug 2003 07:37:07 -0000	1.380
--- varasm.c	23 Aug 2003 21:21:08 -0000
*************** void
*** 1048,1058 ****
  notice_global_symbol (tree decl)
  {
    if ((!first_global_object_name || !weak_global_object_name)
!       && TREE_PUBLIC (decl)
        && (TREE_CODE (decl) == FUNCTION_DECL
! 	  || ! (DECL_COMMON (decl)
! 	    	&& (DECL_INITIAL (decl) == 0
! 		    || DECL_INITIAL (decl) == error_mark_node))))
      {
        const char *p;
        char *name;
--- 1048,1058 ----
  notice_global_symbol (tree decl)
  {
    if ((!first_global_object_name || !weak_global_object_name)
!       && TREE_PUBLIC (decl) && !DECL_COMMON (decl)
        && (TREE_CODE (decl) == FUNCTION_DECL
! 	  || (TREE_CODE (decl) == VAR_DECL
! 	      && (DECL_INITIAL (decl) != 0
! 		  && DECL_INITIAL (decl) != error_mark_node))))
      {
        const char *p;
        char *name;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]