aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-12-01 05:50:11 +0000
committerMike Frysinger <vapier@gentoo.org>2009-12-01 05:50:11 +0000
commit78c7a58f413e7eb89422f5cf4a243f44e94a4f6c (patch)
treecd246b090c24c8929e01e609698d1277ae62d797
parentavoid using reserved keyword "bool" (diff)
downloadpax-utils-78c7a58f413e7eb89422f5cf4a243f44e94a4f6c.tar.gz
pax-utils-78c7a58f413e7eb89422f5cf4a243f44e94a4f6c.tar.bz2
pax-utils-78c7a58f413e7eb89422f5cf4a243f44e94a4f6c.zip
split st_type and st_bind lookup functions
-rw-r--r--paxelf.c15
-rw-r--r--paxelf.h3
2 files changed, 14 insertions, 4 deletions
diff --git a/paxelf.c b/paxelf.c
index 1c15bb2..47613e8 100644
--- a/paxelf.c
+++ b/paxelf.c
@@ -1,7 +1,7 @@
/*
* Copyright 2003-2007 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.63 2008/12/30 12:59:42 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.64 2009/12/01 05:50:11 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -414,6 +414,15 @@ static pairtype elf_stttypes[] = {
QUERY(STT_FILE),
QUERY(STT_LOPROC),
QUERY(STT_HIPROC),
+ { 0, 0 }
+};
+const char *get_elfstttype(int type)
+{
+ return find_pairtype(elf_stttypes, ELF32_ST_TYPE(type));
+}
+
+/* translate elf STB_ defines */
+static pairtype elf_stbtypes[] = {
QUERY(STB_LOCAL),
QUERY(STB_GLOBAL),
QUERY(STB_WEAK),
@@ -421,9 +430,9 @@ static pairtype elf_stttypes[] = {
QUERY(STB_HIPROC),
{ 0, 0 }
};
-const char *get_elfstttype(int type)
+const char *get_elfstbtype(int type)
{
- return find_pairtype(elf_stttypes, type & 0xF);
+ return find_pairtype(elf_stbtypes, ELF32_ST_BIND(type));
}
/* Read an ELF into memory */
diff --git a/paxelf.h b/paxelf.h
index 3013ec2..0914440 100644
--- a/paxelf.h
+++ b/paxelf.h
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2007 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.h,v 1.50 2008/06/17 17:07:57 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.h,v 1.51 2009/12/01 05:50:11 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -57,6 +57,7 @@ extern const char *get_elf_eabi(elfobj *elf);
extern const char *get_elfemtype(elfobj *elf);
extern const char *get_elfptype(int type);
extern const char *get_elfdtype(int type);
+extern const char *get_elfstbtype(int type);
extern const char *get_elfshttype(int type);
extern const char *get_elfstttype(int type);
extern void *elf_findsecbyname(elfobj *elf, const char *name);