From nobody Tue Feb 10 10:55:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651242516733539.6545564291076; Fri, 29 Apr 2022 07:28:36 -0700 (PDT) Received: from localhost ([::1]:50728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkRbn-0008RA-Eu for importer@patchew.org; Fri, 29 Apr 2022 10:28:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkRS0-0005l6-0Y for qemu-devel@nongnu.org; Fri, 29 Apr 2022 10:18:30 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:33476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkRRy-0004a9-Ab for qemu-devel@nongnu.org; Fri, 29 Apr 2022 10:18:27 -0400 Received: by mail-ej1-x629.google.com with SMTP id gh6so15826313ejb.0 for ; Fri, 29 Apr 2022 07:18:25 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id jz1-20020a17090775e100b006f3ef214e27sm692298ejc.141.2022.04.29.07.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 07:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mOjpMWbtSWYMaSIQQN91Mhp5Lq9EP7onS/rq0Krzws0=; b=mGtgHrTCkZPzZeNwrVkUVOR0wCXhNFHYKn0SewqaqyRD/8dB4mGcpv3MfkTRsVrhWF EgR8zf84n/SrXNc/nBLvcsL9/PQU51PC6SqQf3E1bU3R6nxXbN0SU6ihEeswDMT5gqPi Bb5iWacTuZMrtF1VrD9UqGl6dovls0FQHcGPoBgx6H98VSsaxiCQzdeD9WgGTjokwm8p qYlZgYIaCOpRW0+sXqVjz9bBicvtCOuFm/5WAJJA4pX7y6KOCGXlNDwCc1iXii13cltQ dt0q5HLvcu8FaVqkPaB5MsIGpPehvmlNlk8Y4dpKGB5LrJSfNADkYhT1Wmn4K2SSJNbE k87g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mOjpMWbtSWYMaSIQQN91Mhp5Lq9EP7onS/rq0Krzws0=; b=X0r8qfLOjW8c4OFBaQcn0wvBz/htr2agnqMSpyuxyI6Yt75Nt8Y8hpjd8bI2pDLkIq Qju5Rcjb62MgijVf+IW+w1BgCq7L9cSdce9xWrf9dDRSllzfbOEl+GcYOt4d8C/JOdth 1YcMtHVPJLRTQl0RUX3F+2WeUPT75Sm2Swh5LICwaqTApN3rTLmZLQa6ZFKcSft7sFtJ oI/QUaxkWzwgdyRaalplX0FAaTGDzF4Iq8Zvp3hcjnGVsM+z3StLyJyEj8nvgLSsAgwJ aQDfX9wW7KCG1ifv169nL1h51wtnGccbybI1n5YDPQR9fvcr0mtqMKjgE3xPXCp9NOrr l9YQ== X-Gm-Message-State: AOAM531vxVsA3sLb7POZGYGjpj8KoB5QW3Ca3CAkU7os5WZlFZk6bCov jTpqRY87ACeUJ1+a9GMsK0RyG+iMZmYCVA== X-Google-Smtp-Source: ABdhPJzqOIjiVY8eOK5vQwRnr3LEnrc0dNnsF67xHuNkfKsP6TMtvsJkVnLs9BWn3GXqIBvjpFTe+g== X-Received: by 2002:a17:906:5006:b0:6ce:3762:c72e with SMTP id s6-20020a170906500600b006ce3762c72emr35602275ejj.30.1651241904991; Fri, 29 Apr 2022 07:18:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [RFC PATCH 11/12] configure: enable cross-compilation of optionrom Date: Fri, 29 Apr 2022 16:18:12 +0200 Message-Id: <20220429141813.328975-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220429141813.328975-1-pbonzini@redhat.com> References: <20220429141813.328975-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: alex.bennee@linaro.org, richard.henderson@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651242518725100001 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- configure | 29 +++++++++++++++++++++-------- pc-bios/optionrom/Makefile | 4 +--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 07ee586ef5..6b8e2e2fdb 100755 --- a/configure +++ b/configure @@ -2100,6 +2100,13 @@ probe_target_compiler() { fi } =20 +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=3D$target_cc" @@ -2210,6 +2217,9 @@ fi =20 QEMU_GA_MSI_MINGW_BIN_PATH=3D"$($pkg_config --variable=3Dprefix glib-2.0)/= bin" =20 +####################################### +# 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 @@ -2236,19 +2246,27 @@ done =20 # Mac OS X ships with a broken assembler roms=3D -if { test "$cpu" =3D "i386" || test "$cpu" =3D "x86_64"; } && \ +probe_target_compilers i386 x86_64 +if test -n "$target_cc" && test "$targetos" !=3D "darwin" && test "$targetos" !=3D "sunos" &&= \ test "$targetos" !=3D "haiku" && test "$softmmu" =3D 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 i386p= e. 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=3D"$emu" - roms=3D"optionrom" break fi done + if test -n "$ld_i386_emulation"; then + roms=3D"optionrom" + config_mak=3Dpc-bios/optionrom/config.mak + echo "# Automatically generated by configure - do not modify" > $c= onfig_mak + echo "TOPSRC_DIR=3D$source_path" >> $config_mak + echo "LD_I386_EMULATION=3D$ld_i386_emulation" >> $config_mak + write_target_makefile >> $config_mak + fi fi =20 # Only build s390-ccw bios the compiler has -march=3Dz900 or -march=3Dz10 = (which is @@ -2403,7 +2421,6 @@ echo "GLIB_CFLAGS=3D$glib_cflags" >> $config_host_mak echo "GLIB_LIBS=3D$glib_libs" >> $config_host_mak echo "GLIB_VERSION=3D$(pkg-config --modversion glib-2.0)" >> $config_host_= mak echo "QEMU_LDFLAGS=3D$QEMU_LDFLAGS" >> $config_host_mak -echo "LD_I386_EMULATION=3D$ld_i386_emulation" >> $config_host_mak echo "STRIP=3D$strip" >> $config_host_mak echo "EXESUF=3D$EXESUF" >> $config_host_mak =20 @@ -2593,10 +2610,6 @@ for target in $target_list; do done echo "TCG_TESTS_TARGETS=3D$tcg_tests_targets" >> $makefile) =20 -config_mak=3Dpc-bios/optionrom/config.mak -echo "# Automatically generated by configure - do not modify" > $config_mak -echo "TOPSRC_DIR=3D$source_path" >> $config_mak - if test "$skip_meson" =3D no; then cross=3D"config-meson.cross.new" meson_quote() { diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 2494ad9c25..6696ce010a 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -6,7 +6,6 @@ all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboo= t_dma.bin kvmvapic.bi # Dummy command so that make thinks it has done something @true =20 -include ../../config-host.mak CFLAGS =3D -O2 -g =20 quiet-command =3D $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1= , @$1)) @@ -44,13 +43,12 @@ Wa =3D -Wa, override ASFLAGS +=3D -32 override CFLAGS +=3D $(call cc-option, $(Wa)-32) =20 -LD_I386_EMULATION ?=3D elf_i386 override LDFLAGS =3D -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds =20 pvh.img: pvh.o pvh_main.o =20 %.o: %.S - $(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o = $@,"AS","$@") + $(call quiet-command,$(CC) -E $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -= o $@,"AS","$@") =20 %.o: %.c $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@") --=20 2.35.1