https://sourceware.org/bugzilla/show_bug.cgi?id=20815
--- Comment #5 from Nick Clifton <nickc at redhat dot com> --- Hi Ma, Thanks for the unpacked files. With those I was able to reproduce the problem, although I am not at all sure yet that it actually represents a problem in the linker. First of all, you state that the ELF specification requires that the program header should be part of the first loadable segment. Can you tell me exactly where in the standard this is stated ? I had a look myself and could not find any such requirement. You see, as far as I can tell the executable generated by the linker *is* a valid ELF format file. It does not work, true, but that is because the kernel is expecting the program headers to be contained in (one of|the first) program segment. But this is not a requirement of the ELF standard. So instead the fault lies squarely with the linker script being used. The linker just did what it was told to do. I do agree however that the linker does have some knowledge of the target environment for which it is creating binaries, so in theory at least, it ought to be able to check that it is generating a valid binary. But this is target specific knowledge, not generic, and as such a patch should be in target specific code (eg bfd/elf64-x86-64.c) rather than generic code (bfd/elf.c). A second problem with your patch is that, whilst it does work for the test case in this PR, it breaks a lot of other tests in the linker testsuite. Now it may be that these tests are "wrong" in the sense that they are not generating binaries that can be executed, and instead they are just intended to test a linker feature, but even so having them fail is not acceptable. All of which leads me to ask if you would consider rewriting your patch so that it is target specific and does not break other linker tests ? Cheers Nick -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils