Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add a elf note to describe the ARM ABI in use. If encou...
details: https://anonhg.NetBSD.org/src/rev/8cc179e15bd9
branches: trunk
changeset: 780672:8cc179e15bd9
user: matt <matt%NetBSD.org@localhost>
date: Fri Aug 03 07:54:14 2012 +0000
description:
Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...
diffstat:
sys/kern/exec_elf.c | 21 +++++++++++++++++++--
sys/sys/exec.h | 4 +++-
sys/sys/exec_elf.h | 15 ++++++++++++++-
3 files changed, 36 insertions(+), 4 deletions(-)
diffs (89 lines):
diff -r b7f86a9d40ad -r 8cc179e15bd9 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c Fri Aug 03 07:51:21 2012 +0000
+++ b/sys/kern/exec_elf.c Fri Aug 03 07:54:14 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.c,v 1.41 2012/06/02 18:32:27 christos Exp $ */
+/* $NetBSD: exec_elf.c,v 1.42 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.41 2012/06/02 18:32:27 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.42 2012/08/03 07:54:14 matt Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@@ -948,6 +948,23 @@
sizeof(epp->ep_pax_flags));
break;
+#ifdef __arm__
+ case ELF_NOTE_TYPE_ARMEABI_TAG:
+ if (np->n_namesz != ELF_NOTE_NETBSD_NAMESZ ||
+ np->n_descsz != ELF_NOTE_ARMEABI_DESCSZ ||
+ memcmp(ndata, ELF_NOTE_NETBSD_NAME,
+ ELF_NOTE_NETBSD_NAMESZ))
+ goto bad;
+ {
+ int tmp = *(int *)(ndata +
+ roundup(ELF_NOTE_NETBSD_NAMESZ,
+ sizeof(int)));
+ if (tmp == ELF_NOTE_ARMEABI_AAPCS)
+ epp->ep_flags |= EXEC_ARM_AAPCS;
+ }
+ break;
+#endif
+
case ELF_NOTE_TYPE_SUSE_VERSION_TAG:
break;
diff -r b7f86a9d40ad -r 8cc179e15bd9 sys/sys/exec.h
--- a/sys/sys/exec.h Fri Aug 03 07:51:21 2012 +0000
+++ b/sys/sys/exec.h Fri Aug 03 07:54:14 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.h,v 1.137 2012/05/02 23:33:11 rmind Exp $ */
+/* $NetBSD: exec.h,v 1.138 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -225,6 +225,8 @@
#define EXEC_32 0x0020 /* 32-bit binary emulation */
#define EXEC_FORCEAUX 0x0040 /* always use ELF AUX vector */
+#define EXEC_ARM_AAPCS 0x8000 /* ARM MD flag: uses AAPCS ABI */
+
struct exec_vmcmd {
int (*ev_proc)(struct lwp *, struct exec_vmcmd *);
/* procedure to run for region of vmspace */
diff -r b7f86a9d40ad -r 8cc179e15bd9 sys/sys/exec_elf.h
--- a/sys/sys/exec_elf.h Fri Aug 03 07:51:21 2012 +0000
+++ b/sys/sys/exec_elf.h Fri Aug 03 07:54:14 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.h,v 1.123 2012/05/22 02:40:06 christos Exp $ */
+/* $NetBSD: exec_elf.h,v 1.124 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -895,6 +895,19 @@
#define ELF_NOTE_PAX_DESCSZ 4
/*
+ * NetBSD-specific note type: aeabi.
+ * There should be 1 NOTE per executable.
+ * name: NetBSD\0
+ * namesz: 6
+ * desc:
+ * word[0]: ABI bitmask
+ * descsz: 4
+ */
+#define ELF_NOTE_TYPE_ARMEABI_TAG 4
+#define ELF_NOTE_ARMEABI_DESCSZ 4
+#define ELF_NOTE_ARMEABI_AAPCS 0x01
+
+/*
* NetBSD-specific core file information.
*
* NetBSD ELF core files use notes to provide information about
Home |
Main Index |
Thread Index |
Old Index