NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/54861: Possible wrong dependencies with MODULE and COMPAT_50
The following reply was made to PR kern/54861; it has been noted by GNATS.
From: Paul Goyette <paul%whooppee.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/54861: Possible wrong dependencies with MODULE and COMPAT_50
Date: Wed, 15 Jan 2020 10:00:42 -0800 (PST)
On Wed, 15 Jan 2020, Paul Goyette wrote:
>> # link MODULAR/netbsd
>> /s/src/obj.sun3/tooldir.NetBSD-9.0_RC1-i386/bin/m68k--netbsdelf-ld -Map
>> netbsd.map --cref -N -Ttext 0E004000 -e start -S -o netbsd
>> ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
>> /s/src/sys/arch/sun3/compile/obj.sun3/MODULAR/lib/compat/libcompat.o: In
>> function `compat_14_rt_oifmsg':
>> (.text+0x2c1e): undefined reference to `compat_50_route_info'
>> /s/src/sys/arch/sun3/compile/obj.sun3/MODULAR/lib/compat/libcompat.o: In
>> function `compat_14_rt_oifmsg':
>> (.text+0x2cf8): undefined reference to `compat_50_rt_msg1'
>> /s/src/sys/arch/sun3/compile/obj.sun3/MODULAR/lib/compat/libcompat.o: In
>> function `compat_14_rt_oifmsg':
>> (.text+0x2d0a): undefined reference to `compat_50_route_enqueue'
>>
>> *** Failed target: netbsd
>
> With a -current amdy4 build host, I get a slightly more informative
> error message:
>
> # link MODULAR/netbsd
> /build/netbsd-8/tools/x86_64/sun3/bin/m68k--netbsdelf-ld -Map netbsd.map
> --cref -N -Ttext 0E004000 -e start -X -o netbsd
> ${SYSTEM_OBJ:[@]:Nswapnetbsd.o} ${EXTRA_OBJ} vers.o swapnetbsd.o
> /build/netbsd-8/obj/sun3/sys/arch/sun3/compile/MODULAR/lib/compat/libcompat.o:
> In function `compat_14_rt_oifmsg':
> /build/netbsd-8/src/sys/compat/common/rtsock_14.c:99: undefined reference to
> `compat_50_route_info'
> /build/netbsd-8/src/sys/compat/common/rtsock_14.c:125: undefined reference to
> `compat_50_rt_msg1'
> /build/netbsd-8/src/sys/compat/common/rtsock_14.c:128: undefined reference to
> `compat_50_route_enqueue'
> *** [netbsd] Error code 1
>
> It is totally unclear to me why ld(1) includes the rtsock_14.o member
> from the libcompat.o library. This object/member only defines two
> symbols, compat_14_iflist and compat_14_rt_oifmsg, and neither of these
> is referenced by any other object module. A GENERIC (non-MODULAR)
> kernel does not include rtsock_14.o member.
OK, I unserstanad what's going on. For MODULAR kernels, we use the
libcompat.o aggregated object module rather that libcompat.a archive.
This causes us to include all compat code, whether or not covered by
the various COMPAT_xx options. On top of that, it turns out that the
rtsock_50.c code is built, but without having COMPAT_50 defined, so
it ends up being a no-op with none of its routines defined. The end
result is a rtsock_14.o referencing routines that were ifdef'd out
from rtsock_50.
The following fix works. I'll see if we can get it committed to the
8.x and 8.1 branches.
Index: rtsock_50.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/rtsock_50.c,v
retrieving revision 1.4.10.1
diff -u -p -r1.4.10.1 rtsock_50.c
--- rtsock_50.c 9 Jun 2018 14:38:18 -0000 1.4.10.1
+++ rtsock_50.c 15 Jan 2020 17:59:56 -0000
@@ -65,10 +65,11 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
+#include "opt_modular.h"
#endif
-#if defined(COMPAT_14) && !defined(COMPAT_50)
-#define COMPAT_50 1 /* 1.4 needs 5.0 */
+#if (defined(MODULAR) || defined(COMPAT_14)) && !defined(COMPAT_50)
+#define COMPAT_50 1 /* MODULAR and 1.4 need 5.0 */
#endif
#if defined(COMPAT_50)
+--------------------+--------------------------+-----------------------+
| 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