The internal architecture name of golang is "arm" or "arm64", which has
different naming conventions from netbsd's machine[] or machine_arch[] ("earmv7", "aarch64", etc.) and cannot be used as is. Instead, use define LINUX_GO_RT0_SIGNATURE_ARCH{32,64}.
This commit is contained in:
parent
bbb9625b59
commit
836f4a42d7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_exec.h,v 1.2 2021/11/26 08:56:28 ryo Exp $ */
|
||||
/* $NetBSD: linux_exec.h,v 1.3 2021/11/26 09:05:05 ryo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2021 The NetBSD Foundation, Inc.
|
||||
|
@ -35,5 +35,11 @@
|
|||
#define linux_exec_setup_stack exec_setup_stack
|
||||
|
||||
#define LINUX_GO_RT0_SIGNATURE
|
||||
/*
|
||||
* linux/arm golang architecture name and netbsd machine_arch{,32}[] are
|
||||
* different and cannot be used as is.
|
||||
*/
|
||||
#define LINUX_GO_RT0_SIGNATURE_ARCH32 "arm"
|
||||
#define LINUX_GO_RT0_SIGNATURE_ARCH64 "arm64"
|
||||
|
||||
#endif /* !_AARCH64_LINUX_EXEC_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_exec.h,v 1.11 2021/11/26 08:56:28 ryo Exp $ */
|
||||
/* $NetBSD: linux_exec.h,v 1.12 2021/11/26 09:05:05 ryo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -39,6 +39,11 @@
|
|||
(LINUX_ELF_AUX_ENTRIES * sizeof(Aux32Info) + LINUX_RANDOM_BYTES)
|
||||
|
||||
#define LINUX_GO_RT0_SIGNATURE
|
||||
/*
|
||||
* linux/arm golang architecture name and netbsd machine_arch[] are
|
||||
* different and cannot be used as is.
|
||||
*/
|
||||
#define LINUX_GO_RT0_SIGNATURE_ARCH32 "arm"
|
||||
|
||||
#define linux_exec_setup_stack exec_setup_stack
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_exec_elf32.c,v 1.101 2021/11/26 08:56:28 ryo Exp $ */
|
||||
/* $NetBSD: linux_exec_elf32.c,v 1.102 2021/11/26 09:05:05 ryo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.101 2021/11/26 08:56:28 ryo Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.102 2021/11/26 09:05:05 ryo Exp $");
|
||||
|
||||
#ifndef ELFSIZE
|
||||
/* XXX should die */
|
||||
|
@ -337,11 +337,19 @@ ELFNAME2(linux,go_rt0_signature)(struct lwp *l, struct exec_package *epp, Elf_Eh
|
|||
goto out;
|
||||
|
||||
#if (ELFSIZE == 32)
|
||||
#ifdef LINUX_GO_RT0_SIGNATURE_ARCH32
|
||||
m = LINUX_GO_RT0_SIGNATURE_ARCH32;
|
||||
#else
|
||||
extern struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
|
||||
MODULE_HOOK_CALL(netbsd32_machine32_hook, (), machine, m);
|
||||
#endif
|
||||
#else /* (ELFSIZE == 32) */
|
||||
#ifdef LINUX_GO_RT0_SIGNATURE_ARCH64
|
||||
m = LINUX_GO_RT0_SIGNATURE_ARCH64;
|
||||
#else
|
||||
m = machine;
|
||||
#endif
|
||||
#endif /* (ELFSIZE == 32) */
|
||||
mlen = snprintf(mbuf, sizeof(mbuf), "_rt0_%s_linux", m);
|
||||
if (memmem(tmp, sh[i].sh_size, mbuf, mlen) == NULL)
|
||||
error = ENOEXEC;
|
||||
|
|
Loading…
Reference in New Issue