This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [patch bfd]: Don't emit auxilary information for discared sections for pe-coff


2011/9/29 Alan Modra <amodra@gmail.com>:
> On Thu, Sep 29, 2011 at 11:08:00AM +0200, Kai Tietz wrote:
>> > This hunk seems unnecessary, given that coff_write_alien_symbol calls
>> > coff_write_symbol.
>>
>> Well, the difference here is that for debugging-symbols don't discard
>> the name and are entering into string-table. ?Maybe we should set here
>> in this condition symbol->name = "";?
>
> Oh, I see. ?Ignore this comment of mine.

Hi Alan,

So, I reworked this patch as suggest by you to check for linker-flag
skip_discared.
Additionally I check now for any kind of discarded section, not only
linked once ones.

ChangeLog

2011-09-30  Kai Tietz  <ktietz@redhat.com>

	* coffgen.c (coff_write_alien_symbol): Don't write
	symbol for discarded sections, if strip_discarded isn't
	explicit set to false.
	(coff_write_native_symbol): Likewise.

Regression tested for x86_64-w64-mingw32, i686-w64-mingw32, and
i686-pc-cygwin.  Ok for apply?

Regards,
Kai

Index: coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.80
diff -u -r1.80 coffgen.c
--- coffgen.c	17 Aug 2011 00:39:39 -0000	1.80
+++ coffgen.c	30 Sep 2011 07:55:21 -0000
@@ -996,7 +996,15 @@
   asection *output_section = symbol->section->output_section
 			       ? symbol->section->output_section
 			       : symbol->section;
+  struct bfd_link_info *link_info = coff_data (abfd)->link_info;

+  if ((!link_info || link_info->strip_discarded)
+      && !bfd_is_abs_section (symbol->section)
+      && symbol->section->output_section == bfd_abs_section_ptr)
+    {
+      symbol->name = "";
+      return TRUE;
+    }
   native = &dummy;
   native->u.syment.n_type = T_NULL;
   native->u.syment.n_flags = 0;
@@ -1061,6 +1069,15 @@
 {
   combined_entry_type *native = symbol->native;
   alent *lineno = symbol->lineno;
+  struct bfd_link_info *link_info = coff_data (abfd)->link_info;
+
+  if ((!link_info || link_info->strip_discarded)
+      && !bfd_is_abs_section (symbol->symbol.section)
+      && symbol->symbol.section->output_section == bfd_abs_section_ptr)
+    {
+      symbol->symbol.name = "";
+      return TRUE;
+    }

   /* If this symbol has an associated line number, we must store the
      symbol index in the line number field.  We also tag the auxent to


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