This is the mail archive of the binutils@sources.redhat.com 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]

PATCH: Re: Shared library size anomaly


When the size of an input section is reduced to 0 due to string/constant merging, that section still appears in the output file. This was responsible for increasing the size of libgcj.so by up to 400K depending on how it is linked.

Setting _cooked_size = 0 is not sufficient to remove a section from the output because lang_size_sections code ignores a value of 0 and uses the _raw_size instead.

Please review and apply.

Regards

Bryce.


2003-09-27 Bryce McKinlay <bryce@mckinlay.net.nz>


	* merge.c (_bfd_merge_sections): Set SEC_EXCLUDE flag on sections
	which become empty after merging.

Index: merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.16
diff -u -r1.16 merge.c
--- merge.c	31 Aug 2003 10:07:46 -0000	1.16
+++ merge.c	27 Sep 2003 04:28:01 -0000
@@ -787,11 +787,11 @@
 	  secinfo->sec->_cooked_size = size;
 	}

-	/* Finally shrink all input sections which have not made it into
+	/* Finally remove all input sections which have not made it into
 	   the hash table at all.  */
 	for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
 	  if (secinfo->first == NULL)
-	    secinfo->sec->_cooked_size = 0;
+	    secinfo->sec->flags |= SEC_EXCLUDE;
     }

return TRUE;



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