Linker relaxation and the size of the output section

Hans-Peter Nilsson hp@bitrange.com
Sun Sep 28 20:44:00 GMT 2003


I perceive a need to check the current upper bound of the size
of the output section for a linker relaxation.  This case is for
relocatable linking, to keep it working with relocations that
need a max distance to the end of the section, where a stub
would be at the final link (if not reachable, insert a stub in
the relocatable link).

Unfortunately, that output-section size (calculated in
output_section->_raw_size by lang_size_sections(_1) without
relaxation the first time) is cleared in lang_reset_sections
before any call to lang_size_sections *with* relaxation.  (I
understand why.)

Would it be ok to (ab)use output_section->_cooked_size to keep
the estimate from the last run?  (For example by setting it in
lang_size_sections(_1) at the same time as _raw_size.)  Or
perhaps it would be consider more right to switch them around
and keep the last estimate in _raw_size and the running score in
_cooked_size?  (With all users changed, ugh.)

Alternatively, does anybody know a reason why the output section
size (from the last lang_size_sections call) should not be
looked at when doing linker relaxation?

brgds, H-P



More information about the Binutils mailing list