diff options
author | Roland McGrath <roland@redhat.com> | 2008-08-07 08:39:41 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2008-08-07 08:39:41 +0000 |
commit | 1d8bb25cac06b5af57f8733e5ea7a068a79edfe0 (patch) | |
tree | f794a75ef8e1f324185d2850e6e4da59323fe9ca /libebl | |
parent | 9d2f3ee2554185a9df70f434eddc4405a4aff0fa (diff) | |
download | elfutils-1d8bb25cac06b5af57f8733e5ea7a068a79edfe0.tar.gz |
src/
(find_symbol): Likewise.
Convert plain number, or handle strings like "(section)+offset"
or "symbol+offset".
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 16 | ||||
-rw-r--r-- | libebl/Makefile.am | 2 | ||||
-rw-r--r-- | libebl/ebl-hooks.h | 4 | ||||
-rw-r--r-- | libebl/ebl_syscall_abi.c | 66 | ||||
-rw-r--r-- | libebl/eblauxvinfo.c | 5 | ||||
-rw-r--r-- | libebl/eblopenbackend.c | 17 | ||||
-rw-r--r-- | libebl/libebl.h | 7 |
7 files changed, 114 insertions, 3 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 9838727a..57ac2c8c 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,19 @@ +2008-07-28 Roland McGrath <roland@redhat.com> + + * eblauxvinfo.c (AUXV_TYPES): Add EXECFN. + + * eblauxvinfo.c (ebl_auxv_info): Handle missing elements of standard + table. + +2008-07-04 Roland McGrath <roland@redhat.com> + + * libebl.h: Declare ebl_syscall_abi. + * ebl_syscall_abi.c: New file. + * Makefile.am (gen_SOURCES): Add it. + * ebl-hooks.h: New hook syscall_abi. + * eblopenbackend.c (default_syscall_abi): New function. + (fill_defaults): Use it. + 2008-03-31 Roland McGrath <roland@redhat.com> * ebldynamictagname.c (ebl_dynamic_tag_name): Use hex for unknown tag. diff --git a/libebl/Makefile.am b/libebl/Makefile.am index 0d06a859..c4e4a076 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -59,7 +59,7 @@ 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_check_special_section.c ebl_syscall_abi.c libebl_a_SOURCES = $(gen_SOURCES) diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index 9f6c8d2c..2db1e208 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -158,6 +158,10 @@ ssize_t EBLHOOK(register_info) (Ebl *ebl, const char **prefix, const char **setname, int *bits, int *type); +/* Return system call ABI registers. */ +int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); + /* Disassembler function. */ int EBLHOOK(disasm) (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, diff --git a/libebl/ebl_syscall_abi.c b/libebl/ebl_syscall_abi.c new file mode 100644 index 00000000..2d9a26b6 --- /dev/null +++ b/libebl/ebl_syscall_abi.c @@ -0,0 +1,66 @@ +/* Return system call ABI mapped to DWARF register numbers. + Copyright (C) 2008 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> + + +int +ebl_syscall_abi (ebl, sp, pc, callno, args) + Ebl *ebl; + int *sp; + int *pc; + int *callno; + int args[6]; +{ + return ebl != NULL ? ebl->syscall_abi (ebl, sp, pc, callno, args) : -1; +} diff --git a/libebl/eblauxvinfo.c b/libebl/eblauxvinfo.c index 54583f9f..af65c47b 100644 --- a/libebl/eblauxvinfo.c +++ b/libebl/eblauxvinfo.c @@ -1,5 +1,5 @@ /* Describe known auxv types. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -63,6 +63,7 @@ TYPE (NULL, "") \ TYPE (IGNORE, "") \ TYPE (EXECFD, "d") \ + TYPE (EXECFN, "s") \ TYPE (PHDR, "p") \ TYPE (PHENT, "u") \ TYPE (PHNUM, "u") \ @@ -110,7 +111,7 @@ ebl_auxv_info (ebl, a_type, name, format) const char **format; { int result = ebl->auxv_info (a_type, name, format); - if (result == 0 && a_type < nauxv_types) + if (result == 0 && a_type < nauxv_types && auxv_types[a_type].name != NULL) { /* The machine specific function did not know this type. */ *name = auxv_types[a_type].name; diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 672e834b..8cf42189 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -212,6 +212,8 @@ static ssize_t default_register_info (Ebl *ebl, const char **prefix, const char **setname, int *bits, int *type); +static int default_syscall_abi (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); static bool default_check_object_attribute (Ebl *ebl, const char *vendor, int tag, uint64_t value, const char **tag_name, @@ -253,6 +255,7 @@ fill_defaults (Ebl *result) result->bss_plt_p = default_bss_plt_p; result->return_value_location = default_return_value_location; result->register_info = default_register_info; + result->syscall_abi = default_syscall_abi; result->check_object_attribute = default_check_object_attribute; result->disasm = NULL; result->destr = default_destr; @@ -718,6 +721,20 @@ default_register_info (Ebl *ebl __attribute__ ((unused)), return snprintf (name, namelen, "reg%d", regno); } +static int +default_syscall_abi (Ebl *ebl __attribute__ ((unused)), + int *sp, int *pc, int *callno, int args[6]) +{ + *sp = *pc = *callno = -1; + args[0] = -1; + args[1] = -1; + args[2] = -1; + args[3] = -1; + args[4] = -1; + args[5] = -1; + return -1; +} + static bool default_check_object_attribute (Ebl *ebl __attribute__ ((unused)), const char *vendor __attribute__ ((unused)), diff --git a/libebl/libebl.h b/libebl/libebl.h index 118ae7e7..50258690 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -248,6 +248,13 @@ extern ssize_t ebl_register_info (Ebl *ebl, const char **prefix, const char **setname, int *bits, int *type); +/* Fill in the DWARF register numbers for the registers used in system calls. + The SP and PC are what kernel reports call the user stack pointer and PC. + The CALLNO and ARGS are the system call number and incoming arguments. + Each of these is filled with the DWARF register number corresponding, + or -1 if there is none. Returns zero when the information is available. */ +extern int ebl_syscall_abi (Ebl *ebl, int *sp, int *pc, + int *callno, int args[6]); /* ELF string table handling. */ struct Ebl_Strtab; |