From owner-freebsd-stable@FreeBSD.ORG Mon Oct 22 18:46:03 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14C8316A417 for ; Mon, 22 Oct 2007 18:46:03 +0000 (UTC) (envelope-from josh.carroll@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by mx1.freebsd.org (Postfix) with ESMTP id AFF8113C480 for ; Mon, 22 Oct 2007 18:46:02 +0000 (UTC) (envelope-from josh.carroll@gmail.com) Received: by py-out-1112.google.com with SMTP id u77so2779649pyb for ; Mon, 22 Oct 2007 11:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=msKIrZqm8EQ3sgKNG8NGTphHYbv6N0Dpp0Sin6t+dYk=; b=XJL7paIuqZ2WazCcmtZd3IudMzCnjuw5SjiwWKLWIYsCGbHuP0SdtC3PLGMVvAhBQDivm1bNhk0OWfMyq9frh8IE1xZD5ps2lrbrAjtH/NNPVfGx1lxCtOdC06ccNn34Q0x1X2pvnLrmtlzrN87tnSSmrIXXlkNIg8FkN9rdLew= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=dzv49oD/UDwAcyyL6FMf6XgcrqzcuA84mBF84F5rnDsKy2F1jwWn/9qc3smuh/Nd09E+2McBY+i6ZGmFYa6kVXckidRVCEONwEQtCzu7uke3y4LbOaOZBpD30UDIqUvVr5+kYL8F7HVL4gh7vRXo9tQ6y4WrsMmNO+tef9QIdzI= Received: by 10.35.51.19 with SMTP id d19mr6464898pyk.1193078755654; Mon, 22 Oct 2007 11:45:55 -0700 (PDT) Received: by 10.35.117.12 with HTTP; Mon, 22 Oct 2007 11:45:55 -0700 (PDT) Message-ID: <8cb6106e0710221145k178e17can30bc90f65431f660@mail.gmail.com> Date: Mon, 22 Oct 2007 14:45:55 -0400 From: "Josh Carroll" To: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: buildworld failure (boot2.ld too big when CFLAGS set in make.conf) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: josh.carroll@gmail.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2007 18:46:03 -0000 Hello, During buildworld on RELENG_7 csup'd as of 10/22, it dies in sys/boot/i386/boot2 with: ===> sys/boot/i386/boot2 (all) -533 bytes available *** Error code 1 Stop in /usr/src/sys/boot/i386/boot2. *** Error code 1 I took a look at the cc command line: cc -Os -fno-guess-branch-probability -fomit-frame-pointer -fno-unit-at-a-time -mno-align-long-strings -mrtd -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -DUFS1_AND_UFS2 -DFLAGS=0x80 -DSIOPRT=0x3f8 -DSIOFMT=0x3 -DSIOSPD=9600 -I/usr/src/sys/boot/i386/boot2/../../common -I/usr/src/sys/boot/i386/boot2/../btx/lib -I. -Wall -Waggregate-return -Wbad-function-cast -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -Winline --param max-inline-insns-single=100 -ffreestanding -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -m32 -march=i386 -O2 -mmmx -msse -msse2 -msse3 -pipe -S -o boot2.s.tmp /usr/src/sys/boot/i386/boot2/boot2.c Since CFLAGS defined in make.conf are being tacked onto the calls to cc, and the last -O argument is the one that's effective with gcc, it's effectively building with O2 optimizations instead of Os to target smaller code size. Here is my entry in make.conf: CFLAGS+=-O2 -mmmx -msse -msse2 -msse3 -pipe To avoid this, I wrapped setting CFLAGS with an .if so it doesn't happen for the boot2 build: # don't append to CFLAGS here, it breaks compilation of boot2. .if ! ${.CURDIR:M*/boot/i386/boot2*} CFLAGS+=-O2 -mmmx -msse -msse2 -msse3 -pipe .endif But is there a better way to do this? I don't think using -O2 is overly aggressive for building world/ports, but obviously for things that require a small code size, it's going to break. Is what I'm doing above the best work around? Or am I missing an easier/more standard solution? Can I prepend to a variable in make.conf instead of appending (so that -Os comes _after_ -O2)? Thanks, Josh