From: Mark Wielaard Date: Sat, 4 Jan 2014 18:19:16 +0000 (+0100) Subject: backends: Add PPC64 machine_flag_check. X-Git-Tag: elfutils-0.158~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c4a868fa4c3e2a45663a78cc6d1e31089c3b0dc;p=thirdparty%2Felfutils.git backends: Add PPC64 machine_flag_check. To distinguish between the current PPC64 ELF ABI and the revised ELFv2 ABI that will not use function descriptors binutils started to emit the version (currently 1) in the ehdr e_flags. Recognize all valid versions (0, 1 or 2) in elflint by adding the hook ppc64_machine_flag_check. Signed-off-by: Mark Wielaard --- diff --git a/backends/ChangeLog b/backends/ChangeLog index 2074cff31..4ea1acd2b 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2014-01-04 Mark Wielaard + + * ppc64_symbol.c (ppc64_machine_flag_check): New function. + * ppc64_init.c (ppc64_init): Hook machine_flag_check. + 2014-01-03 Mark Wielaard * Makefile.am (aarch64_SRCS): Add aarch64_cfi.c. diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c index d8f1417e4..e52231c9d 100644 --- a/backends/ppc64_init.c +++ b/backends/ppc64_init.c @@ -1,5 +1,5 @@ /* Initialization of PPC64 specific backend library. - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Red Hat, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013, 2014 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper , 2004. @@ -58,6 +58,7 @@ ppc64_init (elf, machine, eh, ehlen) HOOK (eh, reloc_simple_type); HOOK (eh, dynamic_tag_name); HOOK (eh, dynamic_tag_check); + HOOK (eh, machine_flag_check); HOOK (eh, copy_reloc_p); HOOK (eh, check_special_symbol); HOOK (eh, bss_plt_p); diff --git a/backends/ppc64_symbol.c b/backends/ppc64_symbol.c index 244e40f8b..212d4145d 100644 --- a/backends/ppc64_symbol.c +++ b/backends/ppc64_symbol.c @@ -1,5 +1,5 @@ /* PPC64 specific symbolic name handling. - Copyright (C) 2004, 2005 Red Hat, Inc. + Copyright (C) 2004, 2005, 2014 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper , 2004. @@ -110,3 +110,13 @@ ppc64_bss_plt_p (Elf *elf __attribute__ ((unused)), { return true; } + +/* Check whether machine flags are valid. PPC64 has three possible values: + 0 - for unspecified ABI, or not using any specific ABI features. + 1 - for the original ELF PPC64 ABI using function descriptors. + 2 - for the revised ELFv2 PPC64 ABI without function descriptors. */ +bool +ppc64_machine_flag_check (GElf_Word flags) +{ + return flags == 0 || flags == 1 || flags == 2; +}