Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Define a new NetBSD specific note to encode the code mod...
details: https://anonhg.NetBSD.org/src/rev/d7d9a8fab097
branches: trunk
changeset: 791119:d7d9a8fab097
user: martin <martin%NetBSD.org@localhost>
date: Tue Nov 05 14:26:19 2013 +0000
description:
Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.
diffstat:
sys/kern/exec_elf.c | 19 +++++++++++++++++--
sys/sys/exec_elf.h | 17 ++++++++++++++++-
2 files changed, 33 insertions(+), 3 deletions(-)
diffs (71 lines):
diff -r d697951fa68b -r d7d9a8fab097 sys/kern/exec_elf.c
--- a/sys/kern/exec_elf.c Tue Nov 05 13:09:12 2013 +0000
+++ b/sys/kern/exec_elf.c Tue Nov 05 14:26:19 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.c,v 1.48 2013/10/30 23:32:30 joerg Exp $ */
+/* $NetBSD: exec_elf.c,v 1.49 2013/11/05 14:26:19 martin 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.48 2013/10/30 23:32:30 joerg Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.49 2013/11/05 14:26:19 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@@ -961,6 +961,21 @@
sizeof(epp->ep_machine_arch));
break;
}
+ case ELF_NOTE_TYPE_MCMODEL_TAG:
+ /*
+ * arch specific check for code model
+ */
+#ifdef ELF_MD_MCMODEL_CHECK
+ if (np->n_namesz == ELF_NOTE_MCMODEL_NAMESZ
+ && memcmp(ndata, ELF_NOTE_MCMODEL_NAME,
+ ELF_NOTE_MCMODEL_NAMESZ) == 0) {
+ ELF_MD_MCMODEL_CHECK(epp,
+ ndata + roundup(ELF_NOTE_MCMODEL_NAMESZ, 4),
+ np->n_descsz);
+ break;
+ }
+#endif
+ break;
/*
* Dunno, warn for diagnostic
diff -r d697951fa68b -r d7d9a8fab097 sys/sys/exec_elf.h
--- a/sys/sys/exec_elf.h Tue Nov 05 13:09:12 2013 +0000
+++ b/sys/sys/exec_elf.h Tue Nov 05 14:26:19 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf.h,v 1.131 2013/10/29 00:22:59 christos Exp $ */
+/* $NetBSD: exec_elf.h,v 1.132 2013/11/05 14:26:19 martin Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -983,6 +983,21 @@
/* NetBSD-specific note name */
#define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME
+/*
+ * NetBSD-specific note type: MCMODEL
+ * There should be 1 NOTE per executable.
+ * name: NetBSD\0
+ * namesz: 7
+ * code model: string
+ */
+
+#define ELF_NOTE_TYPE_MCMODEL_TAG 6
+/* NetBSD-specific note name and description sizes */
+#define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ
+/* NetBSD-specific note name */
+#define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME
+
+
#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
#define ELFSIZE ARCH_ELFSIZE
#endif
Home |
Main Index |
Thread Index |
Old Index