From owner-freebsd-arch@FreeBSD.ORG Wed Oct 3 20:43:13 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC3A4106564A; Wed, 3 Oct 2012 20:43:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B2A948FC08; Wed, 3 Oct 2012 20:43:13 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 10BA7B91E; Wed, 3 Oct 2012 16:43:13 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 3 Oct 2012 15:12:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <506C385C.3020400@FreeBSD.org> In-Reply-To: <506C385C.3020400@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210031512.37718.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 03 Oct 2012 16:43:13 -0400 (EDT) Cc: Andriy Gapon Subject: Re: x86 boot code build X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2012 20:43:14 -0000 On Wednesday, October 03, 2012 9:06:36 am Andriy Gapon wrote: > > Currently we produce "slightly" different binaries for x86 boot code depending > whether MACHINE_CPUARCH is i386 or amd64. I think that there is no good reason > for this, since in both cases we use exactly the same code and target the same > classes of machines. In other words, the binaries should be interchangeable[*]. > > The difference boils down to using -march=i386 on amd64 while i386 uses default > compiler flags, which are equivalent to -march=i486 -mtune=generic. > If my analysis is correct, the only thing affected by the flags in the boot code > is use of leave instruction when -Os is _not_ specified. > For -march=i386 our gcc prefers using leave. For -march=i486 it thinks that > movs+pops are faster than leave and so prefers to not use it. If -Os is > specified, then leave is always used because it results in smaller machine code. > > So, as it is now, on amd64 we produce slightly smaller boot binaries where size > doesn't matter. Where size really matters (-Os) we produce identical binaries. > > If we decide that it makes sense to converge i386 and amd64 boot build options, > which should we pick? > > [*] It is the current state of matter, but it is not necessary that it will always > be the same. Go for smaller binaries. -- John Baldwin