[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] libacpi: Fix cross building x86 on arm


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 23 Aug 2022 14:33:15 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1ZC21d2UKwl60HwtjYbvxIJEqLnRq62qF2C6F92afBw=; b=ScLfTvcNb0tz4jPRdUTRepWfQCjJgogLUHx3MmMM0JrBM2tzxJO/5YBhFNaiFAv2Xa0h/8/q75eTClI+E1yTVQNIIOi2D29MGTzbfu0rycP+PfRnk/1GCYjXhcrvjcWEZ4U8s3Dhz5FRNlSpDDtKzF2LoScMGVNKLRYYnvkHniCzEfvIz3UQov40B28gLhcd8nbr1NuuHolPZcngW9Hw59lZfEo9clw2KaolLqZ+EMnU9c9CEEVXNXHjubTwBwElkIz3FuIiLffJVNat4CfWYix3SOYEDkeAlVjsWLy4qSrgovRUvRWa4xv1dW4DqozrJEShpuogwQDl8pG6ZKELeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kL2lGsHljRNqlNGu6+9qbZJAIOY4Msc0qsZa5x1rfs1OcHBIEyV/VGPapVg99G+Ejo5kuyW8Q/MMZzaThT+0jmN9ZBj7PdhQPvT17wjZqAPnok+Qg9+5fGL5eUCunKCPw/AtpK5dPJuPMkJ4DmdppRBdxfRZukl4214B7+P/5YzRSA5hyyufNNXlFy4nZ+mK00rBjoK3Ykt0CrFQZxDmsHf2JuoseHuVYKbd8gVDJvme30TdSbbCK5r7OIOdbB/OhGmtiqyRdWJtvhDk6hzOLrikJYTERYYieVEUk4aPRiEcgC39ps5/9+VU6gmb0ADCdqiiIFJOgajIKI023nl5gQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, julien@xxxxxxx, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 23 Aug 2022 12:33:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.08.2022 12:24, Bertrand Marquis wrote:
> --- a/tools/libacpi/mk_dsdt.c
> +++ b/tools/libacpi/mk_dsdt.c
> @@ -18,6 +18,16 @@
>  #include <stdlib.h>
>  #include <stdbool.h>
>  #if defined(CONFIG_X86)
> +/*
> + * When building on non x86 host, arch-x86/xen.h will include xen.h which 
> will
> + * try to include the arch xen.h (for example if built on arm, x86/xen.h will
> + * include xen.h which will include arch-arm.h).
> + * To prevent this effect, define x86 to have the proper sub arch included 
> when
> + * the compiler does not define it.
> + */
> +#if !(defined(__i386__) || defined(__x86_64__))
> +#define __x86_64__
> +#endif

Besides being confusing this depends on the order of checks in xen.h.

>  #include <xen/arch-x86/xen.h>
>  #include <xen/hvm/hvm_info_table.h>
>  #elif defined(CONFIG_ARM_64)

At the very least you will want to #undef the auxiliary define as soon
as practically possible.

But I think a different solution will want finding. Did you check what
the #include is needed for, really? I've glanced through the file
without being able to spot anything ... After all this is a build tool,
which generally can't correctly use many of the things declared in the
header.

> diff --git a/xen/include/public/arch-x86/xen.h 
> b/xen/include/public/arch-x86/xen.h
> index 58a1e87ee971..ea33a56eb6a0 100644
> --- a/xen/include/public/arch-x86/xen.h
> +++ b/xen/include/public/arch-x86/xen.h
> @@ -24,6 +24,7 @@
>   * Copyright (c) 2004-2006, K A Fraser
>   */
>  
> +/* TODO: when cross building, this will include the wrong arch header */
>  #include "../xen.h"

I'm firmly against adding such a comment in a public header, the more
that it's misleading: Cross-building of Xen, for example, works quite
fine. The issue is limited to HOSTCC != CC (or yet more precisely the
target architecture of each), afaict.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.