aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-02-22 12:46:33 +1030
committerAndreas K. Huettel <dilfridge@gentoo.org>2020-02-29 18:42:11 +0100
commita1ee354a376d2790ef4e7eadc9683910e0763598 (patch)
treede07aa32b3e6a508f58be14f69a8bab5855035c8
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-a1ee354a376d2790ef4e7eadc9683910e0763598.tar.gz
binutils-gdb-a1ee354a376d2790ef4e7eadc9683910e0763598.tar.bz2
binutils-gdb-a1ee354a376d2790ef4e7eadc9683910e0763598.zip
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)
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c6
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/NEWS6
4 files changed, 23 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 17cb9775b5..e5da1b4658 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-22 Alan Modra <amodra@gmail.com>
+
+ PR 25585
+ * elf.c (assign_file_positions_for_load_sections): Continue linking
+ on "PHDR segment not covered by LOAD segment" errors.
+
2020-02-19 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/25355
diff --git a/bfd/elf.c b/bfd/elf.c
index a8d98a60f4..f02b7249dd 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.
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 999e0f4e33..ebbf64e893 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-22 Alan Modra <amodra@gmail.com>
+
+ PR 25585
+ * NEWS: Mention better "PHDR segment not covered by LOAD segment"
+ checking.
+
2020-02-14 Nick Clifton <nickc@redhat.com>
Import from the mainline:
diff --git a/ld/NEWS b/ld/NEWS
index f659ccfc06..7734d23d5b 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -2,6 +2,12 @@
Changes in 2.34:
+* The ld check for "PHDR segment not covered by LOAD segment" is more
+ effective, catching cases that were wrongly allowed by previous versions of
+ ld. If you see this error it is likely you are linking with a bad linker
+ script or the binary you are building is not intended to be loaded by a
+ dynamic loader. In the latter case --no-dynamic-linker is appropriate.
+
* cr16c support removed.
* Add support for z80-elf.