From acc4a8b8ac83077819948126bc7501d35eb1ea74 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 22 Feb 2020 12:46:33 +1030 Subject: [PATCH] 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) --- bfd/elf.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bfd/elf.c b/bfd/elf.c index a8d98a6..f02b724 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5934,7 +5934,11 @@ assign_file_positions_for_load_sections (bfd *abfd, _bfd_error_handler (_("%pB: error: PHDR segment not covered" " by LOAD segment"), abfd); - return FALSE; + if (link_info == NULL) + return FALSE; + /* Arrange for the linker to exit with an error, deleting + the output file unless --noinhibit-exec is given. */ + link_info->callbacks->info ("%X"); } /* Check that all sections are in a PT_LOAD segment. -- 1.8.3.1