From owner-freebsd-toolchain@FreeBSD.ORG Tue Jul 19 00:23:41 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41DE106564A for ; Tue, 19 Jul 2011 00:23:40 +0000 (UTC) (envelope-from inyaoo@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id C0D478FC16 for ; Tue, 19 Jul 2011 00:23:40 +0000 (UTC) Received: by iyb11 with SMTP id 11so4373911iyb.13 for ; Mon, 18 Jul 2011 17:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:message-id:user-agent :mime-version:content-type; bh=dzwQCHmSSBcLgP22IGw90IOaSYhYzIV2jXdOJ2Liods=; b=ibheCgkfpJHk4Dz3X6+F6LbZIKYcxHghJ8t12I/CaXWgNoFExNVMAjWecEy7iGZViD V0Hp6ul65i/wQVKvItos4c2x4E5XM5J8wioIqYbiFAhe9il+ZOOYptuCNjiWXcQttV31 425Pofpv+HazoTS0IC/7SXATMCqyLViNJSoCU= Received: by 10.231.143.129 with SMTP id v1mr6444526ibu.14.1311033696129; Mon, 18 Jul 2011 17:01:36 -0700 (PDT) Received: from localhost (saeed.torservers.net [72.46.129.45]) by mx.google.com with ESMTPS id b6sm3237942ibg.31.2011.07.18.17.01.31 (version=SSLv3 cipher=OTHER); Mon, 18 Jul 2011 17:01:34 -0700 (PDT) From: Pan Tsu To: Roman Divacky References: <86zkm74srn.fsf@gmail.com> <20110530161905.GA91202@freebsd.org> Date: Tue, 19 Jul 2011 04:01:26 +0400 Message-ID: <8639i3dtpl.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-toolchain@freebsd.org Subject: Re: [clang] boot2 fails to build with DEBUG_FLAGS? X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2011 00:23:41 -0000 Roman Divacky writes: > I dont have the same environment (I am using trunk llvm/clang) but I cant > reproduce it here... > > fwiw, with trunk llvm DEBUG_FLAGS dies in assembly stage because our as > does not know .cfi_section Why sys/boot even allows user CFLAGS influence if it's that fragile? $ __MAKE_CONF=/dev/null make all CC=clang DEBUG_FLAGS='-g -fno-omit-frame-pointer' ===> i386/boot2 (all) objcopy -S -O binary boot1.out boot1 dd if=/dev/zero of=boot2.ldr bs=512 count=1 1+0 records in 1+0 records out 512 bytes transferred in 0.000016 secs (32051995 bytes/sec) [...] ld -static -N --gc-sections -nostdlib -m elf_i386_fbsd -Ttext 0x2000 -o boot2.out /usr/obj/usr/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o objcopy -S -O binary boot2.out boot2.bin btxld -v -E 0x2000 -f bin -b /usr/obj/usr/src/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin kernel: ver=1.02 size=690 load=9000 entry=9010 map=16M pgctl=1:1 client: fmt=bin size=15bd text=0 data=0 bss=0 entry=0 output: fmt=bin size=1e4d text=200 data=1c4d org=0 entry=0 -77 bytes available *** Error code 1 And those DEBUG_FLAGS are handy to globally make world and ports trace-friendly (gdb/pmc/dtrace) without losing optimization. Luckily .if ${.CURDIR:N*sys/boot*} DEBUG_FLAGS ?= -g -fno-omit-frame-pointer .endif seems to work. OTOH, clang breaks gptzfsboot here, i.e. ZFS: zfs_alloc()/zfs_free() mismatch From owner-freebsd-toolchain@FreeBSD.ORG Thu Jul 21 12:52:01 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A56BD106566B; Thu, 21 Jul 2011 12:52:01 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 3114F8FC18; Thu, 21 Jul 2011 12:52:00 +0000 (UTC) Received: from park.js.berklix.net (p5DCBE76B.dip.t-dialin.net [93.203.231.107]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p6LCHZQP093565; Thu, 21 Jul 2011 12:17:36 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p6LCHaYl043364; Thu, 21 Jul 2011 14:17:36 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id p6LCHV9p025307; Thu, 21 Jul 2011 12:17:36 GMT (envelope-from jhs@fire.js.berklix.net) Message-Id: <201107211217.p6LCHV9p025307@fire.js.berklix.net> To: freebsd-toolchain@freebsd.org, freebsd-i386@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Linux Unix Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com/~jhs/cv/ Date: Thu, 21 Jul 2011 14:17:31 +0200 Sender: jhs@berklix.com Cc: freebsd-hackers@freebsd.org Subject: Re: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@freebsd.org List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2011 12:52:01 -0000 Hi freebsd-toolchain@freebsd.org, freebsd-i386@freebsd.org cc: freebsd-hackers@freebsd.org Sun Jul 17 01:19:37 UTC 2011 I wrote to freebsd-hackers@ with Subject: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586 Summary: I found a problem with CFLAGS += -march=i586 on an i686 linking a crt.o for an i686, then not running on an i586, I suggested maybe -march could be extended to also select seperate lib sub directories to at least trigger a link failure, rather than a silent apparent good compile of a bad binary. Others on freebsd-hackers@ made various follow up. People on freebsd-toolchain@ & freebsd-i386@ might have valuable input ? Not wanting to split the thread between lists, or cross post, More than this one) or lose people on freebsd-hackers@, Could you please look at http://lists.freebsd.org/pipermail/freebsd-hackers/2011-July/035889.html & reply-to: freebsd-hackers@freebsd.org Thanks ! (PS I'm not on freebsd-toolchain@ & freebsd-i386@, but am on freebsd-hackers@ ) Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below, not above; Indent with "> "; Cumulative like a play script. Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable. From owner-freebsd-toolchain@FreeBSD.ORG Thu Jul 21 13:51:33 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6B82106566B; Thu, 21 Jul 2011 13:51:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A96288FC17; Thu, 21 Jul 2011 13:51:33 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:7469:953f:9d81:458a] (unknown [IPv6:2001:7b8:3a7:0:7469:953f:9d81:458a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id F0E225C37; Thu, 21 Jul 2011 15:51:31 +0200 (CEST) Message-ID: <4E282EE4.50500@FreeBSD.org> Date: Thu, 21 Jul 2011 15:51:32 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201107211217.p6LCHV9p025307@fire.js.berklix.net> In-Reply-To: <201107211217.p6LCHV9p025307@fire.js.berklix.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "Julian H. Stacey" , freebsd-toolchain@freebsd.org, freebsd-i386@freebsd.org Subject: Re: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2011 13:51:34 -0000 On 2011-07-21 14:17, Julian H. Stacey wrote: > Summary: > I found a problem with CFLAGS += -march=i586 on an i686 linking > a crt.o for an i686, then not running on an i586, IMHO this is a bit of a PEBKAC issue. If you change CPUFLAGS to target a specific CPU, you should really rebuild all of world with it, not just a single program. In fact, you should rebuild all your ports too. > I suggested > maybe -march could be extended to also select seperate lib sub > directories to at least trigger a link failure, rather than a silent > apparent good compile of a bad binary. I think this would add a whole lot of complexity for very little gain, and still not save you from potential problems. You would really have to use the same approach for all system libraries, otherwise you might link in something from e.g. libc or libcrypto that was optimized for the wrong CPU. And I'm not even mentioning objects and/or libraries from ports... :) The compiler cannot automagically determine whether any object or library file you link into your program is fit to run on the CPU you are targeting, unless you would add information specifying the CPU type (and other particulars) to the object files themselves. In the end, it is up to you to make sure you do not mix "incompatible" object code. Having said all this, if you are worried particularly about the crt*.o files, then we could simply always build those with 'lowest common denominator' flags, like we do with e.g. the dynamic linker. I doubt very much that the startup code gains any performance by optimizing for higher CPU types. From owner-freebsd-toolchain@FreeBSD.ORG Thu Jul 21 15:47:08 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9404C1065680; Thu, 21 Jul 2011 15:47:08 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 227118FC1D; Thu, 21 Jul 2011 15:47:07 +0000 (UTC) Received: from park.js.berklix.net (pD9FBF955.dip.t-dialin.net [217.251.249.85]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p6LFl5vH095204; Thu, 21 Jul 2011 15:47:06 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p6LFl0cV044399; Thu, 21 Jul 2011 17:47:00 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id p6LFkweJ026837; Thu, 21 Jul 2011 15:47:03 GMT (envelope-from jhs@fire.js.berklix.net) Message-Id: <201107211547.p6LFkweJ026837@fire.js.berklix.net> To: Dimitry Andric From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Thu, 21 Jul 2011 15:51:32 +0200." <4E282EE4.50500@FreeBSD.org> Date: Thu, 21 Jul 2011 17:46:58 +0200 Sender: jhs@berklix.com Cc: freebsd-toolchain@freebsd.org, freebsd-i386@freebsd.org Subject: Re: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hackers@freebsd.org List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2011 15:47:08 -0000 Reference: > From: Dimitry Andric > Date: Thu, 21 Jul 2011 15:51:32 +0200 > Message-id: <4E282EE4.50500@FreeBSD.org> Dimitry Andric wrote: > On 2011-07-21 14:17, Julian H. Stacey wrote: ... AAARGH .... !!! Please I ASKED people only to reply to hackers@ not the other 2 lists. I also set header Reply-To: freebsd-hackers@freebsd.org & it got through like that, so you or your mailer tool Ignored it ? It would be contrary to list etiquette to let this explode into a triple cross post thread. (thus Ive already dropped hackers@ for this. I will NOT address remarks on a triple cross post to all of freebsd-hackers@freebsd.org freebsd-toolchain@freebsd.org freebsd-i386@freebsd.org Again I ask you to PLEASE first read the web'd archive of thread, then ONLY reply-to: hackers@freebsd.org. Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below, not above; Indent with "> "; Cumulative like a play script. Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.