diff options
author | Alan Modra <amodra@gmail.com> | 2024-10-13 15:11:59 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-10-16 14:23:27 +1030 |
commit | 76eab8f47a743bde86be410bce8fd8382eaea6c2 (patch) | |
tree | ee8419145ef7591aeb82084db9b6c9a8ed3353d8 /gdb | |
parent | 3bac89e65f01b978b033f44f62dbe9bc526dd10a (diff) | |
download | binutils-76eab8f47a743bde86be410bce8fd8382eaea6c2.zip binutils-76eab8f47a743bde86be410bce8fd8382eaea6c2.tar.gz binutils-76eab8f47a743bde86be410bce8fd8382eaea6c2.tar.bz2 |
PR32266, segv when linking libclang_rt.asan-powerpc64.so
Change the mmap support added with commit 9ba56acee518 to always mmap
memory with PROT_READ | PROT_WRITE. Prior to that commit most file
contents were read into a buffer allocated with bfd_alloc or
bfd_malloc and thus the memory was read/write. Even after that commit
any section contents with relocations must be read/write to apply the
relocs. Making them all read/write is not a major change, and it
should not introduce any measurable linker slowdown for contents that
are not modified. More importantly, it removes a BFD behaviour
difference that only triggers when large files are involved.
PR 32266
PR 32109
* libbfd.c (bfd_mmap_local): Remove prot param. Always mmap
with PROT_READ | PROT_WRITE. Adjust all calls.
(_bfd_mmap_temporary): Rename from _bfd_mmap_readonly_temporary.
(_bfd_munmap_temporary): Rename from _bfd_munmap_readonly_temporary.
_bfd_mmap_persistent): Rename from _bfd_mmap_readonly_persistent.
(_bfd_generic_get_section_contents): Use PROT_READ | PROT_WRITE
regardless of relocs.
* libbfd-in.h: Update decls to suit. Make non-USE_MMAP variants
static inline functions.
* elflink.c: Update all uses of _bfd_mmap functions.
* elf.c: Likewise.
(bfd_elf_get_str_section): Revert commit 656f8fbaae.
* libbfd.h: Regenerate.
Diffstat (limited to 'gdb')
0 files changed, 0 insertions, 0 deletions