Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2018 18:43:34 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Christian Ullrich <chris@chrullrich.net>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: "Cross" building for same architecture, different CPUTYPE
Message-ID:  <D30A88D2-6DFB-4535-8735-C71A43DEEB6B@FreeBSD.org>
In-Reply-To: <2126f358-c827-ecf0-109b-0488c5b155b6@chrullrich.net>
References:  <2126f358-c827-ecf0-109b-0488c5b155b6@chrullrich.net>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 4 Mar 2018, at 18:29, Christian Ullrich <chris@chrullrich.net> wrote:
> 
> I'm trying to buildworld/buildkernel of stable/11 r330373 for an Intel Atom CPU (CPUTYPE=slm) on a (slightly faster, CPUTYPE=core-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).
> 
> 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 = instead of ?= (in make.conf or src.conf)
2) If you set -march= flags in CFLAGS directly

With 1), if you specify CPUTYPE= 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=amd64 TARGET_ARCH=amd64), but since the build host _is_ amd64, the Makefiles laughed at me and only did the normal build.
> 
> The command that did not work was:
> 
> MAKEOBJDIRPREFIX=/usr/obj/slm make CPUTYPE=slm buildworld buildkernel
> 
> I have CPUTYPE?=core-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


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWpwwRgAKCRCwXqMKLiCW
o4HuAJ0UTVLA5D1avjuQ75YCgx+sK1CsJACg2m3rMK5FRYzdmZmGjs7KjpLFiCE=
=jNgg
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D30A88D2-6DFB-4535-8735-C71A43DEEB6B>