From patchwork Wed Jun 1 18:05:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 577803 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp841692mab; Wed, 1 Jun 2022 11:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt/dDwKCKmztko9zspwViVQbhHEFGdI+mgox8O4WabNCk4/z2yEB7/JFgGJjPXX3xA93Jo X-Received: by 2002:ad4:5346:0:b0:461:c8df:d9c4 with SMTP id v6-20020ad45346000000b00461c8dfd9c4mr55880490qvs.23.1654106991200; Wed, 01 Jun 2022 11:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654106991; cv=none; d=google.com; s=arc-20160816; b=h3KKU5RmAue40wCmRXYFHqPVMji5Tdz86Pa1zAZLqHW0zmdLexthNvPmItUcBs6gLZ S9Ae9gXp+wRbgkSbsQujBQW7Mm4JL9wZ+2Fg4HOp9BBPiOBcVVSYe6ISd0Xd27rX5QZv 6qBiouEAij7CHj9mZ7qO9ip8wc/w6G2n6rigY7F5iu7tLuTdjZPyUTs3WnxQBlYE6aZF xpkXPRswY8lxZ5fHbb7rOuHS0thkWbHU4dpguv+JJnXzUB9dMtaBolFEheqPXFyAZcxT noAruPYpC/dWkHhPgppXAnTaAXvADy6aRWrcnfTopHDPMhfoeiuQOlYDMGgoaEWYWl1G 9lQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iBL0XOSODfEHetIjDjNAdTd949wca33dTCbjN+2/aeY=; b=I1oBKDqKvLCJg6dtFLkq2qQ/ZGhuuJI+Nn2/MvycC6A2IVTTETsspTyUrr7dQz4pAY PlwbOHHdfQoG0vXlRx/TLkTWkVDhabRxktKBG5+d9lQG4u8zpDqVwp2Xu+hcrg6cH+Vn Wz7lJvhJVuYloqPfKHNeHJvhd7atA4OKT7DhYP3yVTeCgImGAqfuLVnJkfeogBIS/aN7 9dj2IhC2fmkukiiXtFbR/k3xr95LnL8JvmlN04oQDsTxNq4qTH5htNklTqXBRY5fytbm cg83nQ6TU0spQavvHEBfPsnbGogT/Ddgk+5P1YEDo5km8ZySL28mJINbYrjblkV+eYQP +VQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQ84CWsb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f200-20020a379cd1000000b006a35626d180si1157689qke.734.2022.06.01.11.09.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Jun 2022 11:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQ84CWsb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwSn0-00073k-3Y for patch@linaro.org; Wed, 01 Jun 2022 14:09:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwSjO-0001Ov-6r for qemu-devel@nongnu.org; Wed, 01 Jun 2022 14:06:06 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:36549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwSjM-00050z-2B for qemu-devel@nongnu.org; Wed, 01 Jun 2022 14:06:05 -0400 Received: by mail-ej1-x631.google.com with SMTP id gi33so5383989ejc.3 for ; Wed, 01 Jun 2022 11:06:02 -0700 (PDT) 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=iBL0XOSODfEHetIjDjNAdTd949wca33dTCbjN+2/aeY=; b=AQ84CWsb40CljUzLnmy+UvruBgW71tBMKDPl7py9+2sturyAz5QFkuyjkBUOBwj32k 7WVPR1lFS3uO+obSe0A4yA6RQpBUpBlYI3OPIe1HSz2x9N1VSr7O7d084dAhm0430cCo HgrcawUvIPAFAFTpQg+lxEnJnUpVkT26AiQlJv1YkE1n+StuI8ux7iA2ov0B66KtxwLB yWWauqsVika+9+RjyFMH3+POT08u6WHbOKiJRoPMni+gHfcUpfEWUdf9oHoKeXhEDNJR YoakoTvFtlYdnvyyz7FnILz8alyPSbhlC1VrJSUSzwHiBmE94KseUIt+7WOrNrWqm5Gg l98w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iBL0XOSODfEHetIjDjNAdTd949wca33dTCbjN+2/aeY=; b=sHektZZ3PZoUU3NDl8KFrMXlc4Gz4i68Ksd4GA+OJV2nVKwIrITQbYa/GYeKVbr8Sc hiWyxEddCk4DM1FCD7iD8wIi4jE1uxIVz13Oh+qfo3I6iFXagVofQDroHLVmhXJRQnES VOiYvG/u2nfKxKgWC0YUFxx2Oab3UuhpO5orRSGc5qVstBAGRbqTxBxKx8K8G1Qx29m1 JUnoSi0S7eS2KMnu8lHqcZJV21C7u7DnkFQnHzee5Qwef5qS78blD2lf5nWqXrq0w/ic 24gEMqjRT1LKSVSTEvDhn6PmEDZTDv8QJxy5GIQMFcHmqhjjKVB5ELMqG05dVC9p6jfa HdCw== X-Gm-Message-State: AOAM532M+8QkHtwSRmgt/J4/HSYopEG23C+OSBI9kuL6bB1y/M5Q8pzx Hi+geJXQ7R2zshn/XOEl2L1PpQ== X-Received: by 2002:a17:907:8a1f:b0:6fe:f4fc:750f with SMTP id sc31-20020a1709078a1f00b006fef4fc750fmr657508ejc.399.1654106761654; Wed, 01 Jun 2022 11:06:01 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r23-20020a170906365700b006fef51aa566sm960786ejb.2.2022.06.01.11.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:06:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9E5471FFCC; Wed, 1 Jun 2022 19:05:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, richard.henderson@linaro.org Cc: qemu-devel@nongnu.org, Paolo Bonzini , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Subject: [PULL 21/33] configure: introduce --cross-prefix-*= Date: Wed, 1 Jun 2022 19:05:25 +0100 Message-Id: <20220601180537.2329566-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220601180537.2329566-1-alex.bennee@linaro.org> References: <20220601180537.2329566-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Also in preparation for handling more binaries from the cross binutils, support an option --cross-prefix-ARCH. All cross_cc_* defaults are replaced with cross_prefix_*; the cross_cc_* fallbacks are extended to the cross-compilation prefix, but the compiler fallbacks remain as well. This way, for example, --cross-cc-arm=arm-linux-gnueabihf-clang also applies to armeb binaries. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Message-Id: <20220517092616.1272238-11-pbonzini@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20220527153603.887929-22-alex.bennee@linaro.org> diff --git a/configure b/configure index 217c8b3cac..f55ae82a5d 100755 --- a/configure +++ b/configure @@ -363,6 +363,11 @@ for opt do --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} eval "cross_cc_${cc_arch}=\$optarg" ;; + --cross-prefix-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-prefix-FOO option" + ;; + --cross-prefix-*) cc_arch=${opt#--cross-prefix-}; cc_arch=${cc_arch%%=*} + eval "cross_prefix_${cc_arch}=\$optarg" + ;; esac done # OS specific @@ -728,6 +733,8 @@ for opt do ;; --cross-cc-*) ;; + --cross-prefix-*) + ;; --enable-debug-info) meson_option_add -Ddebug=true ;; --disable-debug-info) meson_option_add -Ddebug=false @@ -1016,6 +1023,7 @@ Advanced options (experts only): --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS --cross-cc-ARCH=CC use compiler when building ARCH guest test cases --cross-cc-cflags-ARCH= use compiler flags when building ARCH guest tests + --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases --make=MAKE use specified make [$make] --python=PYTHON use specified python [$python] --meson=MESON use specified meson [$meson] @@ -1818,44 +1826,54 @@ if test $use_containers = "yes"; then fi # cross compilers defaults, can be overridden with --cross-cc-ARCH -: ${cross_cc_aarch64="aarch64-linux-gnu-gcc"} +: ${cross_prefix_aarch64="aarch64-linux-gnu-"} +: ${cross_prefix_aarch64_be="$cross_prefix_aarch64"} +: ${cross_prefix_alpha="alpha-linux-gnu-"} +: ${cross_prefix_arm="arm-linux-gnueabihf-"} +: ${cross_prefix_armeb="$cross_prefix_arm"} +: ${cross_prefix_hexagon="hexagon-unknown-linux-musl-"} +: ${cross_prefix_hppa="hppa-linux-gnu-"} +: ${cross_prefix_i386="i686-linux-gnu-"} +: ${cross_prefix_m68k="m68k-linux-gnu-"} +: ${cross_prefix_microblaze="microblaze-linux-musl-"} +: ${cross_prefix_mips64el="mips64el-linux-gnuabi64-"} +: ${cross_prefix_mips64="mips64-linux-gnuabi64-"} +: ${cross_prefix_mipsel="mipsel-linux-gnu-"} +: ${cross_prefix_mips="mips-linux-gnu-"} +: ${cross_prefix_nios2="nios2-linux-gnu-"} +: ${cross_prefix_ppc="powerpc-linux-gnu-"} +: ${cross_prefix_ppc64="powerpc64-linux-gnu-"} +: ${cross_prefix_ppc64le="$cross_prefix_ppc64"} +: ${cross_prefix_riscv64="riscv64-linux-gnu-"} +: ${cross_prefix_s390x="s390x-linux-gnu-"} +: ${cross_prefix_sh4="sh4-linux-gnu-"} +: ${cross_prefix_sparc64="sparc64-linux-gnu-"} +: ${cross_prefix_sparc="$cross_prefix_sparc64"} +: ${cross_prefix_x86_64="x86_64-linux-gnu-"} + : ${cross_cc_aarch64_be="$cross_cc_aarch64"} : ${cross_cc_cflags_aarch64_be="-mbig-endian"} -: ${cross_cc_alpha="alpha-linux-gnu-gcc"} -: ${cross_cc_arm="arm-linux-gnueabihf-gcc"} : ${cross_cc_armeb="$cross_cc_arm"} : ${cross_cc_cflags_armeb="-mbig-endian"} : ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"} : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"} -: ${cross_cc_hppa="hppa-linux-gnu-gcc"} -: ${cross_cc_i386="i686-linux-gnu-gcc"} : ${cross_cc_cflags_i386="-m32"} -: ${cross_cc_m68k="m68k-linux-gnu-gcc"} -: ${cross_cc_microblaze="microblaze-linux-musl-gcc"} -: ${cross_cc_mips64el="mips64el-linux-gnuabi64-gcc"} -: ${cross_cc_mips64="mips64-linux-gnuabi64-gcc"} -: ${cross_cc_mipsel="mipsel-linux-gnu-gcc"} -: ${cross_cc_mips="mips-linux-gnu-gcc"} -: ${cross_cc_nios2="nios2-linux-gnu-gcc"} -: ${cross_cc_ppc="powerpc-linux-gnu-gcc"} : ${cross_cc_cflags_ppc="-m32"} -: ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"} : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"} : ${cross_cc_ppc64le="$cross_cc_ppc64"} : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"} -: ${cross_cc_riscv64="riscv64-linux-gnu-gcc"} -: ${cross_cc_s390x="s390x-linux-gnu-gcc"} -: ${cross_cc_sh4="sh4-linux-gnu-gcc"} -: ${cross_cc_sparc64="sparc64-linux-gnu-gcc"} : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"} : ${cross_cc_sparc="$cross_cc_sparc64"} : ${cross_cc_cflags_sparc="-m32 -mcpu=supersparc"} -: ${cross_cc_x86_64="x86_64-linux-gnu-gcc"} : ${cross_cc_cflags_x86_64="-m64"} -# tricore is special as it doesn't have a compiler -: ${cross_as_tricore="tricore-as"} -: ${cross_ld_tricore="tricore-ld"} +compute_target_variable() { + if eval test -n "\"\${cross_prefix_$1}\""; then + if eval has "\"\${cross_prefix_$1}\$3\""; then + eval "$2=\"\${cross_prefix_$1}\$3\"" + fi + fi +} probe_target_compiler() { # reset all output variables @@ -1901,93 +1919,99 @@ probe_target_compiler() { aarch64) # We don't have any bigendian build tools so we only use this for AArch64 container_image=debian-arm64-cross - container_cross_cc=aarch64-linux-gnu-gcc-10 + container_cross_prefix=aarch64-linux-gnu- + container_cross_cc=${container_cross_prefix}gcc-10 ;; alpha) container_image=debian-alpha-cross - container_cross_cc=alpha-linux-gnu-gcc + container_cross_prefix=alpha-linux-gnu- ;; arm) # We don't have any bigendian build tools so we only use this for ARM container_image=debian-armhf-cross - container_cross_cc=arm-linux-gnueabihf-gcc + container_cross_prefix=arm-linux-gnueabihf- ;; cris) container_image=fedora-cris-cross - container_cross_cc=cris-linux-gnu-gcc + container_cross_prefix=cris-linux-gnu- ;; hexagon) container_image=debian-hexagon-cross - container_cross_cc=hexagon-unknown-linux-musl-clang + container_cross_prefix=hexagon-unknown-linux-musl- + container_cross_cc=${container_cross_prefix}clang ;; hppa) container_image=debian-hppa-cross - container_cross_cc=hppa-linux-gnu-gcc + container_cross_prefix=hppa-linux-gnu- ;; i386) container_image=fedora-i386-cross - container_cross_cc=gcc + container_cross_prefix= ;; m68k) container_image=debian-m68k-cross - container_cross_cc=m68k-linux-gnu-gcc + container_cross_prefix=m68k-linux-gnu- ;; microblaze) container_image=debian-microblaze-cross - container_cross_cc=microblaze-linux-musl-gcc + container_cross_prefix=microblaze-linux-musl- ;; mips64el) container_image=debian-mips64el-cross - container_cross_cc=mips64el-linux-gnuabi64-gcc + container_cross_prefix=mips64el-linux-gnuabi64- ;; mips64) container_image=debian-mips64-cross - container_cross_cc=mips64-linux-gnuabi64-gcc + container_cross_prefix=mips64-linux-gnuabi64- ;; mipsel) container_image=debian-mipsel-cross - container_cross_cc=mipsel-linux-gnu-gcc + container_cross_prefix=mipsel-linux-gnu- ;; mips) container_image=debian-mips-cross - container_cross_cc=mips-linux-gnu-gcc + container_cross_prefix=mips-linux-gnu- ;; nios2) container_image=debian-nios2-cross - container_cross_cc=nios2-linux-gnu-gcc + container_cross_prefix=nios2-linux-gnu- ;; ppc) container_image=debian-powerpc-test-cross - container_cross_cc=powerpc-linux-gnu-gcc-10 + container_cross_prefix=powerpc-linux-gnu- + container_cross_cc=${container_cross_prefix}gcc-10 ;; ppc64|ppc64le) container_image=debian-powerpc-test-cross - container_cross_cc=powerpc${1#ppc}-linux-gnu-gcc-10 + container_cross_prefix=powerpc${1#ppc}-linux-gnu- + container_cross_cc=${container_cross_prefix}gcc-10 ;; riscv64) container_image=debian-riscv64-test-cross - container_cross_cc=riscv64-linux-gnu-gcc + container_cross_prefix=riscv64-linux-gnu- ;; s390x) container_image=debian-s390x-cross - container_cross_cc=s390x-linux-gnu-gcc + container_cross_prefix=s390x-linux-gnu- ;; sh4) container_image=debian-sh4-cross - container_cross_cc=sh4-linux-gnu-gcc + container_cross_prefix=sh4-linux-gnu- ;; sparc64) container_image=debian-sparc64-cross - container_cross_cc=sparc64-linux-gnu-gcc + container_cross_prefix=sparc64-linux-gnu- ;; tricore) container_image=debian-tricore-cross + container_cross_prefix=tricore- container_cross_as=tricore-as container_cross_ld=tricore-ld + break ;; x86_64) container_image=debian-amd64-cross - container_cross_cc=x86_64-linux-gnu-gcc + container_cross_prefix=x86_64-linux-gnu- ;; xtensa*) # FIXME: xtensa-linux-user? @@ -1995,9 +2019,12 @@ probe_target_compiler() { container_image=debian-xtensa-cross # default to the dc232b cpu - container_cross_cc=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-gcc + container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf- ;; esac + : ${container_cross_cc:=${container_cross_prefix}gcc} + : ${container_cross_as:=${container_cross_prefix}as} + : ${container_cross_ld:=${container_cross_prefix}ld} done eval "target_cflags=\${cross_cc_cflags_$1}" @@ -2005,17 +2032,11 @@ probe_target_compiler() { if eval has "\"\${cross_cc_$1}\""; then eval "target_cc=\"\${cross_cc_$1}\"" fi + else + compute_target_variable $1 target_cc gcc fi - if eval test -n "\"\${cross_as_$1}\""; then - if eval has "\"\${cross_as_$1}\""; then - eval "target_as=\"\${cross_as_$1}\"" - fi - fi - if eval test -n "\"\${cross_ld_$1}\""; then - if eval has "\"\${cross_ld_$1}\""; then - eval "target_ld=\"\${cross_ld_$1}\"" - fi - fi + compute_target_variable $1 target_as as + compute_target_variable $1 target_ld ld if test "$1" = $cpu; then : ${target_cc:=$cc} : ${target_as:=$as} @@ -2048,12 +2069,8 @@ write_container_target_makefile() { if test -n "$container_cross_cc"; then echo "CC=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" fi - if test -n "$container_cross_as"; then - echo "AS=\$(DOCKER_SCRIPT) cc --cc $container_cross_as -i qemu/$container_image -s $source_path --" - fi - if test -n "$container_cross_ld"; then - echo "LD=\$(DOCKER_SCRIPT) cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --" - fi + echo "AS=\$(DOCKER_SCRIPT) cc --cc $container_cross_as -i qemu/$container_image -s $source_path --" + echo "LD=\$(DOCKER_SCRIPT) cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --" }