NetBSD Problem Report #39265

From www@NetBSD.org  Fri Aug  1 17:04:01 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id B0F7163B99B
	for <gnats-bugs@gnats.netbsd.org>; Fri,  1 Aug 2008 17:04:01 +0000 (UTC)
Message-Id: <20080801170401.593F263B975@narn.NetBSD.org>
Date: Fri,  1 Aug 2008 17:04:01 +0000 (UTC)
From: xtraeme@gmail.com
Reply-To: xtraeme@gmail.com
To: gnats-bugs@NetBSD.org
Subject: CPUFLAGS is assigned twice into CFLAGS/AFLAGS when building a kernel
X-Send-Pr-Version: www-1.0

>Number:         39265
>Category:       kern
>Synopsis:       CPUFLAGS is assigned twice into CFLAGS/AFLAGS when building a kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 01 17:05:01 +0000 2008
>Closed-Date:    Fri Sep 05 11:07:36 +0000 2008
>Last-Modified:  Fri Sep 05 11:07:36 +0000 2008
>Originator:     Juan RP
>Release:        Latest and greatest
>Organization:
Not NetBSD
>Environment:
NetBSD sasha 4.99.71 NetBSD 4.99.71 (MASTER) #5: Thu Jul 31 22:05:45 CEST 2008  juan@sasha:/home/juan/build/obj/sys/arch/amd64/compile/MASTER amd64
>Description:
When building a kernel (x86), I noticed that CPUFLAGS is assigned twice in the arguments passed to the compiler.

sys/conf/Makefile.kern.inc does this:

CFLAGS+=       ${CPUFLAGS} ${DEBUG} ${COPTS} ${CWARNFLAGS}
AFLAGS+=       ${CPUFLAGS} -D_LOCORE -Wa,-fatal-warnings

but share/mk/bsd.sys.mk already contains:

CFLAGS+=        ${CPUFLAGS}
AFLAGS+=        ${CPUFLAGS}
>How-To-Repeat:

>Fix:
On my tree I applied the following patch to Makefile.kern.inc and does what is expected:


 CFLAGS+=       -ffreestanding -fno-zero-initialized-in-bss
-CFLAGS+=       ${CPUFLAGS} ${DEBUG} ${COPTS} ${CWARNFLAGS}
-AFLAGS+=       ${CPUFLAGS} -D_LOCORE -Wa,-fatal-warnings
+CFLAGS+=       ${DEBUG} ${COPTS} ${CWARNFLAGS}
+AFLAGS+=       -D_LOCORE -Wa,-fatal-warnings

>Release-Note:

>Audit-Trail:
From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/39265: CPUFLAGS is assigned twice into CFLAGS/AFLAGS when building a kernel
Date: Thu, 7 Aug 2008 10:53:53 +0200

 Looks like that CWARNFLAGS is redundant too. Please apply the following patch:

 Index: Makefile.kern.inc
 ===================================================================
 RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
 retrieving revision 1.113
 diff -u -r1.113 Makefile.kern.inc
 --- Makefile.kern.inc   21 Jun 2008 01:00:43 -0000      1.113
 +++ Makefile.kern.inc   7 Aug 2008 08:50:47 -0000
 @@ -83,8 +83,8 @@
  .endif

  CFLAGS+=       -ffreestanding -fno-zero-initialized-in-bss
 -CFLAGS+=       ${CPUFLAGS} ${DEBUG} ${COPTS} ${CWARNFLAGS}
 -AFLAGS+=       ${CPUFLAGS} -D_LOCORE -Wa,-fatal-warnings
 +CFLAGS+=       ${DEBUG} ${COPTS}
 +AFLAGS+=       -D_LOCORE -Wa,-fatal-warnings

  # XXX
  .if ${HAVE_GCC} > 3

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@NetBSD.org
Responsible-Changed-When: Fri, 05 Sep 2008 11:04:19 +0000
Responsible-Changed-Why:
I'll handle this PR.


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39265 CVS commit: src/sys/conf
Date: Fri,  5 Sep 2008 11:03:53 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Fri Sep  5 11:03:53 UTC 2008

 Modified Files:
 	src/sys/conf: Makefile.kern.inc

 Log Message:
 Don't add "${CPUFLAGS}" and "${CWARNFLAGS}" to "AFLAGS" and "CFLAGS" twice.
 Patch submitted by Juan Romero Pardines in PR kern/39265.


 To generate a diff of this commit:
 cvs rdiff -r1.114 -r1.115 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.

State-Changed-From-To: open->closed
State-Changed-By: tron@NetBSD.org
State-Changed-When: Fri, 05 Sep 2008 11:07:36 +0000
State-Changed-Why:
I've applied your patch. Thanks a lot.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.