merge from gcc
[deliverable/binutils-gdb.git] / gas / symbols.c
index 761a0208515bd6fffc1e9b16f5b420d5a562f938..8caaf4a441eaf5de12d914b3a20a7d9e09df1b6a 100644 (file)
@@ -1,6 +1,6 @@
 /* symbols.c -symbol table-
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003
+   1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -1812,7 +1812,9 @@ S_IS_LOCAL (symbolS *s)
     return 1;
 
   if (flag_strip_local_absolute
-      && (flags & BSF_GLOBAL) == 0
+      /* Keep BSF_FILE symbols in order to allow debuggers to identify
+        the source file even when the object file is stripped.  */
+      && (flags & (BSF_GLOBAL | BSF_FILE)) == 0
       && bfd_get_section (s->bsym) == absolute_section)
     return 1;
 
@@ -2260,7 +2262,16 @@ symbol_set_bfdsym (symbolS *s, asymbol *bsym)
 {
   if (LOCAL_SYMBOL_CHECK (s))
     s = local_symbol_convert ((struct local_symbol *) s);
-  s->bsym = bsym;
+  /* Usually, it is harmless to reset a symbol to a BFD section
+     symbol. For example, obj_elf_change_section sets the BFD symbol
+     of an old symbol with the newly created section symbol. But when
+     we have multiple sections with the same name, the newly created
+     section may have the same name as an old section. We check if the
+     old symbol has been already marked as a section symbol before
+     resetting it.  */
+  if ((s->bsym->flags & BSF_SECTION_SYM) == 0)
+    s->bsym = bsym;
+  /* else XXX - What do we do now ?  */
 }
 
 #endif /* BFD_ASSEMBLER */
This page took 0.023755 seconds and 4 git commands to generate.