This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Linker relaxation and the size of the output section
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 28 Sep 2003 16:44:29 -0400 (EDT)
- Subject: Linker relaxation and the size of the output section
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