Getting rid of BFD section->_raw_size and section->_cooked_size

Andrew Cagney cagney@gnu.org
Wed Oct 22 14:35:00 GMT 2003
Ya!  And nice timing.  Its really good to see BFD tightening the hatch 
on its interfaces!  The tighter the iterfaces, the greater the freedom 
to inovate the internals.

Some, slightly mindless, suggestions taken from an external point of 
view follow.

- bfd_section_size (abfd, sec)
- bfd_unaltered_section_size (abfd, sec)

Per a recent post from me, if the BFD isn't needed, don't include it. 
GDB, in various places, is draging around "struct bfd"s just so that it 
can it pass (unused) into these methods.  Also, an alternative name, 
such as bfd_section_current_size (sec), would drop a stronger hint that 
the former can and will change.  However, whichever.

bfd_set_section_size (abfd, sec, size)

If the intent is for this method to only be used when constructing a 
section then a full initialization method, such as bfd_section_init 
VARIANT (sec, variant argument list), will be better.  No matter how 
hard you try, people will subvert the _raw_size-write method in ways you 
never intend, "trust me" :-).

bfd_incr_section_size
bfd_incr_set_section_size

Suggest bfd_section_adjust_size(sec).  "incr" strongly suggests only 
positive adjustment is permitted, and that negative adjustments requires 
the use of the [missing] "decr" method :-)   A word like "adjust", being 
more vague, should make the general intent clear.

Happy hacking!
Andrew



More information about the Binutils mailing list