[PATCH] don't output dead COFF section symbols
Mark E.
snowball3@bigfoot.com
Sun Jul 1 12:12:00 GMT 2001
This patch prevents section symbols from symbols that aren't being output
from themselves being output. This has become a nuisance because the gcc 3.0
port of djgpp uses link once sections in the c++ compiler. 'nm -u' on the
final exe shows a lot of undefined dead section symbols that appear in the
output.
Tested with binutils 2.11.2 (as is true of the other patches I've sent
today).
I excluded PE because they handle section symbols differently (natch) than
regular COFF.
If this patch is accepted, please apply.
bfd/ChangeLog:
2001-07-01 Mark Elbrecht <snowball3@softhome.net>
* cofflink.c (_bfd_coff_link_input_bfd) [!COFF_WITH_PE]: Skip
section symbols from sections being discarded.
Index: cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.23
diff -c -p -r1.23 cofflink.c
*** cofflink.c 2001/03/08 21:03:57 1.23
--- cofflink.c 2001/07/01 18:49:33
*************** _bfd_coff_link_input_bfd (finfo, input_b
*** 1501,1506 ****
--- 1501,1517 ----
}
}
+ #ifndef COFF_WITH_PE
+ /* Skip section symbols from those sections marked as discarded. */
+ if (!skip && isym.n_sclass == C_STAT && isym.n_type == T_NULL
+ && isym.n_numaux > 0)
+ {
+ if ((*secpp)->output_section == bfd_abs_section_ptr
+ || (*secpp)->kept_section)
+ skip = true;
+ }
+ #endif
+
/* If we stripping debugging symbols, and this is a debugging
symbol, then skip it. FIXME: gas sets the section to N_ABS
for some types of debugging symbols; I don't know if this is
More information about the Binutils
mailing list