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

RE: [PATCH v2] Xen: fix EFI stub wchar_t size warning of arm32 building


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 5 Jul 2022 07:18:35 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=gDJjFgXjCNgRov+ifqVo6lfv2W5RzAhom/91pHD68s0=; b=JQ1HrUOr6pTIHbH+m9+s/grKWRlF2IQRV6XN57oVLzENsvSUISVlGvUlO1fg9RMetv5iHMT037WRKoKLUcipWqzppZOH+gV5GE8Y2xx5hJTd17EgLPtPEA6K6usNUpYyQRcMEgo0yFjOPYmwSpt/l/FJUR0zpf3AgxOEZM6oeGkxPkYtQ0D5jLoLK6/mMbAy5JZDPwwjAnmgkbCF+YyrzNn01koBZ9S/AVveZglllCvbJysQQSUfmVzSrbS5bMDYmGL9tYg6H7EzG3ZREpamagptdU29glFZYNdsvgPdPR91xHiRMdBU3BKfwSzA0M6E29jTaFKLVIWH8Ulhjn2woQ==
  • 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=gDJjFgXjCNgRov+ifqVo6lfv2W5RzAhom/91pHD68s0=; b=kVbkc89uPqL8KebGwEWRVq5K9RC1uKJNS6l4mF7JZYTaF7Zh20oJ90SfkLROsOqarjDIzHOMptS+QrPjm5HFV0DtTMjSwyHNIBEjhjaz28QWTWIICbnwZGGjWeQxAJkvhznkgYmGKJb3PZlOa6dF/nQRpxuErkuKuJr8KOvH20YMTcavvDGu10KIhf/lA9z3xvkpLc8U8EF+VEZNrQ8yy+8TG5it84cGEIpFEl02mUhp30XhetAem5mTgqnlcGWLnd6waIrbJMtQjfgAgbFD1qRMYGKlszv68JPB9WNJ4ARedBQfdHSxhwD4vjXW0BbKrqrsgJbqFgsS5RkWAqMVBQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=kTnMV5b2JsZOEm9eZmoHRlV5Vgeq9z+JHYBtZt1thAfjfpoMa4fEhaDYPMCSPx0c1uEXWPnlJwJVcGTWrcY53PETmcGZakcdrE3sCJhD+zEPWy4TAh3fBx3YFMo5X6nKnHFipqnYxuTGULqJ7BvTisP0mw3YUk5NDe/zLVLtmfFqPjgUCgbdiK3uOne+66asC+cYEtRcs1XGXOxwrAdbg8E7HA9gXXXA3Svnjz0a2RmRL4dfwOvw/tco9ckmsM8nuZxxbhleWAuzWXBitJhUro+2aoiPd6wKYnd7xKb6DrHHLNpZ4/Y5ERcaYj62pbt72Zs60j90pidkivz9cMWC+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVq1xS05cybnPTq3KJpTsoVN5GdCO1/cJd3tL5se2ho9uf8wSnVoMM4R0NwMkvw0zVWoiI9ZudWr4J5HqXfSG9RmjoAp7NTZ6qdA0g7JuW7OEpCJ1ztsRzGb4NC7U7VjRyjc+dvLX4PC3HYU03cZpxYW8Szr4rc4Ji8FHbh/U/oATgWM4FuqnKGwyC7rZNjeIyugdVWyW7GqBaK4/r1jRlwcdxZBpGBfexlt4ARK/mLrO03rPFBa48NV/3re6tP48J3zs7h8aTDC2VmaHkWATvCCntHC4xPEqVQipIa+cilNMQMNuUWLYh64Uf3mqul2P/oA/ZHxKXH3HCXMpl0Rzg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 05 Jul 2022 07:19:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYkCMHHHxAMHaD1EyapMXpjUKTca1vUoSAgAAJcVA=
  • Thread-topic: [PATCH v2] Xen: fix EFI stub wchar_t size warning of arm32 building

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年7月5日 14:35
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>; Julien Grall
> <julien@xxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Volodymyr
> Babchuk <Volodymyr_Babchuk@xxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2] Xen: fix EFI stub wchar_t size warning of arm32
> building
> 
> On 05.07.2022 05:54, Wei Chen wrote:
> > Xen uses "-fshort-wchar" in CFLAGS for EFI common code. Arm32
> > is using stub.c of EFI common code for EFI stub functions. But
> > "-fshort-wchar" CFLAG will cause a warning when build stub.c
> > for Arm32:
> > "arm-linux-gnueabihf-ld: warning: arch/arm/efi/built_in.o uses
> > 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of
> > wchar_t values across objects may fail"
> >
> > This is because the "-fshort-wchar" flag causes GCC to generate
> > code that is not binary compatible with code generated without
> > that flag. Why this warning hasn't been triggered in Arm64 is
> > because Arm64 does not use wchar type directly in any code for
> > parameters, variables and return values. And in EFI code, wchar
> > has been replaced by CHAR16 (the UEFI "abstraction" of wchar_t).
> > CHAR16 has been specified as unsigned short type in typedef, the
> > "-fshort-wchar" flag will not affect CHAR16. So Arm64 object
> > files are exactly the same with "-fshort-wchar" and without
> > "-fshort-wchar".
> >
> > We are also not using wchar in Arm32 codes, but Arm32 will embed
> > ABI information in ".ARM.attributes" section. This section stores
> > some object file attributes, like ABI version, CPU arch and etc.
> > And wchar size is described in this section by "Tag_ABI_PCS_wchar_t"
> > too. Tag_ABI_PCS_wchar_t is 2 for object files with "-fshort-wchar",
> > but for object files without "-fshort-wchar" is 4. Arm32 GCC
> > ld will check this tag, and throw above warning when it finds
> > the object files have different Tag_ABI_PCS_wchar_t values.
> >
> > As gnu-efi-3.0 use the GCC option "-fshort-wchar" to force wchar
> > to use short integers (2 bytes) instead of integers (4 bytes).
> > So keep "-fshort-wchar" for Xen EFI code is reasonable. In this
> > patch, we add "-fno-short-wchar" to override "-fshort-wchar" for Arm
> > architecutres without EFI enabled to remove above warning.
> >
> > Reported-and-Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> 
> Tested-by: Jan Beulich <jbeulich@xxxxxxxx>
> 

Thanks for testing!

> As to the description: Why the reference to gnu-efi? I don't think
> it matters how they build their code? All that's important is what
> we do, I suppose.
> 

How about:
"Xen need to keep "-fshort-wchar" in EFI code to force wchar to use
short integers (2 bytes) instead of integers (4 bytes), but this is
unnecessary for code out of EFI. So in this patch, we add
"-fno-short-wchar" to override "-fshort-wchar" for Arm architectures
without EFI enabled to remove above warning."


> As to the title: I think the prefix would better be Arm32: (or
> alike). Hence how about "Arm32: avoid EFI stub wchar_t size linker
> warning"?
> 

I would send a new version to adjust the title and above description.

Thanks,
Wei Chen


> Preferably with respective adjustments also:
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Jan

 


Rackspace

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