]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Use GElf_Ehdr instead of Elf handle in __libelf_data_type
authorMark Wielaard <mark@klomp.org>
Sun, 1 Nov 2020 17:50:04 +0000 (18:50 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 6 Nov 2020 17:39:40 +0000 (18:39 +0100)
commitf2272dbefd6dbd67af4d46eb6e748522c0c60d74
tree7e93ec8e6a73ff3db5d30add0a2543b2c38d6569
parent6105277a598b3e608b9297c579553a851658fa41
libelf: Use GElf_Ehdr instead of Elf handle in __libelf_data_type

GCC with -flto detects some (very) unlikely issues in error paths.
In theory getting the Ehdr from an Elf handle might fail. But in
most cases where __libelf_data_type is used, we already have the
Ehdr anyway. So simply pass that to __libelf_data_type. In the one
place where we don't have it yet, get it and check for failure
before calling __libelf_data_type.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/ChangeLog
libelf/elf_compress.c
libelf/elf_compress_gnu.c
libelf/elf_getdata.c
libelf/libelfP.h