PATCH: Preserve segment physical address only if needed
H. J. Lu
Thu Nov 23 23:38:00 GMT 2006
On Fri, Nov 24, 2006 at 10:01:21AM +1030, Alan Modra wrote:
> On Thu, Nov 23, 2006 at 03:23:53PM -0800, H. J. Lu wrote:
> > On Fri, Nov 24, 2006 at 09:15:41AM +1030, Alan Modra wrote:
> > > On Thu, Nov 23, 2006 at 08:54:10AM -0800, H. J. Lu wrote:
> > > > + /* If the first section is removed, there is no need to preserve
> > > > + segment virtual address. */
> > > > + if (!first_section || first_section->output_section != NULL)
> > >
> > > This test looks wrong.
> > The first segment may contain program header so that the first section
> > in the first segment may not align with the first segment. In that
> > case, even if the first section in the first segment is removed, we
> > may still want to preserve segment virtual address. In that case,
> > first_section is NULL. We reset the segment virtual address only if
> > the first section, which is alignd with the segment, is removed.
> Fine. But why "|| first_section->output_section != NULL"? Shouldn't
> that be "|| first_section->output_section == NULL"?
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.
More information about the Binutils