aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'paxelf.c')
-rw-r--r--paxelf.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/paxelf.c b/paxelf.c
index 93ce760..276c4ea 100644
--- a/paxelf.c
+++ b/paxelf.c
@@ -1,7 +1,7 @@
/*
* Copyright 2003-2006 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.32 2006/01/10 01:32:32 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.33 2006/01/10 01:35:06 vapier Exp $
*
* Copyright 2005-2006 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2006 Mike Frysinger - <vapier@gentoo.org>
@@ -522,3 +522,19 @@ void *elf_findsecbyname(elfobj *elf, const char *name)
return ret;
}
+
+int elf_max_pt_load(elfobj *elf)
+{
+#define MAX_PT_LOAD(B) \
+ if (elf->elf_class == ELFCLASS ## B) { \
+ Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+ switch (EGET(ehdr->e_ident[EI_OSABI])) { \
+ case ELFOSABI_NONE: \
+ case ELFOSABI_ARM: return 2; \
+ case ELFOSABI_OPENBSD: return 7; \
+ } }
+ MAX_PT_LOAD(32)
+ MAX_PT_LOAD(64)
+
+ return 0;
+}