From patchwork Wed Jun 1 18:05:29 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: 577826 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp859044mab; Wed, 1 Jun 2022 11:31:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu+4AcDBPZrp/Baomh1FhAgHcA3QMmLBMg2g3wy4DjYoasodORjj8NafPMAm3QKGRI5HkY X-Received: by 2002:ac8:5d8a:0:b0:2f3:dcaa:f1c7 with SMTP id d10-20020ac85d8a000000b002f3dcaaf1c7mr841486qtx.529.1654108270285; Wed, 01 Jun 2022 11:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654108270; cv=none; d=google.com; s=arc-20160816; b=amZ6nEJnSqQdVkPZqNdXYjOrAmNlVroPuOt4YcAoG0uLpIbcok0QMkdgl4KFz76ozI HXuStiLjbU7khGRaw+sEwNJNAEyvTtyB8CaGd1Irl9C3/He4Z2H63gDMwGrkT9Il6iCJ fSdbWRgKaGXclwZlhJovCBRzCkmWHngxFGL6I41hsaBFiXwUelerCXN8EFqfvJfvC8Pk n3JHDHU+1t0NzrSTDb+z4IUCEBf2tcNfDFCIN6HrizRnKbSj0W3UaTpbLYjzWzzMLJWE /jDmTErhMjcjHdoX00c/bdiucPZwAPfJOj7pU5l1bi9ylUCvZ+1QULR6ZAXzm/0m9uzu obow== 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=3D8/UyD+ztVeocgeehcA/xb0KzGAE86uC41XX1vBnSs=; b=Cyu9pVNKhVINNzUsw33Fj4adnX81bAu4Xck6wxQtzC3jfJ49EPwxDEEW0cFxXSQ4Eq p8OhVL5iJ9+hXuHYrs1dYHON//I66j7iyAEK84y1k7dIgWCOZNSOwEiXSPnj9geteYpl aRGqDgMdLeqcLQ9UAe0hdFz5gv0xF/ctX4CxJFkcsYmORKFX1FC5RFidfxC6zXsd6Eb9 bwxSbzprolQEkQmBTqaMaFdkettxk4Q7OahoOT8bH3CDC+iHfRTM6lOEYPg2EAweMy8h aNLm03I/x9d0YVNIugHiCCO0rgCE6VaYURnIKVmKLLO0YYsB5fU8oPXgbbZAPIDBK+pd vn2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wEHO5EN1; 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 e12-20020a0562140d8c00b004620e890fe1si1143256qve.272.2022.06.01.11.31.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Jun 2022 11:31:10 -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=wEHO5EN1; 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]:35284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwT7c-0002MK-OL for patch@linaro.org; Wed, 01 Jun 2022 14:31:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwSr5-0001dx-DO for qemu-devel@nongnu.org; Wed, 01 Jun 2022 14:14:03 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:45961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwSr3-0006Xa-Hy for qemu-devel@nongnu.org; Wed, 01 Jun 2022 14:14:03 -0400 Received: by mail-ej1-x62e.google.com with SMTP id jx22so5361624ejb.12 for ; Wed, 01 Jun 2022 11:14:00 -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=3D8/UyD+ztVeocgeehcA/xb0KzGAE86uC41XX1vBnSs=; b=wEHO5EN1aGj4BbNXnK77aPshmjP+Ksk+4YpNovNp6ZZW5AkTwrI4S2j1ckcIsFzUrO u3aDFSYb3U8kmZRzfMrRu3522JnfigsrbA1wfB8BP031QbSzd0zR1KVJp/yfAC5w/uOu RngoonLfaz1efkh6qsF6owusdN2Y4ebG2mPToopZiq4lN860oPDHMtkgNTH8ylhKtngg 5DKA9GUWaw2Ryiz1n9MaxO2aM8T7J0w/NsVvDLMXEDYt7CiO0FAK9iyFszFilx/mUgxy s4HjJeGB1xc25D943jVVuYUCb9SQzqufAwYxOEDdZNXHYMVhyc6fvxDMJk77GP5Q7fyP N5ZA== 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=3D8/UyD+ztVeocgeehcA/xb0KzGAE86uC41XX1vBnSs=; b=57VaqCf/i+LkJButQr2o252cxxvwhM2cEFZkOE2NDAxH1bSRSGRERb3/OuINwHY0H3 hiBM3uELU/2OlqkmAn7UAHlmneF+HqaZ9iTY2waENNw9IOkejM5frMidw5khdwU58fMW Y/+uK3Zfdll9DuYjlYwvJnnNcRJGBPsMEFd1QKhNKqlz/spEC+onfkTglR5lzSQdGtkE yf/ptcJ44LeVaCsHu28uPrYH5ZRP8MUPBGu6mOsB9JwkOE4gE+BplZmHbpxtI1J6dU0f PTIAGMxrgKtpMuycwQzHtP+z9I4ETmn8vcVeiNrOivgT+vdL94XspWiyJOewh05hgjNT M1rg== X-Gm-Message-State: AOAM532FzXHOz0IaPhnBz9Gahs5T2DIfGjJrskOs473aXL49VDRBnQuh LC18YzGWyHKgg3YrSR6WMxxeKg== X-Received: by 2002:a17:906:6a29:b0:705:dc2b:727b with SMTP id qw41-20020a1709066a2900b00705dc2b727bmr737227ejc.80.1654107239012; Wed, 01 Jun 2022 11:13:59 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m3-20020aa7c483000000b0042de29d8fc0sm1329097edq.94.2022.06.01.11.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 11:13:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 15D481FFD0; Wed, 1 Jun 2022 19:05:40 +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 25/33] configure: enable cross-compilation of optionrom Date: Wed, 1 Jun 2022 19:05:29 +0100 Message-Id: <20220601180537.2329566-26-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::62e; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62e.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 While container-based cross compilers are not supported, this already makes it possible to build x86 optionroms on any machine that has an installation of GCC and binutils for 32- or 64-bit x86. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Message-Id: <20220517092616.1272238-15-pbonzini@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20220527153603.887929-26-alex.bennee@linaro.org> diff --git a/configure b/configure index f509bce304..1ae5c950f0 100755 --- a/configure +++ b/configure @@ -2082,6 +2082,13 @@ probe_target_compiler() { fi } +probe_target_compilers() { + for i; do + probe_target_compiler $i + test -n "$target_cc" && return 0 + done +} + write_target_makefile() { if test -n "$target_cc"; then echo "CC=$target_cc" @@ -2190,6 +2197,10 @@ if test "$QEMU_GA_VERSION" = ""; then QEMU_GA_VERSION=$(cat $source_path/VERSION) fi + +####################################### +# cross-compiled firmware targets + # Set up build tree symlinks that point back into the source tree # (these can be both files and directories). # Caution: avoid adding files or directories here using wildcards. This @@ -2216,19 +2227,27 @@ done # Mac OS X ships with a broken assembler roms= -if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ +probe_target_compilers i386 x86_64 +if test -n "$target_cc" && test "$targetos" != "darwin" && test "$targetos" != "sunos" && \ test "$targetos" != "haiku" && test "$softmmu" = yes ; then # Different host OS linkers have different ideas about the name of the ELF # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe. for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do - if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then + if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then ld_i386_emulation="$emu" - roms="optionrom" break fi done + if test -n "$ld_i386_emulation"; then + roms="optionrom" + config_mak=pc-bios/optionrom/config.mak + echo "# Automatically generated by configure - do not modify" > $config_mak + echo "TOPSRC_DIR=$source_path" >> $config_mak + echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak + write_target_makefile >> $config_mak + fi fi # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10 @@ -2381,7 +2400,6 @@ echo "GLIB_LIBS=$glib_libs" >> $config_host_mak echo "GLIB_BINDIR=$glib_bindir" >> $config_host_mak echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak -echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "STRIP=$strip" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak @@ -2571,10 +2589,6 @@ for target in $target_list; do done echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $makefile) -config_mak=pc-bios/optionrom/config.mak -echo "# Automatically generated by configure - do not modify" > $config_mak -echo "TOPSRC_DIR=$source_path" >> $config_mak - if test "$skip_meson" = no; then cross="config-meson.cross.new" meson_quote() { diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 17ccc76241..f639915b4f 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -6,7 +6,6 @@ all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bi # Dummy command so that make thinks it has done something @true -include ../../config-host.mak CFLAGS = -O2 -g quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) @@ -44,7 +43,6 @@ Wa = -Wa, override ASFLAGS += -32 override CFLAGS += $(call cc-option, $(Wa)-32) -LD_I386_EMULATION ?= elf_i386 override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds pvh.img: pvh.o pvh_main.o