From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 3 20:40:01 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFCD4B17 for ; Sat, 3 Nov 2012 20:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id B4F838FC0C for ; Sat, 3 Nov 2012 20:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qA3Ke0Gx007012 for ; Sat, 3 Nov 2012 20:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qA3Ke0aV007011; Sat, 3 Nov 2012 20:40:00 GMT (envelope-from gnats) Resent-Date: Sat, 3 Nov 2012 20:40:00 GMT Resent-Message-Id: <201211032040.qA3Ke0aV007011@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Howard Goldstein Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9F79F81F for ; Sat, 3 Nov 2012 20:30:36 +0000 (UTC) (envelope-from hg@cally.queue.to) Received: from pickle.queue.to (pickle.queue.to [71.180.69.18]) by mx1.freebsd.org (Postfix) with ESMTP id 31F478FC14 for ; Sat, 3 Nov 2012 20:30:35 +0000 (UTC) Received: (qmail 57996 invoked from network); 3 Nov 2012 16:23:54 -0400 Received: from cally.queue.to (172.16.0.6) by pickle.queue.to with ESMTP; 3 Nov 2012 16:23:54 -0400 Received: (qmail 71555 invoked by uid 1000); 3 Nov 2012 16:23:54 -0400 Message-Id: <20121103202354.71554.qmail@cally.queue.to> Date: 3 Nov 2012 16:23:54 -0400 From: Howard Goldstein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/173337: clang kernel cross-builds ignore CPUTYPE?= and always generate native tuned code X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Howard Goldstein List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2012 20:40:01 -0000 >Number: 173337 >Category: kern >Synopsis: clang kernel cross-builds ignore CPUTYPE?= and always generate native tuned code >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 03 20:40:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Howard Goldstein >Release: >Organization: >Environment: Oct 30 13:45:20 pickle kernel: FreeBSD 9.1-PRERELEASE #13: Thu Oct 25 22:29:56 E DT 2012 Oct 30 13:45:20 pickle kernel: hg@pickle.queue.to:/usr/obj/usr/src/sys/PICKLE i3 86 Oct 30 13:45:20 pickle kernel: CPU: Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66 GHz (2667.76-MHz 686-class CPU) Oct 30 13:45:20 pickle kernel: Origin = "GenuineIntel" Id = 0x6fb Family = 0x6 Model = 0xf Stepping = 11 Oct 30 13:45:20 pickle kernel: Features=0xbfebfbffDescription: Kernel compiled on a system id'd as a core2 a/k/a nocona in i386 mode (above) and stock clang of 9.1 prerelease 13: pickle:~$ clang -v FreeBSD clang version 3.1 (branches/release_31 156863) 20120523 Target: i386-unknown-freebsd9.0 Thread model: posix for a i386 for a pentium4 both i386 with these set in make.conf CPUTYPE?=pentium4 CC=clang CXX=clang++ CPP=clang-cpp The resulting kernel seems to actually be built for the host as if -march=native were set, ignoring CPUTYPE?=pentium4 This is almost surely the same problem reported on -stable by Volodymyr Kostyrko c.kworr on Wed Oct 24 07:57:26 UTC 2012 at http://lists.freebsd.org/pipermail/freebsd-stable/2012-October/070228.html >How-To-Repeat: Build a kernel with clang on a host that is, for lack of a better expression "stronger" than your handy, "lesser" target. For ex., a core2 host targetting a pentium-m. Now install emulators/wine or emulator/wine-devel, built however you like. The wine process handles its own trapping which makes this very difficult to identify (for me, anyway) as a kernel issue: err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x622... and wine opens a black window and hangs up. >From gdb it's a bit more verbose and yields a map file error. This is probably impossible to reproduce without a separate target system real or virtual that doesn't support the instruction set of the build host. >Fix: Revert to stock gcc4.2 for crossbuilding 9.1 kernels destined for a specific CPUTYPE that doesn't match the host This PR may belong in conf or ports instead of kern, please recategorize >Release-Note: >Audit-Trail: >Unformatted: Release: FreeBSD 9.1-PRERELEASE i386