This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to the way BFD reads overlaid ELF sections


On Thu, May 02, 2002 at 04:14:15PM +0100, Richard Sandiford wrote:
> then we end up with two segments that have the same file offset,
> file size (0), VMA, and memory size.  Is it reasonable to expect
> BFD to get the mapping right in this case?

This is getting difficult.  I don't think you can.

> The only way I can think of making it work is to have the
> file offsets for zeroed sections and segments point to the
> segment structure itself.  Would that go against the ELF spec?

Yes, I believe it violates the ELF spec.

> I notice (for the section case) it says:
> 
>     One section type, SHT_NOBITS described below, occupies no
>     space in the file, and its sh_offset member locates the
>     conceptual placement in the file
> 
> but I don't really understand what "conceptual placement" is,
> or how it affects things.

Well, if they _did_ occupy space, that's where they would be in the
file.

> Checking
> 
>     hdr->sh_offset + hdr->sh_size     against both
>     phdr->p_offset + phdr->p_memsz    and
>     phdr->p_offset + phdr->p_filesz
> 
> seems to be redundant, since p_memsz can't be smaller than p_filesz.

Err, since p_filesz must be smaller, it's the more restrictive
limit, no?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]