This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Preserve segment physical address only if needed
On Thu, Nov 23, 2006 at 03:38:39PM -0800, H. J. Lu wrote:
> I meant to say "segment physical address". The test is to check if the
> first section isn't removed. If it isn't removed, we will preserve
> segment physical address by setting
>
> map->p_paddr = segment->p_paddr;
> map->p_paddr_valid = 1;
>
> The first section isn't removed only if first_section == NULL or
> first_section->output_section != NULL.
Hmm, OK, that makes some sort of sense. For the first part of your
patch, can you explain why you didn't use something like
for (section = ibfd->sections, section_count = 0;
section != NULL;
section = section->next)
if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed)
{
++section_count;
if (first_section == NULL)
first_section = section;
}
Your comment "Find the first section in this segment" is what the
above does, so if the above doesn't work then you need to accurately
describe why your more complicated code was used. Comments that
don't agree with the code are worse than useless.
--
Alan Modra
IBM OzLabs - Linux Technology Centre