This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: New x86 linker testsuite failure
On Tue, Jun 26, 2018 at 04:08:40PM +0000, Alan Hayward wrote:
> I would suggest then that the test is no longer valid?
>
> Looking back at the history
> https://sourceware.org/ml/binutils/2007-02/msg00375.html
> https://sourceware.org/bugzilla/show_bug.cgi?id=4007
> The test only existed as a check against invalid files.
To expand on what I said earlier:
> >>> Yeah, and the test really does want to error out as the vma/lma given
> >>> for .foo isn't possible within the text segment.
The ld-i386/alloc test script is asking ld to create a file with
sections where the VMA and LMA is specified, packed into a segment.
LMA is not directly recorded in an ELF file, we calculate it from
segment p_paddr plus section sh_offset. VMA is recorded directly as
section sh_addr.
But there's a problem. VMA can also be calculated from segment
p_vaddr plus section sh_offset, and that VMA doesn't match sh_addr. I
realize you want to allow that mismatch, but the ELF specification
also talks about the "linking view" and "execution view" of a file.
The linking view is given by the section headers, while the execution
view is given by the program headers, and the implication is that only
the program headers are needed for execution of a binary. I believe
that is true on linux kernels with glibc ld.so, and likely on other
unix systems. You can strip out section headers from an executable
and still have it execute properly.
>From what you've said it seems like the armlinker and related runtime
require executable section headers to be present. Well OK, the ELF
standard doesn't prohibit that so I'm fine with objcopy / objdump / nm
/ readelf etc. being modified to handle such binaries, but I think
ld.bfd should continue to error out on an attempt to *create*
executables where the execution view VMAs no longer match linking view
VMAs.
--
Alan Modra
Australia Development Lab, IBM