Summary: | [2.34 Regression] error: PHDR segment not covered by LOAD segment | ||
---|---|---|---|
Product: | binutils | Reporter: | H.J. Lu <hjl.tools> |
Component: | ld | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | amodra |
Priority: | P2 | ||
Version: | 2.35 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Bug Depends on: | |||
Bug Blocks: | 4499 |
Description
H.J. Lu
2020-02-21 13:07:54 UTC
This isn't a binutils bug, unless you believe that "PHDR segment not covered by LOAD segment" should not cause a link error. I think the ELF standard is quite clear: "PT_PHDR ... may occur only if the program header table is part of the memory image of the program" binutils-2.30, 2.31, 2.32 and 2.33 all generate a PHDR that isn't loaded by any LOAD segment, but the code checking for that problem was ineffective. This needs fixing in the linker script used by the project, or since it seems like the binary being generated is never meant to run directly on a glibc system, by linking with --no-dynamic-linker. The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b3c27152b5695177a2cd5adc0d7b0255f99aca0 commit 7b3c27152b5695177a2cd5adc0d7b0255f99aca0 Author: Alan Modra <amodra@gmail.com> Date: Sat Feb 22 12:46:33 2020 +1030 PR25585, PHDR segment not covered by LOAD segment I closed this bug as invalid, but I think it is worth mentioning in NEWS that older linkers didn't check PT_PHDR very well. The patch also allows people to force an output file with --noinhibit-exec after the error. bfd/ PR 25585 * elf.c (assign_file_positions_for_load_sections): Continue linking on "PHDR segment not covered by LOAD segment" errors. ld/ PR 25585 * NEWS: Mention better "PHDR segment not covered by LOAD segment" checking. The binutils-2_34-branch branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=acc4a8b8ac83077819948126bc7501d35eb1ea74 commit acc4a8b8ac83077819948126bc7501d35eb1ea74 Author: Alan Modra <amodra@gmail.com> Date: Sat Feb 22 12:46:33 2020 +1030 PR25585, PHDR segment not covered by LOAD segment I closed this bug as invalid, but I think it is worth mentioning in NEWS that older linkers didn't check PT_PHDR very well. The patch also allows people to force an output file with --noinhibit-exec after the error. bfd/ PR 25585 * elf.c (assign_file_positions_for_load_sections): Continue linking on "PHDR segment not covered by LOAD segment" errors. ld/ PR 25585 * NEWS: Mention better "PHDR segment not covered by LOAD segment" checking. (cherry picked from commit 7b3c27152b5695177a2cd5adc0d7b0255f99aca0) |