From nobody Mon Feb 9 23:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1664457278; cv=none; d=zohomail.com; s=zohoarc; b=XAeRKyjDnSArAqEPEiaVZb9mi5fORLQeSVhZ8gTFcwId8PfOBOso1ZCXVdBM+g0qY23whtavgS9pqqZMiq7vpDs14dstDMHIepRYQodXcTU7fhoGWpBdcs4Rxnv9iaSveoW6ayfem/bbZbAIj4BodR6iSwAQYZk698ysV+Ilncw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664457278; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jvR/TDSR8cw2AhfrQlMzvGus+KFpvWKO7FCeQd/PjXU=; b=Voj/yQS+Y574IQzRzkYC4DVv8huBmK/NsRgg6n8e/mIzTTL908iOhY87Q2WFylEtI4RoyvnCjKHhF3rOHyAMf0gQAKWsR38pKMRTnFM0NS7mrOw3C4Sxq3ZqzjHFmWZ5STsCRhrS3RCk9o5Vr8erQlDmtNTcKt0gtaQJuHEQlYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16644572784511014.9222766289412; Thu, 29 Sep 2022 06:14:38 -0700 (PDT) Received: from localhost ([::1]:50436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odtN5-0001gb-1M for importer@patchew.org; Thu, 29 Sep 2022 09:14:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odrwC-0004Xn-EJ for qemu-devel@nongnu.org; Thu, 29 Sep 2022 07:42:44 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odrwA-0001CG-Gq for qemu-devel@nongnu.org; Thu, 29 Sep 2022 07:42:44 -0400 Received: by mail-wr1-x42e.google.com with SMTP id cc5so1752637wrb.6 for ; Thu, 29 Sep 2022 04:42:42 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id m6-20020adfe946000000b0022af63bb6f2sm4349086wrn.113.2022.09.29.04.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 04:42:39 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C32011FFB7; Thu, 29 Sep 2022 12:42:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=jvR/TDSR8cw2AhfrQlMzvGus+KFpvWKO7FCeQd/PjXU=; b=uLi7xHYm8Cj3LFxxImqi4dXcixnyVoWVtroM3Ai/PvQEvbHSup1SyjKVP/P658fGMR V91WX3+9hKsEduaunB+9UTDOJzx0ah66S8buBs3K9TAbdqZrztt+yEUF89t8bm0ly90G 9PlZI1v1pAYkW32XQXQs10MOO+n13a0c5l9pVpSPQ4ebYiBOIZ2NK/9kf1aiKh6PI5at nk1SQh+8dfOrIP+IxHW+4s4+sTIBt4H0MslzEtR9Rcbn2EAYsa7hSpoIWraRjHZrYBeA e3R1HIeSWKkjajRNVlObpAMQ5xoUKW1Iv0OObtZT3vedUTfIpfkOVcJ1LmCpaTN+PIO8 b7yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=jvR/TDSR8cw2AhfrQlMzvGus+KFpvWKO7FCeQd/PjXU=; b=eHBO2F9Rl2MJnwTy6n0rDwLKy4YCHljRGXQKyNALnAu0mEvwwhPb2ulU9kvCY74NWj k3b64JR7wSyjDIG9vGCWE/zzJ/yjCO14YZ/KhbP8ZG02IiytEtERpDb2JQ5CP6fvBtxD bao9u7Iu1cXfBdG8amZ6S1wYPw6ywvHI7btFnasrzo0VMCI3N2SOD4kAFvJBVNR3pDTb VOVdWVZPdRqab/qkAeWf3Iw/iCZyFihdmcPEd0P/GdQD0cRjCO7Sam4pqmUsVvgan89H RHfGiX2eBBeThS7tA//UStzxVM0QOOx3PrwP4EOs/iQMbGc6oQIABrpyFqKsWQnPBzHZ Djjw== X-Gm-Message-State: ACrzQf2Y98WsNuYG31sEUStLvjKGXhNDSM44/uOPJ52w71J3bNHzsTVp PAye3E527Jobm8MsFsgfbRyh5A== X-Google-Smtp-Source: AMsMyM76siPm8J4fETF47RGOr6d5wdxjbDLo0Hiq7E/E/JN2IAMU4kDktpB2uGHTNpaGcvhlbxW/zw== X-Received: by 2002:a5d:460f:0:b0:22c:c851:40d4 with SMTP id t15-20020a5d460f000000b0022cc85140d4mr1980809wrq.130.1664451761795; Thu, 29 Sep 2022 04:42:41 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: fam@euphon.net, berrange@redhat.com, f4bug@amsat.org, aurelien@aurel32.net, pbonzini@redhat.com, stefanha@redhat.com, crosa@redhat.com, minyihh@uci.edu, ma.mandourr@gmail.com, Luke.Craig@ll.mit.edu, cota@braap.org, aaron@os.amperecomputing.com, kuhn.chenqun@huawei.com, robhenry@microsoft.com, mahmoudabdalghany@outlook.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v1 13/51] pc-bios/optionrom: detect CC options just once Date: Thu, 29 Sep 2022 12:41:53 +0100 Message-Id: <20220929114231.583801-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929114231.583801-1-alex.bennee@linaro.org> References: <20220929114231.583801-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1664457279936100001 From: Paolo Bonzini In preparation for adding Docker container support, detect compiler options just once rather than once per Make run; container startup overhead is substantial and doing the detection just once makes things faster. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Benn=C3=A9e --- pc-bios/optionrom/Makefile | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 3e06c11dea..f514e4f84b 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -8,23 +8,33 @@ all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxb= oot_dma.bin kvmvapic.bi =20 CFLAGS =3D -O2 -g =20 -quiet-command =3D $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1= , @$1)) -cc-option =3D $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/nu= ll 2>&1 && echo OK), $1, $2) - -override CFLAGS +=3D -march=3Di486 -Wall $(EXTRA_CFLAGS) -m16 +NULL :=3D +SPACE :=3D $(NULL) # +TARGET_PREFIX :=3D $(patsubst %/,%:$(SPACE),$(TARGET_DIR)) =20 -# If -fcf-protection is enabled in flags or compiler defaults that will -# conflict with -march=3Di486 -override CFLAGS +=3D $(call cc-option, -fcf-protection=3Dnone) +quiet-@ =3D $(if $(V),,@) +quiet-command =3D $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1= , @$1)) =20 # Flags for dependency generation override CPPFLAGS +=3D -MMD -MP -MT $@ -MF $(@D)/$(*F).d =20 -override CFLAGS +=3D $(call cc-option, -fno-pie) -override CFLAGS +=3D $(call cc-option, -no-pie) +override CFLAGS +=3D -march=3Di486 -Wall $(EXTRA_CFLAGS) -m16 override CFLAGS +=3D -ffreestanding -I$(TOPSRC_DIR)/include -override CFLAGS +=3D $(call cc-option, -fno-stack-protector) -override CFLAGS +=3D $(call cc-option, -Wno-array-bounds) + +cc-test =3D $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/d= ev/null +cc-option =3D if $(call cc-test, $1); then \ + echo "$(TARGET_PREFIX)$1 detected" && echo "override CFLAGS +=3D $1" >= &3; else \ + echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "override CFLAG= S +=3D $2" >&3); fi + +# If -fcf-protection is enabled in flags or compiler defaults that will +# conflict with -march=3Di486 +config-cc.mak: Makefile + $(quiet-@)($(call cc-option,-fcf-protection=3Dnone); \ + $(call cc-option,-fno-pie); \ + $(call cc-option,-no-pie); \ + $(call cc-option,-fno-stack-protector); \ + $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak +-include config-cc.mak =20 override LDFLAGS =3D -nostdlib -Wl,-T,$(SRC_DIR)/flat.lds =20 @@ -50,7 +60,10 @@ include $(wildcard *.d) clean: rm -f *.o *.d *.raw *.img *.bin *~ =20 +distclean: + rm -f config-cc.mak + # suppress auto-removal of intermediate files .SECONDARY: =20 -.PHONY: all clean +.PHONY: all clean distclean --=20 2.34.1