Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24CDAC88E6E for ; Mon, 14 Sep 2026 16:07:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x69C4-0001Yi-G5; Mon, 14 Sep 2026 12:06:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69BW-0001E6-0z for qemu-arm@nongnu.org; Mon, 14 Sep 2026 12:05:36 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x69BT-0005n6-OI for qemu-arm@nongnu.org; Mon, 14 Sep 2026 12:05:33 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68ED0NJx4090502 for ; Mon, 14 Sep 2026 16:05:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= EBjnOn4AhOKPbK3hOSaFor82Gjg4QPk4gpOYAm9v8II=; b=IVDXeNCGAubdsMjI hqYQ0LDffNsN+hZcEy88dED43tAsSHyPz96BZ1sPowExd3wIh/QWqmGufEPCZbhg RBncOePaZfiNm3+QSglyTqC2cETGhEZYL2VMHY8w5iKrmfzwsPS+nYKZkeWHiMD3 HPVi8qCncVA0c3mfCMIClIyvnNu12LEmXoby1N2EI+65/GW+gVo2b9oBB0KBF2bk KFRh1HAxHY5A3bnEqcq76QwYuM2ylMuMHVS3M/yWzTc77XPJyGjipd1HivNytHzN NuGJMb/9gBSDmD7TnUJMPVI5CTpgdRC+y2lQvoKoInQuR7lZK9VGf5Y5o6pDZchl 3bgXbw== Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpcjg21yw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 14 Sep 2026 16:05:29 +0000 (GMT) Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-448d51840c4so3179172fac.1 for ; Mon, 14 Sep 2026 09:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789401929; x=1790006729; darn=nongnu.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=EBjnOn4AhOKPbK3hOSaFor82Gjg4QPk4gpOYAm9v8II=; b=K6w/dG8mZ9xhl44iPTU1P0Bjo473k2qcbXjWwdMn7RWdcCbHOEvha04WrApDYNl8YS SS09nGShKaeBv2zYNhzQQdgVBGl7v90w9UDyFwQ0MXk65W/7zZGyeb9rWVe6GsyPRUSZ GZqeNCnYFBE4lHAnWUjEL7RM7O3zNjjAxqRdoy+ix6Wc1XxL6vcYvzO8J9SoPn77sggM JSCUnKA+123/iymQ766P2EmWYG+YvfdCIqAaT30AfZldfOVfi059RQSV2TRv/Rg8crwd ETwuRoL6pog3iqGeyUmQrMQQAPbgOccZgQAvLYohfxi0Z6tVvJZgOHm1jp6mD+gXYJF8 P+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789401929; x=1790006729; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=EBjnOn4AhOKPbK3hOSaFor82Gjg4QPk4gpOYAm9v8II=; b=aBqQuDcPaHFAhBwTJQS8bciWeMmLHe1TQzFmBZkkZz2GMSaSXBIFYYpS8VNCb0a4Hd flx36thoXVGEdEGvbvSTmqsNUAocK8tjl2F8eWiAellJu51z8VFGqZlnuEZBXVx39N5B t/oEz1XGKtrdJ4w2fYvcWjMCquaEZ/MvyvBAbvguCjgD3c0lEOuIsF5u4cTXtOI5fRCW btbjjsj2RDbOPdZVVQ2b17RYHJCiui2pHtsr/N24Jj+P5MVihSv+vbIXNH5M67Bbm+0K Hlik4goPZuqKU75ZLnT2j4h6c67H+yNlhZsBYMkD9jdMbfGNniK3bwGcH2DDO1FELZqr +ptQ== X-Forwarded-Encrypted: i=1; AKwUvByslR+3JOvv2IpnUacElTP62iOK2r1vyAYRspZQd1HybDLg09xgGeah9m6pQdCkWBJVafBnvX/p7g==@nongnu.org X-Gm-Message-State: AFuF++lxWPkLKxHHT/e4Er55t4W9FjVPtjnKWcS3tpSFkxRuJf0rrWO1 Ql0d7rzuIiDZmwVibOyCcUpH29bhZ1jdd7OuYRMdAzlcfXLjacgSMJJoHqhxUZpBmn/iwY29mPx YyzOVNM7UfqeQ64oYdY0Nk3+E6zZQztJmXLV61+jnB71yc0LZLukMGRs= X-Gm-Gg: AYBFou0SLsidp+1MZAVqI8SyIp0sIhCHd1ZlQ+kCqkVThCFWUaiREU6GvgrNJp8TTHX Df1aPYs/rbBifu0sKIoUyumsd61n+p3gWX50KCEy2IboLoC5v1bNAUCc64OLABKYMCjtFzHPhPk RaYZ9d76GO2p0pf9Xa3E90VYlTlH6AtKDJhGPvjF8xciIPTeF9hYzWpKixIGvNmneUfeXFLx5Gv aBoHwcmqPI3BND/7y+IT9S8Hw/i9usNxvo4ZzF+1M7w6Jrt3hlS+MYklMAwSOT5Tctnpo8PJmG5 00dCROT+2Jrv3t6GrJGs0StY65hYNlQXkzGmDkqkfsdESbk2pNhDdAjbOYfAV1HCLcQA6qV0Pl+ L767DAttEI52aE/OQLpmSsR03bycIlYjzO0cNV1CWXEVhQ7fq84aWyOCtbuWZh8PbC6hf X-Received: by 2002:a05:6820:8c6:b0:6b3:5c73:2188 with SMTP id 006d021491bc7-6c53f2524d4mr1686765eaf.5.1789401928987; Mon, 14 Sep 2026 09:05:28 -0700 (PDT) X-Received: by 2002:a05:6820:8c6:b0:6b3:5c73:2188 with SMTP id 006d021491bc7-6c53f2524d4mr1686735eaf.5.1789401928468; Mon, 14 Sep 2026 09:05:28 -0700 (PDT) Received: from [192.168.1.199] (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba4e9b359sm26545099eec.14.2026.09.14.09.05.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2026 09:05:27 -0700 (PDT) Message-ID: Date: Mon, 14 Sep 2026 09:05:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/9] tests/tcg: improve check for working cross compilers To: =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= Cc: =?UTF-8?Q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Brad Smith , Jiaxun Yang , Song Gao , Warner Losh , Peter Maydell , Cornelia Huck , Fabiano Rosas , John Snow , Paolo Bonzini , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Brian Cain , qemu-arm@nongnu.org, =?UTF-8?Q?Marc-Andr=C3=A9_Lureau?= , Kyle Evans , Richard Henderson , Cleber Rosa References: <20260910181504.1010916-1-alex.bennee@linaro.org> <20260910181504.1010916-3-alex.bennee@linaro.org> <22dca41b-3833-45d2-912f-b05a77d7d883@oss.qualcomm.com> From: Pierrick Bouvier Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=CKa/zhrD c=1 sm=1 tr=0 ts=6aa81b49 cx=c_pps a=CWtnpBpaoqyeOyNyJ5EW7Q==:117 a=iLqgmErQAxjCjdq5jj1Aqg==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=b4LDLZbEAAAA:8 a=20KFwNOVAAAA:8 a=KKAkSRfTAAAA:8 a=0qKRNlLXlS8saNQJCFIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=vh23qwtRXIYOdz9xvnmn:22 a=20T61YgZp4ItGotXEy2O:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: J9znO4zQEvWUFM5f9O90qyz1sfyJEXhi X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE0MDIzMCBTYWx0ZWRfX10r9upVj8pQZ vPSvXnX5zrIEuAc5fvKHCE2FaT56f+XBmE4Op51z4q4cbAI+JRBn3X1gIaW22vF9C+uYcTvHFBc a0NMP14MJuCWHK0ICtbtTQUnZeZzGN0= X-Proofpoint-GUID: J9znO4zQEvWUFM5f9O90qyz1sfyJEXhi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE0MDIzMCBTYWx0ZWRfX1CQppk30KZM+ r5jzdjMxB74rfNMeRG7BmQMGMGQty/TqYm8a5NZVpNLp2x7Yu8wF7PjMOr5gMGEDhMw+2XzXrn4 uG8uZNz8GjHk8tEBnthJddcMywNRNB110DyPHC0Btr5x06d3VYvNHWtWLkYPMnt4lhsRFHR0U1S ygRwAKoHNyXS+juIaBPLkvKwnmf70TfdRDX3L03JHWZyV7fw3j5/oRQR7hBqZrbxJswNVc82mmC qpmsYOMtoYkDi/MsSfhc1wx8BPwZgJ9OrTTljZDMA7cqgqkHi8mj+f/EzjSHMUNn6SVqzDbUh5Q +SF7ihZoaGyvSqz3mUFpCTQ2leBxVHos7coKKoWUnGn0uEJjjpvv9RzQNfLRue5+qQNT6sy7fSV q1Xc5KhPHj5PXpvoCEc1Eo/YjyrYnsmlcaFVJJcLh30WwyH3UDsk01V/F87DiB6bdASbRHMrJSp jaX3QSbjMwYr5o227Bw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-14_03,2026-09-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609140230 Received-SPF: pass client-ip=205.220.168.131; envelope-from=pierrick.bouvier@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org On 9/14/2026 1:34 AM, Daniel P. Berrangé wrote: > On Sun, Sep 13, 2026 at 10:08:52PM -0700, Pierrick Bouvier wrote: >> On 9/10/26 11:14 AM, Alex Bennée wrote: >>> From: Daniel P. Berrangé >>> >>> When it finds a cross compiler, tests/tcg/meson.build tries >>> building test_cc.c to validate that the compiler works. This >>> includes "stdint.h" as a witness for working C library, however, >>> that is not a good choice as it can be provided by the toolchain >>> alone: >>> >>> $ rpm -ql gcc-s390x-linux-gnu | grep /stdint.h >>> /usr/lib/gcc/s390x-linux-gnu/16/include/stdint.h >>> >>> As a result, if you install the s390x GCC cross compiler, but >>> not any C library, meson decides to use the host compiler instead >>> of the container: >>> >>> cc for aarch64-softmmu : aarch64-linux-gnu-gcc (from 'debian-all-test-cross' container) >>> cc for loongarch64-softmmu : loongarch64-unknown-linux-gnu-gcc (from 'debian-loongarch-cross' container) >>> cc for riscv64-softmmu : riscv64-linux-gnu-gcc (from 'debian-all-test-cross' container) >>> cc for s390x-softmmu : s390x-linux-gnu-gcc >>> cc for x86_64-softmmu : x86_64-linux-gnu-gcc (from 'debian-amd64-cross' container) >>> >>> Eventually this results in failure to run 'make check': >>> >>> [33/40] Generating tests/tcg/s390x-softmmu-hello with a custom command >>> FAILED: [code=1] tests/tcg/s390x-softmmu-hello.test >>> /usr/bin/s390x-linux-gnu-gcc /home/berrange/src/virt/qemu/tests/tcg/multiarch/system/hello.c -o tests/tcg/s390x-softmmu-hello.test -static -MMD -MF tests/tcg/s390x-softmmu-hello.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib /home/berrange/src/virt/qemu/tests/tcg/s390x/system/../../minilib/printf.c -I /home/berrange/src/virt/qemu/include/hw/s390x/ipl -march=z13 ../tests/tcg/s390x/system/../head64.S ../tests/tcg/s390x/system/../console.c >>> In file included from ../tests/tcg/s390x/system/../console.c:8: >>> ../tests/tcg/s390x/system/../../../../pc-bios/s390-ccw/sclp.c:11:10: fatal error: string.h: No such file or directory >>> 11 | #include >>> | ^~~~~~~~~~ >>> compilation terminated. >>> >>> Adding more include files to the test program ensures the >>> meson probe makes a better decision. >>> >>> Fixes: e5d084d622b1 (tests/tcg/meson.build: check host cross cc is working) >>> Signed-off-by: Daniel P. Berrangé >>> Message-ID: <20260910100120.2076092-1-berrange@redhat.com> >>> Signed-off-by: Alex Bennée >>> --- >>> tests/tcg/test_cc.c | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/tests/tcg/test_cc.c b/tests/tcg/test_cc.c >>> index d3614a01fe6..fafee055b40 100644 >>> --- a/tests/tcg/test_cc.c >>> +++ b/tests/tcg/test_cc.c >>> @@ -1,7 +1,11 @@ >>> /* SPDX-License-Identifier: GPL-2.0-or-later */ >>> -/* Include a standard header to make sure cross compiler provides them */ >>> +/* Use some standard headers to ensure the cross compiler provides them */ >>> #include >>> +#include >>> +#include >>> +#include >>> +#include >>> int main(void) >>> { >> >> Ideally, we should do separate tests for system vs user tests. >> System ones are always compiled with -ffreestanding, while user ones should >> provide a C library. >> >> From this standard: >> >> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2338r3.html >> ``` >> A freestanding C implementation is required to provide the entirety of the >> following headers: >> >> >> >> >> >> >> >> >> >> >> Most of is required (strdup, strndup, strcoll, strxfrm, and >> strerror are excluded). This includes strtok, which requires global data. >> ``` >> >> Maybe for now we can just remove stdio.h from current patch, as it's not >> supposed to be provided in a freestanding environment. > > A huge number of files under tests/tcg/ have a #include > currently. > > In the example build failure in the commit message, we have > > tests/tcg/s390x/system/../console.c > > which does > > #include "../../../pc-bios/s390-ccw/sclp.c" > > and sclp.c has > > #include "s390-ccw.h" > > and that header has: > > #include > #include > #include > #include > > hence the 4 headers I added to the meson check. > > So AFAICT, our code is expecting stdio.h to be provided in a > -ffreestanding build. Have we got a more fundamental mistake > wrt our use of -ffreestanding, such that it is relying on > unintended functionality ? > Looking a bit further, it seems that this is the only example of system code pulling this header (through pc-bios), which might be a specificity of s390x firmware. That said, it's not the end of the world, and as we mostly use -linux-gcc variants of cross compilers, it should be safe to expect them to come with a libc. Let's keep the patch as it is. > With regards, > Daniel Thanks, Pierrick