diff options
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 9 | ||||
-rw-r--r-- | libebl/Makefile.am | 3 | ||||
-rw-r--r-- | libebl/ebl-hooks.h | 6 | ||||
-rw-r--r-- | libebl/eblopenbackend.c | 11 | ||||
-rw-r--r-- | libebl/eblstother.c | 64 | ||||
-rw-r--r-- | libebl/libebl.h | 3 |
6 files changed, 93 insertions, 3 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 96f70ff8..bec6511f 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,12 @@ +2011-03-10 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (gen_SOURCES): Add eblstother.c. + * eblstother.c: New file. + * ebl-hooks.h: Add check_st_other_bits hook. + * eblopenbackend.c (default_check_st_other_bits): New function. + (fill_defaults): Hook default_check_st_other_bits. + * libebl.h (ebl_check_st_other_bits): New prototype. + 2010-07-07 Roland McGrath <roland@redhat.com> * eblopenbackend.c (default_debugscn_p): Match .gdb_index section. diff --git a/libebl/Makefile.am b/libebl/Makefile.am index d157195e..ced5668b 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -50,7 +50,8 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ ebl_check_special_symbol.c eblbsspltp.c eblretval.c \ eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \ eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ - ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c + ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \ + eblstother.c libebl_a_SOURCES = $(gen_SOURCES) diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index 59e73c54..82c6c640 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -1,5 +1,5 @@ /* Backend hook signatures internal interface for libebl. - Copyright (C) 2000-2010 Red Hat, Inc. + Copyright (C) 2000-2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -144,6 +144,10 @@ bool EBLHOOK(relative_reloc_p) (int); bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, const char *, const GElf_Shdr *); +/* Check whether only valid bits are set on the st_other symbol flag. + Standard ST_VISIBILITY have already been masked off. */ +bool EBLHOOK(check_st_other_bits) (unsigned char st_other); + /* Check if backend uses a bss PLT in this file. */ bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *); diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index e11ff067..24f472ce 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -1,5 +1,5 @@ /* Generate ELF backend handle. - Copyright (C) 2000-2010 Red Hat, Inc. + Copyright (C) 2000-2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -202,6 +202,7 @@ static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr); +static bool default_check_st_other_bits (unsigned char st_other); static bool default_check_special_section (Ebl *, int, const GElf_Shdr *, const char *); static bool default_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr); @@ -253,6 +254,7 @@ fill_defaults (Ebl *result) result->none_reloc_p = default_none_reloc_p; result->relative_reloc_p = default_relative_reloc_p; result->check_special_symbol = default_check_special_symbol; + result->check_st_other_bits = default_check_st_other_bits; result->bss_plt_p = default_bss_plt_p; result->return_value_location = default_return_value_location; result->register_info = default_register_info; @@ -698,6 +700,13 @@ default_check_special_symbol (Elf *elf __attribute__ ((unused)), } static bool +default_check_st_other_bits (unsigned char st_other __attribute__ ((unused))) +{ + return false; +} + + +static bool default_bss_plt_p (Elf *elf __attribute__ ((unused)), GElf_Ehdr *ehdr __attribute__ ((unused))) { diff --git a/libebl/eblstother.c b/libebl/eblstother.c new file mode 100644 index 00000000..ba8c9dac --- /dev/null +++ b/libebl/eblstother.c @@ -0,0 +1,64 @@ +/* Check st_other flag. + Copyright (C) 2011 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + + +bool +ebl_check_st_other_bits (ebl, st_other) + Ebl *ebl; + unsigned char st_other; +{ + return ((st_other ^ GELF_ST_VISIBILITY (st_other)) == 0 + || ebl->check_st_other_bits (st_other ^ GELF_ST_VISIBILITY (st_other))); +} diff --git a/libebl/libebl.h b/libebl/libebl.h index c94ad78f..b4307282 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -168,6 +168,9 @@ extern bool ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr); +/* Check whether only valid bits are set on the st_other symbol flag. */ +extern bool ebl_check_st_other_bits (Ebl *ebl, unsigned char st_other); + /* Return combined section header flags value. */ extern GElf_Word ebl_sh_flags_combine (Ebl *ebl, GElf_Word flags1, GElf_Word flags2); |