This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/4701: binutils generates invalid klibc-based binary on Linux x86_64
On Wed, Jun 27, 2007 at 05:38:52PM -0700, H. J. Lu wrote:
> On Thu, Jun 28, 2007 at 09:31:40AM +0930, Alan Modra wrote:
> > On Wed, Jun 27, 2007 at 11:44:10AM -0700, H. J. Lu wrote:
> > > On Wed, Jun 27, 2007 at 11:09:03AM -0700, H. J. Lu wrote:
> > > > I don't think we can skip segment alignment on disk when its offset
> > > > < alignment. This patch fixes it. I will try to find a small testcase.
> >
> > Why ever does file offset matter for a segment that isn't loaded from
> > disk??
>
> >From gABI:
[snip]
> I don't think it follows gABI.
I'd like to weasel out of this by claiming that a PT_LOAD segment
isn't a loadable segment if it isn't actually loaded, but I guess I'm
stretching the standard. Also, I'd still like to understand why file
offset matters to klibc for PT_LOAD segments that contain no file
contents. I know ld.so is OK with them. Demand paging of
executables, the underlying reason why p_offset must equal p_vaddr
modulo pagesize, clearly isn't affected.
Not aligning saves considerable space in debug info files and core
files.
> > And if it does matter, this patch can't be correct. The old code used
> > to always align.
>
> The old code has
[snip]
> It won't align under certain conditions.
No, it was always aligned, either by increasing offset or overlapping
a bss segment with previous segments.
--
Alan Modra
IBM OzLabs - Linux Technology Centre