Linker relaxation and the size of the output section

Ian Lance Taylor ian@wasabisystems.com
Wed Oct 8 05:01:00 GMT 2003


Alan Modra <amodra@bigpond.net.au> writes:

> Hmm, the following uses of _cooked_size outsize of bfd/ and ld/ are a
> little dubious (or at least unnecessary).  I'm fairly certain that
> nothing beside the linker needs to look at _cooked_size.
> 
> ./gprof/corefile.c:                    + core_syms[i]->section->_cooked_size - 1, max_vma);
> ./gdb/hppa-tdep.c:      && sec->vma + sec->_cooked_size < pc)
> ./sim/mcore/interp.c:   (unsigned long) s_bss->vma , (unsigned long) s_bss->_cooked_size);
> ./sim/mcore/interp.c:    heap_ptr = (unsigned long) s_bss->vma + (unsigned long) s_bss->_cooked_size;

These bits of code should almost certainly be using
bfd_section_size().

As you say, referring directly to cooked_size makes no sense outside
the linker.

For that matter, these bits of code should use bfd_get_section_vma()
rather than ...->vma.

Ian



More information about the Binutils mailing list