NetBSD-Bugs archive

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

Re: lib/59805 (undefined reference to `_kvm_kvatop_i386pae' when building with -m32 on amd64)



Synopsis: undefined reference to `_kvm_kvatop_i386pae' when building with -m32 on amd64

Responsible-Changed-From-To: riastradh->lib-bug-people
Responsible-Changed-By: riastradh%NetBSD.org@localhost
Responsible-Changed-When: Sat, 29 Nov 2025 21:26:05 +0000
Responsible-Changed-Why:
unlick this cookie


State-Changed-From-To: analyzed->open
State-Changed-By: riastradh%NetBSD.org@localhost
State-Changed-When: Sat, 29 Nov 2025 21:26:05 +0000
State-Changed-Why:
Not sure this is right on second thought.  Drafted the following patch
and grew doubtful while writing the commit message.  Out of time to
think about this for now, but maybe someone else can think harder about
it.


# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1764451378 0
#      Sat Nov 29 21:22:58 2025 +0000
# Branch trunk
# Node ID 466961a5186c16cae5b8c8bd15e225566d655542
# Parent  e2e753d86d5e78bb624fe387656a44c8b77f364b
# EXP-Topic riastradh-pr59805-libkvmcompatarch
WIP: libkvm: Use KVM_MACHINE_ARCH, not MACHINE_ARCH.

Without this, the compat i386 build includes kvm_i386.c but not
kvm_i386pae.c, so it lacks the symbol _kvm_kvatop_i386pae.

XXX Except, is this right?  Does it even make sense to use kvm_i386.c
on an amd64 kernel?  Shouldn't we do some kind of i386 build of
kvm_x86_64.c so that an i386 userland can get at the amd64 kernel
data structures?

PR lib/59805: undefined reference to `_kvm_kvatop_i386pae' when
building with -m32 on amd64

diff -r e2e753d86d5e -r 466961a5186c lib/libkvm/Makefile
--- a/lib/libkvm/Makefile	Fri Nov 28 16:47:59 2025 +0000
+++ b/lib/libkvm/Makefile	Sat Nov 29 21:22:58 2025 +0000
@@ -12,6 +12,9 @@ CPPFLAGS+=-DLIBC_SCCS -I${NETBSDSRCDIR}/
 
 SRCS=	kvm.c kvm_file.c kvm_getloadavg.c kvm_proc.c
 
+KVM_MACHINE_ARCH?=	${MACHINE_ARCH}
+KVM_MACHINE_CPU?=	${MACHINE_CPU}
+
 # This library should compile to the same thing on all variants of
 # ${MACHINE} with the same ${MACHINE_ARCH} so shared /usr works.
 # If it is necessary to run different code based on ${MACHINE} then
@@ -32,7 +35,7 @@ SRCS+=	kvm_${MACHINE_CPU}.c
 	@false
 .endif
 
-.if ${MACHINE_ARCH} == "i386"
+.if ${KVM_MACHINE_ARCH} == "i386"
 LINTFLAGS+=-w
 LINTFLAGS+=	-X 351		# 'extern' declaration outside header
 LINTFLAGS+=	-X 352		# 'extern' declaration in function body





Home | Main Index | Thread Index | Old Index