From owner-freebsd-stable@freebsd.org Sun Mar 4 17:43:43 2018 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A8A2F47198 for ; Sun, 4 Mar 2018 17:43:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B960B8581E for ; Sun, 4 Mar 2018 17:43:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 9D7E717176; Sun, 4 Mar 2018 18:43:35 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_082A44D0-C610-4291-87C7-C59B178F2455"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: "Cross" building for same architecture, different CPUTYPE Date: Sun, 4 Mar 2018 18:43:34 +0100 In-Reply-To: <2126f358-c827-ecf0-109b-0488c5b155b6@chrullrich.net> Cc: freebsd-stable@freebsd.org To: Christian Ullrich References: <2126f358-c827-ecf0-109b-0488c5b155b6@chrullrich.net> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2018 17:43:43 -0000 --Apple-Mail=_082A44D0-C610-4291-87C7-C59B178F2455 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 4 Mar 2018, at 18:29, Christian Ullrich wrote: >=20 > I'm trying to buildworld/buildkernel of stable/11 r330373 for an Intel = Atom CPU (CPUTYPE=3Dslm) on a (slightly faster, CPUTYPE=3Dcore-avx2) = build machine. That works fine, but make installkernel on the Atom box = fails with a SIGILL (signal 4) in the "install" command (sorry, no log = or screenshot). >=20 > As far as I can tell, this is because installkernel uses the install = from ...obj.../tmp/legacy/usr/bin, which is built for the host. = Disassembling the binary shows that it uses AVX opcodes. The "main" part = of the build output correctly respects the CPUTYPE override. How are you overriding? As far as I know, the bootstrap-tools are built using NO_CPU_CFLAGS, which disables any cpu-specific CFLAGS. However, this does not work in two cases: 1) If you assign CPUTYPE with =3D instead of ?=3D (in make.conf or = src.conf) 2) If you set -march=3D flags in CFLAGS directly With 1), if you specify CPUTYPE=3D as a variable directly on the make command line, it will effectively disable NO_CPU_CFLAGS. > I suppose I'm doing something wrong here, but what? It must be = possible to build for a different CPU of the same family, right? I even = tried running a cross build (TARGET=3Damd64 TARGET_ARCH=3Damd64), but = since the build host _is_ amd64, the Makefiles laughed at me and only = did the normal build. >=20 > The command that did not work was: >=20 > MAKEOBJDIRPREFIX=3D/usr/obj/slm make CPUTYPE=3Dslm buildworld = buildkernel >=20 > I have CPUTYPE?=3Dcore-avx2 in make.conf, but that should be = irrelevant here. Actually, that *is* relevant for the stages after bootstrap-tools, build-tools and cross-tools. E.g. 4.x and later. Again, this depends on how exactly you are overriding CPUTYPE. -Dimitry --Apple-Mail=_082A44D0-C610-4291-87C7-C59B178F2455 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWpwwRgAKCRCwXqMKLiCW o4HuAJ0UTVLA5D1avjuQ75YCgx+sK1CsJACg2m3rMK5FRYzdmZmGjs7KjpLFiCE= =jNgg -----END PGP SIGNATURE----- --Apple-Mail=_082A44D0-C610-4291-87C7-C59B178F2455--