diff options
| author | Mark Wielaard <[email protected]> | 2018-11-09 08:18:22 +0000 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-11-09 17:34:30 +0100 |
| commit | 4789e0fb92b03c3d8de548489c871d17f8f35cd0 (patch) | |
| tree | 12f4335f80e2a870c52b2819f26eb0025b70d05c /libelf/elf_compress.c | |
| parent | 1628254ba2157ac2b78fc9e103fe0b16fa288a26 (diff) | |
libelf: Explicitly update section data after (de)compression.
We need to explictly trigger a section data reload after updating the
ELF section rawdata to make sure it gets written out to disk on an
elf_update. Doing this showed one bug/inefficiently when the underlying
file has a different endianness. In that case for debug sections we
would convert by allocating a new buffer and just copying over the
raw data into a new buffer. This is not really necessary and would
hide any relocations done on the rawdata by libdwfl.
Added a couple of new ppc64 big endian testfiles that show the issue.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/elf_compress.c')
| -rw-r--r-- | libelf/elf_compress.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c index fd412e8a..d96245df 100644 --- a/libelf/elf_compress.c +++ b/libelf/elf_compress.c @@ -326,6 +326,12 @@ __libelf_reset_rawdata (Elf_Scn *scn, void *buf, size_t size, size_t align, scn->rawdata_base = buf; scn->flags |= ELF_F_MALLOCED; + + /* Pretend we (tried to) read the data from the file and setup the + data (might have to convert the Chdr to native format). */ + scn->data_read = 1; + scn->flags |= ELF_F_FILEDATA; + __libelf_set_data_list_rdlock (scn, 1); } int |
