diff options
author | Alan Modra <amodra@gmail.com> | 2024-02-09 07:04:22 +1030 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2024-02-16 00:49:01 +0100 |
commit | 18d066ff785ef7d0fdf36ffee8c9b795ffa4bbd5 (patch) | |
tree | 1636857cf81146cb864cf746e8e9cc4d81903512 | |
parent | PR 31283 windmc: Parse input correctly on big endian hosts (diff) | |
download | binutils-gdb-18d066ff785ef7d0fdf36ffee8c9b795ffa4bbd5.tar.gz binutils-gdb-18d066ff785ef7d0fdf36ffee8c9b795ffa4bbd5.tar.bz2 binutils-gdb-18d066ff785ef7d0fdf36ffee8c9b795ffa4bbd5.zip |
PR31208, strip can break ELF alignment requirements
In https://sourceware.org/pipermail/binutils/2007-August/053261.html
(git commit 3dea8fca8b86) I disabled a then new linker feature that
removed empty PT_LOAD headers in cases where a user specified program
headers, and for objcopy. This can be a problem for objcopy/strip and
since objcopy operates on sections, any part of a PT_LOAD loading file
contents not covered by a section will be omitted anyway.
PR 31208
* elf.c (_bfd_elf_map_sections_to_segments): Pass remove_empty_load
as true to elf_modify_segment_map for objcopy/strip.
(cherry picked from commit 7f26d260ef76a4cb2873a7815bef187005528c19)
(cherry picked from commit 78f9e9faaa41d628170f6047c3e032a67f9e829d)
-rw-r--r-- | bfd/elf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c index 88c75ae3ce0..8bffd3c5141 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5789,7 +5789,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, elf_seg_map (abfd) = mfirst; } - if (!elf_modify_segment_map (abfd, info, no_user_phdrs)) + if (!elf_modify_segment_map (abfd, info, no_user_phdrs || info == NULL)) return false; for (count = 0, m = elf_seg_map (abfd); m != NULL; m = m->next) |