NetBSD Problem Report #57146
From martin@duskware.de Thu Dec 29 15:20:22 2022
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5BB701A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Dec 2022 15:20:22 +0000 (UTC)
Date: Thu, 29 Dec 2022 16:20:19 CET
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: COPY_SYMTAB is broken by MKCTF=yes
X-Send-Pr-Version: 3.95
>Number: 57146
>Category: toolchain
>Synopsis: COPY_SYMTAB is broken by MKCTF=yes
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: rin
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 29 15:25:00 +0000 2022
>Closed-Date:
>Last-Modified: Mon Sep 11 13:40:01 +0000 2023
>Originator: Martin Husemann
>Release: NetBSD 10.0_BETA
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD drowsy.duskware.de 10.0_BETA NetBSD 10.0_BETA (GENERIC) #3: Thu Dec 29 15:09:20 CET 2022 martin@seven-days-to-the-wolves.aprisoft.de:/work/src-10/sys/arch/shark/compile/GENERIC shark
Architecture: earmv4
Machine: shark
>Description:
As noted on port-arm, the default builds of shark netbsd-10 kernels do not
boot. The COPY_SYMTAB space explodes and the kernel gets too big.
This turns out to be a side effect of MKCTF=yes, with MKCTF=no the default
kernel symtab space shrinks from 15482320 to 477960, and all is fine
(and the kernel is bootable again).
>How-To-Repeat:
Download a shark generic kernel from the auto builds and run dbsym -P on
it (on the ELF version).
>Fix:
n/a
>Release-Note:
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/57146: COPY_SYMTAB is broken by MKCTF=yes
Date: Mon, 2 Jan 2023 20:01:28 +0100
We have 116 affected kernel configs in the tree, so I thought it would be
better to handle this as centralized as possible (which is slightly tricky
due to CTF usage in sys.mk).
The patch below seems to work for shark at least (no more .CTF_* section
and dbsym -P shows the expected small values).
Martin
Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.295
diff -u -r1.295 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc 27 Aug 2022 20:37:49 -0000 1.295
+++ sys/conf/Makefile.kern.inc 2 Jan 2023 18:56:21 -0000
@@ -137,6 +137,12 @@
#
COPTS.debugsyms.c+= -g
+# Can not combine COPY_SYMTAB nad MKCTF - let the former win
+.if defined(COPY_SYMTAB)
+.undef CTFCONVERT
+.undef CTFMERGE
+.endif
+
# Add CTF sections for DTrace
.if defined(CTFCONVERT)
COMPILE_CTFCONVERT= ${_MKSHECHO}\
Index: sys/lib/libkern/Makefile.inc
===================================================================
RCS file: /cvsroot/src/sys/lib/libkern/Makefile.inc,v
retrieving revision 1.48
diff -u -r1.48 Makefile.inc
--- sys/lib/libkern/Makefile.inc 19 Jun 2022 18:28:16 -0000 1.48
+++ sys/lib/libkern/Makefile.inc 2 Jan 2023 18:56:29 -0000
@@ -40,6 +40,10 @@
LIBKERN_MD_FLAGS?= none
+.if defined(COPY_SYMTAB)
+KERNMISCMAKEFLAGS+= MKCTF=no
+.endif
+
KERNMAKE= \
cd ${KERNDST} && ${MAKE} -f ${KERNDIR:Q}/Makefile \
KERNDIR=${KERNDIR:q} \
Responsible-Changed-From-To: toolchain-manager->lukem
Responsible-Changed-By: lukem@NetBSD.org
Responsible-Changed-When: Thu, 25 May 2023 16:20:30 +0000
Responsible-Changed-Why:
State-Changed-From-To: open->feedback
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Thu, 25 May 2023 16:20:30 +0000
State-Changed-Why:
Is MKCTF=yes in -current still causing problems preventing
the shark (dnard) from booting? I haven't owned one for
many years (donated to another developer as a spare)
so I can't test myself.
I've tried to reproduce this issue in -current, and haven't been able to.
The shark kernels cross-built with the default MKCTF=yes
are bigger than MKCTF=no, but not excessively so:
% ls -l GENERIC.MKCTF=*/netbsd
3043 -rwxr-xr-x 1 lukem users 5105548 May 26 01:20 GENERIC.MKCTF=no/netbsd*
3073 -rwxr-xr-x 1 lukem users 5348240 May 26 01:18 GENERIC.MKCTF=yes/netbsd*
% size GENERIC.MKCTF=*/netbsd
text data bss dec hex filename
3843904 608148 119368 4571420 45c11c GENERIC.MKCTF=no/netbsd
3843904 729492 119368 4692764 479b1c GENERIC.MKCTF=yes/netbsd
% dbsym -P GENERIC.MKCTF=no/netbsd
503048
% dbsym -P GENERIC.MKCTF=yes/netbsd
624400
This is without any changes to the source.
State-Changed-From-To: feedback->open
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Thu, 25 May 2023 16:55:30 +0000
State-Changed-Why:
Martin confirmed issue still exists in official builds.
From: Luke Mewburn <luke@mewburn.net>
To: gnats-bugs@netbsd.org
Cc: lukem@netbsd.org, toolchain-manager@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org, martin@netbsd.org
Subject: Re: toolchain/57146 (COPY_SYMTAB is broken by MKCTF=yes)
Date: Sat, 27 May 2023 01:33:35 +1000
I've done some further analysis inspired by Martin's comment
that the published releases are too large, and I think that
they're built with MKDEBUG=yes.
tl;dr: The combination of both MKCTF=yes and MKDEBUG=yes
causes the size blowout. Just one or the other of these
options enabled does not seem to be that much of an issue.
Seeking input from ARM toolchain gurus for further advice.
Testing GENERIC compiles with various combinations of MKCTF and MKDEBUG.
In these results:
- c0 == MKCTF=no
- c1 == MKCTF=yes
- d0 == MKDEBUG=no
- d1 == MKDEBUG=yes
% ls -l GENERIC.*/netbsd
-rwxr-xr-x 1 lukem users 5105548 May 27 00:57 GENERIC.c0d0/netbsd
-rwxr-xr-x 1 lukem users 5053672 May 27 01:00 GENERIC.c0d1/netbsd
-rwxr-xr-x 1 lukem users 5348240 May 27 00:59 GENERIC.c1d0/netbsd
-rwxr-xr-x 1 lukem users 35091320 May 27 01:09 GENERIC.c1d1/netbsd
% size GENERIC.*/netbsd
text data bss dec hex filename
3843904 608148 119368 4571420 45c11c GENERIC.c0d0/netbsd
3843904 612372 119368 4575644 45d19c GENERIC.c0d1/netbsd
3843904 729492 119368 4692764 479b1c GENERIC.c1d0/netbsd
3843904 15631188 119368 19594460 12afcdc GENERIC.c1d1/netbsd
% foreach i (GENERIC.*/netbsd )
foreach? echo $i;
foreach? $TOOLDIR/bin/armv4--netbsdelf-eabi-dbsym -P $i
foreach? end
GENERIC.c0d0/netbsd
503048
GENERIC.c0d1/netbsd
479652
GENERIC.c1d0/netbsd
624400
GENERIC.c1d1/netbsd
15498488
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57146 CVS commit: src/sys/arch/evbarm/conf
Date: Sat, 17 Jun 2023 11:35:25 +0000
Module Name: src
Committed By: rin
Date: Sat Jun 17 11:35:25 UTC 2023
Modified Files:
src/sys/arch/evbarm/conf: NSLU2
Log Message:
Build NSLU2 kernel with NOCTF="yes" as workaround for
PR toolchain/57146, which I'm working on :).
Now kernel image fits within its reserved VA range again.
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/conf/NSLU2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: lukem->rin
Responsible-Changed-By: lukem@NetBSD.org
Responsible-Changed-When: Sun, 18 Jun 2023 19:56:48 +0000
Responsible-Changed-Why:
rin@ mentioned in a commit that they're looking into
a solution (thanks!), so I'll handover to them
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57146 CVS commit: src/sys
Date: Wed, 26 Jul 2023 03:39:56 +0000
Module Name: src
Committed By: rin
Date: Wed Jul 26 03:39:56 UTC 2023
Modified Files:
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/arm/conf: Makefile.arm
src/sys/conf: Makefile.kern.inc
Log Message:
Fix kernel size inflation for arm and aarch64 (PR toolchain/57146)
For some conditions, SYSTEM_LD_TAIL is set for arm and aarch64.
Then, ctfmerge(1) in default SYSTEM_LD_TAIL is unintentionally
skipped, which results in the catastrophic kernel size inflation,
as reported in the PR.
Also, introduce and use OBJCOPY_STRIPFLAGS variable instead of
STRIPFLAGS, as strip(1) is replaced by objcopy(1) during MI
kernel build procedure.
XXX
For Makefile.{arm,aarch64}, weird logic is used to determine how
to handle debug symbols; MKDEBUG{,KERNEL} are taken into account
later in sys/conf/Makefile.kern.inc.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/conf/Makefile.arm
cvs rdiff -u -r1.297 -r1.298 src/sys/conf/Makefile.kern.inc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57146 CVS commit: src/sys
Date: Fri, 28 Jul 2023 02:41:31 +0000
Module Name: src
Committed By: rin
Date: Fri Jul 28 02:41:31 UTC 2023
Modified Files:
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/arm/conf: Makefile.arm
src/sys/conf: Makefile.kern.inc
Log Message:
Simplify fix for PR toolchain/57146
Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/conf/Makefile.arm
cvs rdiff -u -r1.298 -r1.299 src/sys/conf/Makefile.kern.inc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57146 CVS commit: src/sys/arch/evbarm/conf
Date: Tue, 1 Aug 2023 10:25:48 +0000
Module Name: src
Committed By: rin
Date: Tue Aug 1 10:25:48 UTC 2023
Modified Files:
src/sys/arch/evbarm/conf: NSLU2
Log Message:
NSLU2: Remove workaround for now-fixed PR toolchain/57146
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/conf/NSLU2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57146 CVS commit: [netbsd-10] src/sys
Date: Mon, 11 Sep 2023 13:35:38 +0000
Module Name: src
Committed By: martin
Date: Mon Sep 11 13:35:38 UTC 2023
Modified Files:
src/sys/arch/aarch64/conf [netbsd-10]: Makefile.aarch64
src/sys/arch/alpha/conf [netbsd-10]: Makefile.alpha
src/sys/arch/arm/conf [netbsd-10]: Makefile.arm
src/sys/arch/cats/conf [netbsd-10]: Makefile.cats.inc
src/sys/arch/mips/conf [netbsd-10]: Makefile.mips
src/sys/arch/riscv/conf [netbsd-10]: Makefile.riscv
src/sys/arch/shark/conf [netbsd-10]: Makefile.shark.inc
src/sys/conf [netbsd-10]: Makefile.kern.inc
Log Message:
Pull up following revision(s) (requested by rin in ticket #363):
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.24
sys/arch/aarch64/conf/Makefile.aarch64: revision 1.25
sys/arch/shark/conf/Makefile.shark.inc: revision 1.28
sys/arch/alpha/conf/Makefile.alpha: revision 1.88
sys/arch/mips/conf/Makefile.mips: revision 1.73
sys/conf/Makefile.kern.inc: revision 1.298
sys/conf/Makefile.kern.inc: revision 1.299
sys/arch/cats/conf/Makefile.cats.inc: revision 1.37
sys/arch/arm/conf/Makefile.arm: revision 1.56
sys/arch/arm/conf/Makefile.arm: revision 1.57
sys/arch/riscv/conf/Makefile.riscv: revision 1.10
Always use arm-elf2aout; no a.out support both for binutils{,.old}
Fix kernel size inflation for arm and aarch64 (PR toolchain/57146)
For some conditions, SYSTEM_LD_TAIL is set for arm and aarch64.
Then, ctfmerge(1) in default SYSTEM_LD_TAIL is unintentionally
skipped, which results in the catastrophic kernel size inflation,
as reported in the PR.
Also, introduce and use OBJCOPY_STRIPFLAGS variable instead of
STRIPFLAGS, as strip(1) is replaced by objcopy(1) during MI
kernel build procedure.
For Makefile.{arm,aarch64}, weird logic is used to determine how
to handle debug symbols; MKDEBUG{,KERNEL} are taken into account
later in sys/conf/Makefile.kern.inc.
Use OBJCOPY_STRIPFLAGS instead of STRIPFLAGS.
Simplify fix for PR toolchain/57146
Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.12.1 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.87 -r1.87.14.1 src/sys/arch/alpha/conf/Makefile.alpha
cvs rdiff -u -r1.55 -r1.55.20.1 src/sys/arch/arm/conf/Makefile.arm
cvs rdiff -u -r1.36 -r1.36.30.1 src/sys/arch/cats/conf/Makefile.cats.inc
cvs rdiff -u -r1.72 -r1.72.14.1 src/sys/arch/mips/conf/Makefile.mips
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/arch/riscv/conf/Makefile.riscv
cvs rdiff -u -r1.27 -r1.27.30.1 src/sys/arch/shark/conf/Makefile.shark.inc
cvs rdiff -u -r1.295 -r1.295.4.1 src/sys/conf/Makefile.kern.inc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.