summaryrefslogtreecommitdiffstats
path: root/libelf/elf_update.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2022-04-24 19:42:29 +0200
committerMark Wielaard <[email protected]>2022-04-24 19:42:29 +0200
commit3cf386984c1870c2b39ec3fb47b0deb7b30535c3 (patch)
treed30cf878192f3a4a08fcbe9fd559a1d7e84e5268 /libelf/elf_update.c
parent6398e94e9ac9a170da088768198d4a2b6e989e19 (diff)
libelf: Check for mremap, elf_update needs it for ELF_C_RDWR_MMAP
Add a AC_CHECK_FUNCS configure check for mremap. Some systems like KFreeBSD and the Hurd don't have it. Also add a configure warning because without mremap elf_update will often fail when ELF_C_RDWR_MMAP is used. ELF_C_RDWR_MMAP is an elfutils extension to libelf. https://sourceware.org/bugzilla/show_bug.cgi?id=27337 Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/elf_update.c')
-rw-r--r--libelf/elf_update.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index 9b8867ce..97ca9ca9 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -106,8 +106,10 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum)
if (elf->cmd == ELF_C_RDWR_MMAP
&& (size_t) size > elf->maximum_size)
{
+#ifdef HAVE_MREMAP
if (mremap (elf->map_address, elf->maximum_size,
size, 0) == MAP_FAILED)
+#endif
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return -1;