Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Build failure for ``no options PTRACE''
In article <Pine.NEB.4.64.2010161434570.25027%speedy.whooppee.com@localhost>,
Paul Goyette <paul%whooppee.com@localhost> wrote:
>For a custom kernel build with ``no options PTRACE'' and ``no options
>COREDUMP'' defined, and sources updated on 2020-10-16 at 13:18:24 UTC,
>I get the following linker error:
>
># link SPEEDY/netbsd
>/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld -Map
>netbsd.map --cref -T netbsd.ldscript -Ttext 0xffffffff80200000 -e start
>-z max-page-size=0x200000 -X -o netbsd ${SYSTEM_OBJ:[@]:Nswapnetbsd.o}
>${EXTRA_OBJ} vers.o swapnetbsd.o
>/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld:
>process_machdep.o: in function `ptrace_machdep_dorequest':
>/build/netbsd-local/src/sys/arch/amd64/amd64/process_machdep.c:329:
>undefined reference to `ptrace_update_lwp'
>/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-ld:
>/build/netbsd-local/src/sys/arch/amd64/amd64/process_machdep.c:372:
>undefined reference to `ptrace_update_lwp'
>*** [netbsd] Error code 1
>
>nbmake: stopped in /build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY
>1 error
>
>nbmake: stopped in /build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY
>
>ERROR: Failed to make all in
>"/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY"
>*** BUILD ABORTED ***
process_machdep.c provides 2 functions:
The read+write regs functions: used by ptrace and coredump
The machdep ptrace function: handling used only by ptrace
These dependencies are not reflected correctly in the patch below.
Perhaps we want a regs module by splitting and then coredump
and ptrace depends on that.
This patch puts process_machdep.c in the ptrace module, and
moves all the coredump functions in the coredump module. I have
only compile-tested this.
christos
Index: arch/amd64/amd64/process_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/process_machdep.c,v
retrieving revision 1.48
diff -u -u -r1.48 process_machdep.c
--- arch/amd64/amd64/process_machdep.c 15 Oct 2020 17:37:35 -0000 1.48
+++ arch/amd64/amd64/process_machdep.c 17 Oct 2020 13:19:59 -0000
@@ -76,7 +76,9 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.48 2020/10/15 17:37:35 mgorny Exp $");
+#ifdef _KERNEL_OPT
#include "opt_xen.h"
+#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
Index: arch/amd64/conf/MODULAR
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/MODULAR,v
retrieving revision 1.17
diff -u -u -r1.17 MODULAR
--- arch/amd64/conf/MODULAR 27 Sep 2020 13:48:49 -0000 1.17
+++ arch/amd64/conf/MODULAR 17 Oct 2020 13:19:59 -0000
@@ -4,8 +4,6 @@
# XXX: incomplete
include "arch/amd64/conf/GENERIC"
-options MODULAR # new style module(7) framework
-options MODULAR_DEFAULT_AUTOLOAD
-no acpicpu* at cpu?
-no est0 at cpu0
@@ -85,6 +83,9 @@
-no options AIO
+-no options PTRACE
+-no options COREDUMP
+
-no acpiacad* at acpi? # ACPI AC Adapter
-no acpibat* at acpi? # ACPI Battery
-no acpibut* at acpi? # ACPI Button
Index: arch/amd64/conf/files.amd64
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/files.amd64,v
retrieving revision 1.117
diff -u -u -r1.117 files.amd64
--- arch/amd64/conf/files.amd64 15 Oct 2020 17:40:13 -0000 1.117
+++ arch/amd64/conf/files.amd64 17 Oct 2020 13:19:59 -0000
@@ -47,7 +47,7 @@
file arch/amd64/amd64/gdt.c machdep
file arch/amd64/amd64/machdep.c machdep
file arch/amd64/amd64/prekern.c kaslr
-file arch/amd64/amd64/process_machdep.c machdep
+file arch/amd64/amd64/process_machdep.c machdep & ptrace
file arch/amd64/amd64/trap.c machdep
file arch/x86/x86/fpu.c machdep
file arch/x86/x86/dbregs.c machdep
Index: kern/compat_stub.c
===================================================================
RCS file: /cvsroot/src/sys/kern/compat_stub.c,v
retrieving revision 1.19
diff -u -u -r1.19 compat_stub.c
--- kern/compat_stub.c 20 Nov 2019 19:37:53 -0000 1.19
+++ kern/compat_stub.c 17 Oct 2020 13:20:00 -0000
@@ -280,6 +280,8 @@
struct coredump_offset_hook_t coredump_offset_hook;
struct coredump_write_hook_t coredump_write_hook;
struct coredump_netbsd_hook_t coredump_netbsd_hook;
+struct coredump_elf32_hook_t coredump_elf32_hook;
+struct coredump_elf64_hook_t coredump_elf64_hook;
struct uvm_coredump_walkmap_hook_t uvm_coredump_walkmap_hook;
struct uvm_coredump_count_segs_hook_t uvm_coredump_count_segs_hook;
Index: kern/core_elf32.c
===================================================================
RCS file: /cvsroot/src/sys/kern/core_elf32.c,v
retrieving revision 1.65
diff -u -u -r1.65 core_elf32.c
--- kern/core_elf32.c 10 Oct 2020 00:10:06 -0000 1.65
+++ kern/core_elf32.c 17 Oct 2020 13:20:00 -0000
@@ -109,7 +109,7 @@
#define elf_fpreg CONCAT(process_fpreg, ELFSIZE)
int
-ELFNAMEEND(coredump)(struct lwp *l, struct coredump_iostate *cookie)
+ELFNAMEEND(real_coredump)(struct lwp *l, struct coredump_iostate *cookie)
{
Elf_Ehdr ehdr;
Elf_Shdr shdr;
Index: kern/files.kern
===================================================================
RCS file: /cvsroot/src/sys/kern/files.kern,v
retrieving revision 1.52
diff -u -u -r1.52 files.kern
--- kern/files.kern 7 Sep 2020 03:50:41 -0000 1.52
+++ kern/files.kern 17 Oct 2020 13:20:00 -0000
@@ -16,8 +16,8 @@
file kern/bufq_priocscan.c bufq_priocscan
file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy
file kern/compat_stub.c kern
-file kern/core_elf32.c exec_elf32
-file kern/core_elf64.c exec_elf64
+file kern/core_elf32.c exec_elf32 & coredump
+file kern/core_elf64.c exec_elf64 & coredump
file kern/core_netbsd.c coredump
file kern/cnmagic.c kern
file kern/exec_aout.c exec_aout
Index: kern/kern_core.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_core.c,v
retrieving revision 1.30
diff -u -u -r1.30 kern_core.c
--- kern/kern_core.c 23 May 2020 23:42:43 -0000 1.30
+++ kern/kern_core.c 17 Oct 2020 13:20:00 -0000
@@ -77,6 +77,8 @@
MODULE_HOOK_SET(coredump_write_hook, coredump_write);
MODULE_HOOK_SET(coredump_offset_hook, coredump_offset);
MODULE_HOOK_SET(coredump_netbsd_hook, real_coredump_netbsd);
+ MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
+ MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
MODULE_HOOK_SET(uvm_coredump_walkmap_hook,
uvm_coredump_walkmap);
MODULE_HOOK_SET(uvm_coredump_count_segs_hook,
@@ -85,6 +87,8 @@
case MODULE_CMD_FINI:
MODULE_HOOK_UNSET(uvm_coredump_count_segs_hook);
MODULE_HOOK_UNSET(uvm_coredump_walkmap_hook);
+ MODULE_HOOK_UNSET(coredump_elf64_hook);
+ MODULE_HOOK_UNSET(coredump_elf32_hook);
MODULE_HOOK_UNSET(coredump_netbsd_hook);
MODULE_HOOK_UNSET(coredump_offset_hook);
MODULE_HOOK_UNSET(coredump_write_hook);
Index: kern/kern_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
retrieving revision 1.390
diff -u -u -r1.390 kern_sig.c
--- kern/kern_sig.c 23 May 2020 23:42:43 -0000 1.390
+++ kern/kern_sig.c 17 Oct 2020 13:20:00 -0000
@@ -100,6 +100,7 @@
#include <sys/cpu.h>
#include <sys/module.h>
#include <sys/sdt.h>
+#include <sys/exec_elf.h>
#include <sys/compat_stub.h>
#ifdef PAX_SEGVGUARD
@@ -2343,12 +2344,9 @@
}
/*
- * Many emulations have a common coredump_netbsd() established as their
- * dump routine. Since the "real" code may (or may not) be present in
- * loadable module, we provide a routine here which calls the module
- * hook.
+ * Since the "real" code may (or may not) be present in loadable module,
+ * we provide routines here which calls the module hooks.
*/
-
int
coredump_netbsd(struct lwp *l, struct coredump_iostate *iocookie)
{
@@ -2358,6 +2356,24 @@
return retval;
}
+int
+coredump_elf32(struct lwp *l, struct coredump_iostate *iocookie)
+{
+ int retval;
+
+ MODULE_HOOK_CALL(coredump_elf32_hook, (l, iocookie), ENOSYS, retval);
+ return retval;
+}
+
+int
+coredump_elf64(struct lwp *l, struct coredump_iostate *iocookie)
+{
+ int retval;
+
+ MODULE_HOOK_CALL(coredump_elf64_hook, (l, iocookie), ENOSYS, retval);
+ return retval;
+}
+
/*
* Put process 'p' into the stopped state and optionally, notify the parent.
*/
Index: modules/coredump/Makefile
===================================================================
RCS file: /cvsroot/src/sys/modules/coredump/Makefile,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile
--- modules/coredump/Makefile 20 Nov 2019 19:37:54 -0000 1.6
+++ modules/coredump/Makefile 17 Oct 2020 13:20:00 -0000
@@ -5,7 +5,7 @@
KMOD= coredump
.PATH: ${S}/kern
-SRCS= kern_core.c core_netbsd.c
+SRCS= kern_core.c core_netbsd.c core_elf32.c core_elf64.c
.PATH: ${S}/uvm
SRCS+= uvm_coredump.c
Index: modules/exec_elf32/Makefile
===================================================================
RCS file: /cvsroot/src/sys/modules/exec_elf32/Makefile,v
retrieving revision 1.5
diff -u -u -r1.5 Makefile
--- modules/exec_elf32/Makefile 20 Nov 2019 19:37:54 -0000 1.5
+++ modules/exec_elf32/Makefile 17 Oct 2020 13:20:00 -0000
@@ -19,7 +19,7 @@
.endif
.PATH: ${S}/kern
-SRCS= exec_elf32.c core_elf32.c
+SRCS= exec_elf32.c
WARNS= 3
Index: modules/exec_elf64/Makefile
===================================================================
RCS file: /cvsroot/src/sys/modules/exec_elf64/Makefile,v
retrieving revision 1.4
diff -u -u -r1.4 Makefile
--- modules/exec_elf64/Makefile 20 Nov 2019 19:37:54 -0000 1.4
+++ modules/exec_elf64/Makefile 17 Oct 2020 13:20:00 -0000
@@ -11,7 +11,7 @@
.endif
.PATH: ${S}/kern
-SRCS= exec_elf64.c core_elf64.c
+SRCS= exec_elf64.c
WARNS= 3
Index: modules/ptrace_common/Makefile
===================================================================
RCS file: /cvsroot/src/sys/modules/ptrace_common/Makefile,v
retrieving revision 1.3
diff -u -u -r1.3 Makefile
--- modules/ptrace_common/Makefile 13 Oct 2019 07:28:13 -0000 1.3
+++ modules/ptrace_common/Makefile 17 Oct 2020 13:20:00 -0000
@@ -2,12 +2,12 @@
#
.include "../Makefile.inc"
-.PATH: ${S}/kern
+.PATH: ${S}/kern ${S}/arch/${MACHINE}/${MACHINE}
CPPFLAGS+= -DPTRACE
KMOD= ptrace_common
-SRCS= sys_ptrace_common.c
+SRCS= sys_ptrace_common.c process_machdep.c
WARNS= 3
Index: sys/compat_stub.h
===================================================================
RCS file: /cvsroot/src/sys/sys/compat_stub.h,v
retrieving revision 1.23
diff -u -u -r1.23 compat_stub.h
--- sys/compat_stub.h 8 Mar 2020 00:53:13 -0000 1.23
+++ sys/compat_stub.h 17 Oct 2020 13:20:00 -0000
@@ -377,6 +377,10 @@
(struct coredump_iostate *, enum uio_seg, const void *, size_t));
MODULE_HOOK(coredump_netbsd_hook, int,
(struct lwp *, struct coredump_iostate *));
+MODULE_HOOK(coredump_elf32_hook, int,
+ (struct lwp *, struct coredump_iostate *));
+MODULE_HOOK(coredump_elf64_hook, int,
+ (struct lwp *, struct coredump_iostate *));
MODULE_HOOK(uvm_coredump_walkmap_hook, int,
(struct proc *, int (*)(struct uvm_coredump_state *), void *));
MODULE_HOOK(uvm_coredump_count_segs_hook, int, (struct proc *));
Index: sys/exec_elf.h
===================================================================
RCS file: /cvsroot/src/sys/sys/exec_elf.h,v
retrieving revision 1.167
diff -u -u -r1.167 exec_elf.h
--- sys/exec_elf.h 10 Oct 2020 21:25:51 -0000 1.167
+++ sys/exec_elf.h 17 Oct 2020 13:20:00 -0000
@@ -1439,12 +1439,12 @@
int elf32_copyargs(struct lwp *, struct exec_package *,
struct ps_strings *, char **, void *);
-int coredump_elf32(struct lwp *, struct coredump_iostate *);
void coredump_savenote_elf32(struct note_state *, unsigned int,
const char *, void *, size_t);
int elf32_check_header(Elf32_Ehdr *);
#endif
+int coredump_elf32(struct lwp *, struct coredump_iostate *);
#ifdef EXEC_ELF64
int exec_elf64_makecmds(struct lwp *, struct exec_package *);
@@ -1452,12 +1452,12 @@
int elf64_copyargs(struct lwp *, struct exec_package *,
struct ps_strings *, char **, void *);
-int coredump_elf64(struct lwp *, struct coredump_iostate *);
void coredump_savenote_elf64(struct note_state *, unsigned int,
const char *, void *, size_t);
int elf64_check_header(Elf64_Ehdr *);
#endif
+int coredump_elf64(struct lwp *, struct coredump_iostate *);
#endif /* _KERNEL */
Home |
Main Index |
Thread Index |
Old Index