Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Build failure for ``no options PTRACE''
On Sat, 17 Oct 2020, Paul Goyette wrote:
OK, I updated kern/kern_core.c to #include exec_elf.h and made is past
the modules.
I'll install in the morning and make sure that all combinations of
modules from {coredump, exec_elf32, exec_elf64} work. At the very
least, they all have to successfully load in any sequence without
requiring any circular dependencies!
I guess I actually spoke too soon. #include exec_elf.h allowed me to
compile kern_core.c but it then failed to compile kern/core_elf32.c
with the following errors:
# compile coredump/core_elf32.o
/build/netbsd-local/tools/x86_64/amd64/bin/x86_64--netbsd-gcc -O2 -g -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wsystem-headers -Wno-traditional -Wa,--fatal-warnings -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Werror -Wno-error=address-of-packed-member -ffreestanding -fno-strict-aliasing -Wno-pointer-sign -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -mcmodel=kernel -fno-omit-frame-pointer -I/build/netbsd-local/src_ro/common/include -DDIAGNOSTIC --sysroot=/build/netbsd-local/dest/amd64 -I/build/netbsd-local/src_ro/common/include -DDIAGNOSTIC -nostdinc -I. -I/build/netbsd-local/src_ro/sys/modules/coredump -isystem /build/netbsd-local/src_ro/sys -isystem /build/netbsd-local/src_ro/sys/arch -isystem /build/netbsd-local/src_ro/sys/../common/include -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -c /build/netbsd-local/src_ro/sys/kern/core_elf3
2.c
In file included from /build/netbsd-local/src_ro/sys/kern/core_elf32.c:42:
/build/netbsd-local/src_ro/sys/kern/core_elf32.c: In function 'coredump_note_procinfo':
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:424:13: error: implicit declaration of function 'coredump_savenote_elf32'; did you mean 'coredump_note_elf32'? [-Werror=implicit-function-declaration]
424 | ELFNAMEEND(coredump_savenote)(ns, ELF_NOTE_NETBSD_CORE_PROCINFO,
| ^~~~~~~~~~~~~~~~~
/build/netbsd-local/src_ro/sys/kern/core_elf32.c: In function 'coredump_note_elf32':
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:541:2: error: 'PT32_GETXSTATE' undeclared (first use in this function); did you mean 'PT64_GETXSTATE'?
541 | COREDUMP_MACHDEP_LWP_NOTES(l, ns, d->name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:541:2: note: each undeclared identifier is reported only once for each function it appears in
/build/netbsd-local/src_ro/sys/kern/core_elf32.c: At top level:
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:583:12: error: no previous prototype for 'coredump_savenote_elf32' [-Werror=missing-prototypes]
583 | ELFNAMEEND(coredump_savenote)(struct note_state *ns, unsigned int type,
| ^~~~~~~~~~~~~~~~~
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:583:12: error: conflicting types for 'coredump_savenote_elf32' [-Werror]
/build/netbsd-local/src_ro/sys/kern/core_elf32.c:424:13: note: previous implicit declaration of 'coredump_savenote_elf32' was here
424 | ELFNAMEEND(coredump_savenote)(ns, ELF_NOTE_NETBSD_CORE_PROCINFO,
| ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
*** [core_elf32.o] Error code 1
I'm getting lost inside all this elf stuff.... :)
Just add their declarations in exec_elf.h they have the same signatures as
the "unreal" ones :-)
Tried that, but now kern_core.c won't compile as part of the coredump
module:
...
# compile coredump/kern_core.o
... (gcc command line elided)
In file included from /build/netbsd-local/src_ro/sys/sys/compat_stub.h:35,
from /build/netbsd-local/src_ro/sys/kern/kern_core.c:53:
/build/netbsd-local/src_ro/sys/kern/kern_core.c: In function
'coredump_modcmd':
/build/netbsd-local/src_ro/sys/kern/kern_core.c:80:40: error:
'real_coredump_elf32' undeclared (first use in this function); did you mean
'real_coredump_netbsd'?
80 | MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
| ^~~~~~~~~~~~~~~~~~~
/build/netbsd-local/src_ro/sys/kern/kern_core.c:80:40: note: each
undeclared identifier is reported only once for each function it appears in
/build/netbsd-local/src_ro/sys/kern/kern_core.c:81:40: error:
'real_coredump_elf64' undeclared (first use in this function); did you mean
'real_coredump_netbsd'?
81 | MODULE_HOOK_SET(coredump_elf64_hook, real_coredump_elf64);
| ^~~~~~~~~~~~~~~~~~~
*** [kern_core.o] Error code 1
FWIW, in addition to
no options COREDUMP
no options PTRACE
my custom kernel also has
no options EXEC_ELF32
no options EXEC_ELF64
These modules are expected to be auto-loaded as necessary.
It seems that the exec_elf* modules fail to load, since the symbol
coredump_elf{32,64} is already defined in the kernel, even though
I have the ``no options EXEC_ELF*'' in the config.
...
[ 8.0347157] init: copying out path `/sbin/init' 11
[ 8.0544213] kobj_checksyms, 1026: [%M/exec_elf32/exec_elf32.kmod]:
linker error: global symbol `coredump_elf32' redefined
[ 8.0544213] WARNING: module error: vfs load failed for `exec_elf32',
error 8
[ 8.0544213] kobj_checksyms, 1026: [%M/exec_elf64/exec_elf64.kmod]:
linker error: global symbol `coredump_elf64' redefined
[ 8.0544213] WARNING: module error: vfs load failed for `exec_elf64',
error 8
...
+--------------------+--------------------------+-----------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost |
+--------------------+--------------------------+-----------------------+
Home |
Main Index |
Thread Index |
Old Index