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: [GOLD][PATCH PROPOSAL] prevent discarding of needed local symbols for the relocatable objects


>> This patch fixes the problem. Is this OK, or were you thinking that
>> do_finalize_local_symbols() shouldn't even assign the symbol index
>> when -s is set?
>
> I was thinking the latter. ?I see that do_count_local_symbols checks
> discard_locals. ?It sounds like it should also test strip_all. ?A patch
> for that is preapproved if it works.

That works. I've committed the following patch.

-cary


	* object.cc (Sized_relobj::do_count_local_symbols): Check for
	strip_all (-s).


Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.138
diff -u -p -r1.138 object.cc
--- object.cc	18 Apr 2011 05:39:43 -0000	1.138
+++ object.cc	11 May 2011 00:25:55 -0000
@@ -1824,6 +1824,7 @@ Sized_relobj<size, big_endian>::do_count
   unsigned int dyncount = 0;
   // Skip the first, dummy, symbol.
   psyms += sym_size;
+  bool strip_all = parameters->options().strip_all();
   bool discard_all = parameters->options().discard_all();
   bool discard_locals = parameters->options().discard_locals();
   for (unsigned int i = 1; i < loccount; ++i, psyms += sym_size)
@@ -1882,7 +1883,8 @@ Sized_relobj<size, big_endian>::do_count
           ++dyncount;
         }

-      if (discard_all && lv.may_be_discarded_from_output_symtab())
+      if (strip_all
+	  || (discard_all && lv.may_be_discarded_from_output_symtab()))
 	{
 	  lv.set_no_output_symtab_entry();
 	  continue;


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