From nobody Sat Nov 30 06:48:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1614128954; cv=none; d=zohomail.com; s=zohoarc; b=bRAi/zHoOq/9GOJ+FAGy7ILGu6wg+wvMC2uWIYrVGBDzPMHc4xpYZhoXRuIm5wPfJJ+CdtTz9D3+dXlnbLcrfdjmgIBHT3uxX/4IuD4oc37EQW0kc5lJWaEysrlrfxLIEvy7dowz6PxeeVdmmCHt00i+BnrOzAfk5wSzjxCYjVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614128954; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=cL4o9P0YrkqQd9jNXwsqr69scfPbgAeXzSKZZckDLAs=; b=kT/lM7bzePVW/+5wXv+a4nVOGzfIFbXU2yyzi8wv8km61OJTocUwUZWo/8dTKK/CLvdgKjJI2y2wKmIqkkYaOOGDSYOseBZgvTpekLaAnhif4Dj6P2twtOPw7rSw0Zo3eD9T+xaMNXnkKHC36dBzoOWsfN5NDK1tCarHae7VfKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614128954088731.0230406000832; Tue, 23 Feb 2021 17:09:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.89145.167695 (Exim 4.92) (envelope-from ) id 1lEifY-0002y3-Qf; Wed, 24 Feb 2021 01:08:48 +0000 Received: by outflank-mailman (output) from mailman id 89145.167695; Wed, 24 Feb 2021 01:08:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lEifY-0002xw-Ne; Wed, 24 Feb 2021 01:08:48 +0000 Received: by outflank-mailman (input) for mailman id 89145; Wed, 24 Feb 2021 01:08:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lEifX-0002xp-8J for xen-devel@lists.xenproject.org; Wed, 24 Feb 2021 01:08:47 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2969239b-9fce-4132-9e6e-acc7c1d74322; Wed, 24 Feb 2021 01:08:45 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A2C4764DAF; Wed, 24 Feb 2021 01:08:43 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2969239b-9fce-4132-9e6e-acc7c1d74322 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614128924; bh=oMS5JWEo0m1QcNnQlEKnVo4dkcJkk7R8UoNZxYntNYM=; h=Date:From:To:cc:Subject:From; b=BFUNfOcEpJdu7L69tia48pzW0abb4l1F2yloITyoDPSthDQIR54fewQKbmoA3LTEz cOSTtLGWj4hSGsgvKt8YR3j5mOEvbaf5EvLHjXWBw0DwjLNk77eK/z3pONIB6Yladd 9iHC/lVqfLxCFVxuWak0MTClsNp0q5gIct5KJ8zV1S4uVLULyUai0cFZKpXCksD+Vm vTOznUVjIQAdvS89u1hSAPEHdz0zd/u4hpODV6SJIQieAFJuWkmzf2e8n1BKzgsLOz 7+9rglPgJLdT+U60rGaYB4YQ6avZrnzggLB5bBAfTW7SJG3YOcExzB+XvyGuP71r7/ e9AQI7Y5yRX0g== Date: Tue, 23 Feb 2021 17:08:43 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: xen-devel@lists.xenproject.org cc: sstabellini@kernel.org, jbeulich@suse.com, andrew.cooper3@citrix.com, wl@xen.org, iwj@xenproject.org, anthony.perard@citrix.com Subject: [PATCH for-next] configure: probe for gcc -m32 integer sizes Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hvmloader build on Alpine Linux x86_64 currenly fails: hvmloader.c: In function 'init_vm86_tss': hvmloader.c:202:39: error: left shift count >=3D width of type [-Werror=3Ds= hift-count-overflow] 202 | ((uint64_t)TSS_SIZE << 32) | virt_to_phys(tss)); util.c: In function 'get_cpu_mhz': util.c:824:15: error: conversion from 'long long unsigned int' to 'uint64_t= ' {aka 'long unsigned int'} changes value from '4294967296000000' to '0' [-Werror=3Doverflow] 824 | cpu_khz =3D 1000000ull << 32; The root cause of the issue is that gcc -m32 picks up headers meant for 64-bit builds. The failures are currently causing problems to the xen-project gitlab-ci pipeline. This patch introduces code to detect this kind of errors in the configure script, and disables with a warning the compilation of hvmloader if problems are detected. This patch also updates tools/configure. It has been done by calling autoreconf -fi. Signed-off-by: Stefano Stabellini diff --git a/config/Tools.mk.in b/config/Tools.mk.in index d47936686b..395ed2a6d2 100644 --- a/config/Tools.mk.in +++ b/config/Tools.mk.in @@ -51,6 +51,7 @@ CONFIG_OVMF :=3D @ovmf@ CONFIG_ROMBIOS :=3D @rombios@ CONFIG_SEABIOS :=3D @seabios@ CONFIG_IPXE :=3D @ipxe@ +CONFIG_HVMLOADER :=3D @hvmloader@ CONFIG_QEMU_TRAD :=3D @qemu_traditional@ CONFIG_QEMU_XEN :=3D @qemu_xen@ CONFIG_QEMUU_EXTRA_ARGS:=3D @EXTRA_QEMUU_CONFIGURE_ARGS@ diff --git a/tools/configure b/tools/configure index bb5acf9d43..f23a3bb8aa 100755 --- a/tools/configure +++ b/tools/configure @@ -687,6 +687,7 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM SET_MAKE +hvmloader AWK IASL XGETTEXT @@ -5279,6 +5280,25 @@ ac_compile=3D'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_= ext >&5' ac_link=3D'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$= ac_ext $LIBS >&5' ac_compiler_gnu=3D$ac_cv_c_compiler_gnu =20 +ac_ext=3Dc +ac_cpp=3D'$CPP $CPPFLAGS' +ac_compile=3D'$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link=3D'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$= ac_ext $LIBS >&5' +ac_compiler_gnu=3D$ac_cv_c_compiler_gnu + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)])) +int main() { BUILD_BUG_ON(sizeof(uint64_t) !=3D 8); } +_ACEOF +if gcc -m32 -c conftest.c -o /dev/null 2>/dev/null; then : + hvmloader=3Dy +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hvmloader build disabl= ed as the compiler cannot build 32bit binaries" >&5 +$as_echo "$as_me: WARNING: hvmloader build disabled as the compiler cannot= build 32bit binaries" >&2;} +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} set= s \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} diff --git a/tools/configure.ac b/tools/configure.ac index 636e7077be..706c162322 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -307,6 +307,12 @@ AC_ARG_VAR([AWK], [Path to awk tool]) =20 # Checks for programs. AC_PROG_CC +AC_LANG(C) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include +#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)])) +int main() { BUILD_BUG_ON(sizeof(uint64_t) !=3D 8); }]])]) +AS_IF([gcc -m32 -c conftest.c -o /dev/null 2>/dev/null], [hvmloader=3Dy], = [AC_MSG_WARN(hvmloader build disabled due to headers mismatch)]) +AC_SUBST(hvmloader) AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PATH_PROG([FLEX], [flex]) diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile index 1f27117794..5c395ad738 100644 --- a/tools/firmware/Makefile +++ b/tools/firmware/Makefile @@ -13,7 +13,7 @@ SUBDIRS-$(CONFIG_ROMBIOS) +=3D rombios SUBDIRS-$(CONFIG_ROMBIOS) +=3D vgabios SUBDIRS-$(CONFIG_IPXE) +=3D etherboot SUBDIRS-$(CONFIG_PV_SHIM) +=3D xen-dir -SUBDIRS-y +=3D hvmloader +SUBDIRS-$(CONFIG_HVMLOADER) +=3D hvmloader =20 SEABIOSCC ?=3D $(CC) SEABIOSLD ?=3D $(LD)