summaryrefslogtreecommitdiff
path: root/libelf/elf_begin.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-12-19 01:29:54 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-06 14:27:10 +0100
commit272018bba1f253bae00b5ba280ad0e0f18c04006 (patch)
treef0b20b43f9caf6d193ae9c05f5583699f34bc59d /libelf/elf_begin.c
parentb7105b40ccd73a8e6b7fce6c11d2088eb1298b33 (diff)
downloadelfutils-272018bba1f253bae00b5ba280ad0e0f18c04006.tar.gz
libelf: Add elf_compress and elf_compress_gnu.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf/elf_begin.c')
-rw-r--r--libelf/elf_begin.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index d2920c4e..147f5f4b 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -340,6 +340,7 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
Elf32_Off e_shoff = elf->state.elf32.ehdr->e_shoff;
if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
+ && cmd != ELF_C_READ_MMAP /* We need a copy to be able to write. */
&& (ALLOW_UNALIGNED
|| (((uintptr_t) ((char *) ehdr + e_shoff)
& (__alignof__ (Elf32_Shdr) - 1)) == 0)))
@@ -441,6 +442,7 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
Elf64_Off e_shoff = elf->state.elf64.ehdr->e_shoff;
if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
+ && cmd != ELF_C_READ_MMAP /* We need a copy to be able to write. */
&& (ALLOW_UNALIGNED
|| (((uintptr_t) ((char *) ehdr + e_shoff)
& (__alignof__ (Elf64_Shdr) - 1)) == 0)))