_cooked_size usually set when/where?

Alan Modra amodra@bigpond.net.au
Wed Mar 31 08:55:00 GMT 2004


On Tue, Mar 30, 2004 at 04:36:42PM -0600, Brian Ford wrote:
> On Tue, 30 Mar 2004, Alan Modra wrote:
> 
> > On Mon, Mar 29, 2004 at 04:33:37PM -0600, Brian Ford wrote:
> > > So, my question is, when is _cooked_size usually set up and by whom?
> >
> > ldlang.c:lang_size_sections_1, and perhaps earlier, eg.
> > ldemul_before_allocation.
> 
> Thanks for the reply.  Those set the output section's _cooked_size right?

No, they set input section _cooked_size too.

As an aside, I think the current use of _raw_size and _cooked_size in
binutils is a bit of a mess.  My main dislike is numerous places that
use _cooked_size if non-zero and use _raw_size otherwise.  In the past
I've advocated using _raw_size and an adjustment, initially zero, in
all places that use _cooked_size.  You could do the same thing by
writing/reading _cooked_size in all places *except* for places that
really want the original on-disk size of input sections.  This is a
simple conceptual change, but changing bfd to use this scheme is tedious
and likely to introduce errors as there are many places that
(incorrectly) change _raw_size to something other than the original
section size.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list