From nobody Tue Feb 10 20:14:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523389312170842.8287989112946; Tue, 10 Apr 2018 12:41:52 -0700 (PDT) Received: from localhost ([::1]:39695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5z9F-0001qk-Gl for importer@patchew.org; Tue, 10 Apr 2018 15:41:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5z6z-000057-AL for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5z6x-0006Fv-Md for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:25 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:44429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5z6x-0006FB-Fs for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:23 -0400 Received: by mail-wr0-x22b.google.com with SMTP id u46so13917259wrc.11 for ; Tue, 10 Apr 2018 12:39:23 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t142sm2405474wmt.12.2018.04.10.12.39.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 12:39:20 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 87A943E06C8; Tue, 10 Apr 2018 20:39:19 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q5tHR9W1VGlVHRbwWx5NGHMfhuyYinJGu9UTmTekjmg=; b=KvURY5Al2QjKiHqYYTXvkCMH3OfbBNsLy+H62HKkZWZROw92AM6GyvT/hdR2b06qpp FHmWlif19i1kQXSeoTNwOXAW8tlIcN5X+oGNd9d1MJTGPa8kiZKL7Pl5OpHncdSMJY7t kAHCkzkRrrFA8IyEuGUud55hAuWhj+2YXr93g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q5tHR9W1VGlVHRbwWx5NGHMfhuyYinJGu9UTmTekjmg=; b=SJRW4o0w7KwR0NtS9C1UrE0ykCzyBj2A4ENiqIzSRdB5zweklMwI7B9iH0Ozb+yyEr WnOvFwoza/VpyKsQNdBqrqwZV2uWAeBE/xlq99FhB1MmLv9yffM0liWcB0589j8HGmNS Av739t0uThwLQF4LGYero7yprnVYFHqntd8LFckK70LcS+/qqyVv09qlY41ONdgTBnI9 dwjWFS6mSq1w7371lPSu3R52BT5Ze28KODx45a6Q1J0RBI4i+Wam9N3BQ3F8t4J8DQo+ C7lEPohF8tYY7LNKLhifR0Gz0gYPIoBWPJVfgt/m+WAM83WcY1rz9GIChhpgyKOFoxiS zNWQ== X-Gm-Message-State: ALQs6tAOOENKQFy/fyuRUP+hqHQ1LQO2lbodbkI8+770+FI+Vv21U3Un cgxQqZVprEVxH5tw/WNJNH7fyQ== X-Google-Smtp-Source: AIpwx48ic3d47ZK7ZfMNQnAJGgY+IWhD1UHBQW7lfa8vCfeKvMS5rQZGM8ItVkDWyN/Af95SWG0PXg== X-Received: by 10.223.160.91 with SMTP id l27mr1250135wrl.114.1523389162342; Tue, 10 Apr 2018 12:39:22 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 20:38:57 +0100 Message-Id: <20180410193919.28026-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410193919.28026-1-alex.bennee@linaro.org> References: <20180410193919.28026-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [PATCH v1 02/24] configure: add support for --cross-cc-FOO X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , famz@redhat.com, cota@braap.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This allows us to specify cross compilers for our guests. This is useful for building test images/programs. Currently we re-run the compile test for each target. I couldn't think of a way to cache the value for a given arch without getting messier configure code. The cross compiler for the guest is visible to each target as CROSS_CC_GUEST in config-target.mak. Signed-off-by: Alex Benn=C3=A9e --- configure | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/configure b/configure index b402befe94..b5f3b3fe29 100755 --- a/configure +++ b/configure @@ -453,6 +453,13 @@ vxhs=3D"" libxml2=3D"" docker=3D"no" =20 +# cross compilers defaults, can be overridden with --cross-cc-ARCH +cross_cc_aarch64=3D"aarch64-linux-gnu-gcc" +cross_cc_arm=3D"arm-linux-gnueabihf-gcc" +cross_cc_powerpc=3D"powerpc-linux-gnu-gcc" + +enabled_cross_compilers=3D"" + supported_cpu=3D"no" supported_os=3D"no" bogus_os=3D"no" @@ -483,6 +490,11 @@ for opt do ;; --disable-debug-info) debug_info=3D"no" ;; + --cross-cc-*[!a-zA-Z0-9_0]=3D*) error_exit "Passed bad --cross-cc-FOO op= tion" + ;; + --cross-cc-*) cc_arch=3D${opt#--cross-cc-} + eval "cross_cc_${cc_arch}=3D\$optarg" + ;; esac done # OS specific @@ -675,10 +687,12 @@ case "$cpu" in i386|i486|i586|i686|i86pc|BePC) cpu=3D"i386" supported_cpu=3D"yes" + cross_cc_i386=3Dgcc ;; x86_64|amd64) cpu=3D"x86_64" supported_cpu=3D"yes" + cross_cc_x86_64=3Dgcc ;; armv*b|armv*l|arm) cpu=3D"arm" @@ -912,6 +926,8 @@ for opt do ;; --disable-debug-info) ;; + --cross-cc-*) + ;; --enable-modules) modules=3D"yes" ;; @@ -6766,6 +6782,8 @@ case "$target" in ;; esac =20 +target_compiler=3D"" + mkdir -p $target_dir echo "# Automatically generated by configure - do not modify" > $config_ta= rget_mak =20 @@ -6794,6 +6812,7 @@ case "$target_name" in bflt=3D"yes" mttcg=3D"yes" gdb_xml_files=3D"arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" + target_compiler=3D$cross_cc_arm ;; aarch64|aarch64_be) TARGET_ARCH=3Daarch64 @@ -6801,6 +6820,7 @@ case "$target_name" in bflt=3D"yes" mttcg=3D"yes" gdb_xml_files=3D"aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp= .xml arm-vfp3.xml arm-neon.xml" + target_compiler=3D$cross_cc_aarch64 ;; cris) ;; @@ -6842,6 +6862,7 @@ case "$target_name" in ;; ppc) gdb_xml_files=3D"power-core.xml power-fpu.xml power-altivec.xml power-= spe.xml" + target_compiler=3D$cross_cc_powerpc ;; ppcemb) TARGET_BASE_ARCH=3Dppc @@ -6916,6 +6937,25 @@ if [ "$TARGET_BASE_ARCH" =3D "" ]; then TARGET_BASE_ARCH=3D$TARGET_ARCH fi =20 +# Do we have a cross compiler for this target? +if has $target_compiler; then + + cat > $TMPC << EOF +#include +int main(void) { + printf("Hello World!\n"); +} +EOF + + if ! do_compiler $target_compiler -o $TMPE $TMPC -static ; then + target_compiler=3D"" + else + enabled_cross_compilers=3D"${enabled_cross_compilers} ${target_com= piler}" + fi +else + target_compiler=3D"" +fi + symlink "$source_path/Makefile.target" "$target_dir/Makefile" =20 upper() { @@ -6989,6 +7029,10 @@ if test "$target_bsd_user" =3D "yes" ; then echo "CONFIG_BSD_USER=3Dy" >> $config_target_mak fi =20 +if test -n "$target_compiler"; then + echo "CROSS_CC_GUEST=3D$target_compiler" >> $config_target_mak +fi + # generate QEMU_CFLAGS/LDFLAGS for targets =20 cflags=3D"" @@ -7111,6 +7155,12 @@ echo "QEMU_CFLAGS+=3D$cflags" >> $config_target_mak =20 done # for target in $targets =20 +if test -n "$enabled_cross_compilers"; then + echo + echo "NOTE: cross-compilers enabled:" + printf '%s\n' $enabled_cross_compilers | sort -u +fi + if [ "$dtc_internal" =3D "yes" ]; then echo "config-host.h: subdir-dtc" >> $config_host_mak fi --=20 2.16.2