summaryrefslogtreecommitdiffstats
path: root/libelf/elf_compress_gnu.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_compress_gnu.c')
-rw-r--r--libelf/elf_compress_gnu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libelf/elf_compress_gnu.c b/libelf/elf_compress_gnu.c
index dfa7c571..1ecd6a08 100644
--- a/libelf/elf_compress_gnu.c
+++ b/libelf/elf_compress_gnu.c
@@ -144,9 +144,10 @@ elf_compress_gnu (Elf_Scn *scn, int inflate, unsigned int flags)
else if (inflate == 0)
{
/* In theory the user could have constucted a compressed section
- by hand. But we always just take the rawdata directly and
- decompress that. */
- Elf_Data *data = elf_rawdata (scn, NULL);
+ by hand. And in practice they do. For example when copying
+ a section from one file to another using elf_newdata. So we
+ have to use elf_getdata (not elf_rawdata). */
+ Elf_Data *data = elf_getdata (scn, NULL);
if (data == NULL)
return -1;
@@ -196,7 +197,7 @@ elf_compress_gnu (Elf_Scn *scn, int inflate, unsigned int flags)
}
__libelf_reset_rawdata (scn, buf_out, size, sh_addralign,
- __libelf_data_type (elf, sh_type));
+ __libelf_data_type (elf, sh_type, sh_addralign));
scn->zdata_base = buf_out;