Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Use opt_execfmt.h to get build options.



details:   https://anonhg.NetBSD.org/src/rev/c51976dd6ec1
branches:  trunk
changeset: 945707:c51976dd6ec1
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Nov 04 20:54:20 2020 +0000

description:
Use opt_execfmt.h to get build options.

Only include elf32 hooks if we have elf32 defined and elf32 is not the
"native" emulation.  This allows for having compat_netbsd32 without
elf32 (although it's probably not too useful), and also enables arm's
old-ABI usage of compat_netbsd32.

diffstat:

 sys/compat/netbsd32/netbsd32_core.c           |  12 ++++++++++--
 sys/modules/compat_netbsd32_coredump/Makefile |   4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r c2db9fae1993 -r c51976dd6ec1 sys/compat/netbsd32/netbsd32_core.c
--- a/sys/compat/netbsd32/netbsd32_core.c       Wed Nov 04 20:04:01 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_core.c       Wed Nov 04 20:54:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $      */
+/*     $NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,13 +45,17 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.16 2020/11/01 18:51:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $");
 
 #include <sys/compat_stub.h>
 #include <sys/exec_elf.h>
 #include <sys/lwp.h>
 #include <sys/module.h>
 
+#ifdef _KERNEL_OPT
+#include "opt_execfmt.h"
+#endif
+
 #define DEPS "compat_netbsd32,compat_netbsd32_ptrace,coredump"
 
 MODULE(MODULE_CLASS_MISC, compat_netbsd32_coredump, DEPS);
@@ -68,11 +72,15 @@
        switch (cmd) {
        case MODULE_CMD_INIT:
                MODULE_HOOK_SET(coredump_netbsd32_hook, real_coredump_netbsd32);
+#if defined(EXEC_ELF32) && defined(__LP64)
                MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
+#endif
                return 0;
        case MODULE_CMD_FINI:
                MODULE_HOOK_UNSET(coredump_netbsd32_hook);
+#if defined(EXEC_ELF32) && defined(__LP64)
                MODULE_HOOK_UNSET(coredump_elf32_hook);
+#endif
                return 0;
        default:
                return ENOTTY;
diff -r c2db9fae1993 -r c51976dd6ec1 sys/modules/compat_netbsd32_coredump/Makefile
--- a/sys/modules/compat_netbsd32_coredump/Makefile     Wed Nov 04 20:04:01 2020 +0000
+++ b/sys/modules/compat_netbsd32_coredump/Makefile     Wed Nov 04 20:54:20 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2020/11/01 18:51:03 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.2 2020/11/04 20:54:20 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -10,7 +10,7 @@
 .PATH: ${S}/kern
 SRCS+= core_elf32.c
 
-CPPFLAGS+=     -DCOMPAT_NETBSD32
+CPPFLAGS+=     -DCOMPAT_NETBSD32 -DEXEC_ELF32
 
 WARNS= 3
 



Home | Main Index | Thread Index | Old Index