This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: More test results...


Here's a (minimally tested) patch.  I'll pretty it up tomorrow.  Basically,
Kaveh's bss stuff doesn't consider weak/one_only attributes.  This patch
fixes it to handle weak.

*** varasm.c.~1~	Tue Mar 12 01:50:44 2002
--- varasm.c	Tue Mar 12 02:24:53 2002
*************** static void mark_weak_decls		PARAMS ((vo
*** 171,176 ****
--- 176,182 ----
  #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
  static void remove_from_pending_weak_list	PARAMS ((const char *));
  #endif
+ static void globalize_decl		PARAMS ((tree));
  static void maybe_assemble_visibility	PARAMS ((tree));
  static int in_named_entry_eq		PARAMS ((const PTR, const PTR));
  static hashval_t in_named_entry_hash	PARAMS ((const PTR));
*************** assemble_start_function (decl, fnname)
*** 1237,1258 ****
  	    weak_global_object_name = name;
  	}
  
! #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
!       if (DECL_WEAK (decl))
! 	{
! #ifdef ASM_WEAKEN_DECL
! 	  ASM_WEAKEN_DECL (asm_out_file, decl, fnname, 0);
! #else
! 	  ASM_WEAKEN_LABEL (asm_out_file, fnname);
! #endif
! 	  /* Remove this function from the pending weak list so that
! 	     we do not emit multiple .weak directives for it.  */
! 	  remove_from_pending_weak_list
! 	    (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
! 	}
!       else
! #endif
!       ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
  
        maybe_assemble_visibility (decl);
      }
--- 1243,1249 ----
  	    weak_global_object_name = name;
  	}
  
!       globalize_decl (decl);
  
        maybe_assemble_visibility (decl);
      }
*************** asm_emit_uninitialised (decl, name, size
*** 1443,1448 ****
--- 1434,1440 ----
      {
  #ifdef ASM_EMIT_BSS
      case asm_dest_bss:
+       globalize_decl (decl);
        ASM_EMIT_BSS (decl, name, size, rounded);
        break;
  #endif
*************** assemble_variable (decl, top_level, at_e
*** 1657,1680 ****
  
    /* First make the assembler name(s) global if appropriate.  */
    if (TREE_PUBLIC (decl) && DECL_NAME (decl))
!     {
! #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
!       if (DECL_WEAK (decl))
! 	{
! #ifdef ASM_WEAKEN_DECL
! 	  ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
! #else
! 	  ASM_WEAKEN_LABEL (asm_out_file, name);
! #endif
! 	   /* Remove this variable from the pending weak list so that
! 	      we do not emit multiple .weak directives for it.  */
! 	  remove_from_pending_weak_list
! 	    (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
! 	}
!       else
! #endif
!       ASM_GLOBALIZE_LABEL (asm_out_file, name);
!     }
  
    /* Output any data that we will need to use the address of.  */
    if (DECL_INITIAL (decl) == error_mark_node)
--- 1649,1655 ----
  
    /* First make the assembler name(s) global if appropriate.  */
    if (TREE_PUBLIC (decl) && DECL_NAME (decl))
!     globalize_decl (decl);
  
    /* Output any data that we will need to use the address of.  */
    if (DECL_INITIAL (decl) == error_mark_node)
*************** remove_from_pending_weak_list (name)
*** 5151,5156 ****
--- 5131,5160 ----
  }
  #endif /* defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL) */
  
+ static void
+ globalize_decl (decl)
+      tree decl;
+ {
+   const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ 
+ #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
+   if (DECL_WEAK (decl))
+     {
+ #ifdef ASM_WEAKEN_DECL
+       ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
+ #else
+       ASM_WEAKEN_LABEL (asm_out_file, name);
+ #endif
+       /* Remove this function from the pending weak list so that
+ 	 we do not emit multiple .weak directives for it.  */
+       remove_from_pending_weak_list (name);
+       return;
+     }
+   /* else */
+ #endif
+   ASM_GLOBALIZE_LABEL (asm_out_file, name);
+ }
+ 
  /* Emit an assembler directive to make the symbol for DECL an alias to
     the symbol for TARGET.  */
  
*************** assemble_alias (decl, target)
*** 5171,5192 ****
  
    if (TREE_PUBLIC (decl))
      {
! #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
!       if (DECL_WEAK (decl))
! 	{
! #ifdef ASM_WEAKEN_DECL
! 	  ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
! #else
! 	  ASM_WEAKEN_LABEL (asm_out_file, name);
! #endif
! 	  /* Remove this function from the pending weak list so that
! 	     we do not emit multiple .weak directives for it.  */
! 	  remove_from_pending_weak_list
! 	    (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
! 	}
!       else
! #endif
! 	ASM_GLOBALIZE_LABEL (asm_out_file, name);
  
        maybe_assemble_visibility (decl);
      }
--- 5175,5181 ----
  
    if (TREE_PUBLIC (decl))
      {
!       globalize_decl (decl);
  
        maybe_assemble_visibility (decl);
      }

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