[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: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 Jul 2022 08:35:19 +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=1sp8abS3+tsf7nUJ/VYSeltBUMjhNqWJSycmerGV1wc=; b=EGBVv8Q3P6lVM+apHxQemUsjjD1DHC3s4w6u59hfdX4pyeCaL40QKY1SdxUqrSJuzveii6IlQQm6QLpf+nMvKIXjbgWnbjr26cw3Ptegi2czAuuUqSNUsw4y+kQx/Q9vrS8lWxmq2wEw+lSF0x7rovHtAFRxGJNRQk+m+hqtkZX8iS5Gg1OI+3dDB3AJZebmQCNqeX1WduvYflfc2zwTJyEctbsCRp70Qzfn2bV8JDSVflgKM3XHoefLna7PRINny+5RxRX3BcDBny7N26ZKzoDcULwbq66GmzkKkW2etds78c5+lblWyrKLo+b3wZqGdYv9Yg3PlXOBo32biCgRWA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AnYv2f30HsSQvGl2YrCXOo9QGy7ObimnrLAZsJg6s+IbFATTuwf+P5BQTG2i7UJoq0sM5PhTV2hEY3xFnZ9tORByuhDBEqtTWeST+k7/1tyEI47k6O61u2OssU1i5+4RW3uFZx/Ory7vSa+Y5FLEweCyRKXHAdxaGXF1BoWpNh5liioamqIJ/WFF4XZW2/AhK9ZPHyzG+AjVy0VtWU3ows5x5NmgDaRqIar5ey2wJUj8VjsLBTLELpbKFK8pEr0w4zMwjLEmC+LXL6VhWQqkZVD2Zwv1SGO3ewLrdQMoodvUTFNejyVTLOAMVTnc3MwAVoOzoLHT2gr0lD7cl3DXrg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 05 Jul 2022 06:35:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>

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.

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"?

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®.