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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 1 Jul 2022 18:13:58 +0800
  • 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] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); 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=6/EstXQWI7fTYjG6nR8Rf+nSkrpHj94TPD1Hr+B0j0g=; b=fZdIUL10JQKShnuoIJa8FgBUIts2QTTazLzo7ciTDjpk1CzXRxlOncIhnEkFdnl4BIjJj4TCL0zVSZD5O48X7VChMtsOhoiVv7XSg/6NG5jJiWRCQqroqxB5q5p80hGV1P9jVcIw6kVns0tbSrrpeFvtKgqay7cqZoW41hz0qvASS2lexCou4hTyHsyYIc6atXkK/+UgpMUvvn8U9vVdgTA5LUzD6jkA6QIkrY5YAAzTyjW5HRF6NAtKLe8bQdXpSeP6ORUgipT2LbmXLWRl9HApMFsx8NNvFWdxi5VVoYNHeHFeG3XmqMk2scgpoO2NQ8bIyDB3SzKSNjEwvCbQXw==
  • 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=6/EstXQWI7fTYjG6nR8Rf+nSkrpHj94TPD1Hr+B0j0g=; b=PYj/JuUiTId8p01LEAGBjtzcQvrtrXRH4gXfuQBccT9KtPilJBvPGLbTDs2W4vuFzuUtE0yeg9mli7d1WfpBtmw/Zl8alFCrLq4+LQ1jIbsnNO1h+JdZGuCP0PYzEhtb6f8LVbuQfmg9xlBRyT+3khUUvPvDiYo/hZshyWsxJWmHUsSxHTvFnS33QY3lITxvqr3jGpommu56I8lMxyZK2LgoAdRoPuZb4Z0N5z5vbF8Iytn6CjWFV0EqBlaM5ZZHwa+ARLDknskQ6GC+AXPOIoUve2KpfrokqaNV8OQfkM2A4LbVqq7qpzy70fWBk9Qh/xT1a1HhQFK7IoDNpwgcRA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=fvaZplDSBpAe/+7E+4LM6pvhRNspqv1PpzU62zWKpxNdX2lldWFdjz+ZHn+Y148lGcaS/StZy0y2ZHAFK1w3jtYu7HHNd3LFlsHRtLnxHquRIratPOvW6SjD4k91Rlyo907+ij+GDEkmMOTwnsc9Y0Hqix6VqsKw0gTLztSre32W+CPAhWsti7smk90aRr/1ZZvzNM3kJs481M6kzkICx0UXPUgj9c7W8n9eFDK491oo+dYkCfUe0LWyRBu6Bsyf1zWi6NDRNXO/BrE7duRSDkvv71hGZrI7hZ1vwax0uWG2JATZi/bEkP9b6VGzCaejaxy2PNssGvTAqQ6DG9vAPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EiJ+i7DzfttsBCmA55OA5+bti8T43l2iAdByXTPjzESdaew+xjSb8RbHTR6teiNOWHYKqGlKg7ZgOLCOKvDtUSdHC1P41gIU61iPFEvjB68t0SWHqVQRUoZtwFNtJQTNCzppXZcFHzy454koZGWE+eTxr4CV8gozeURfZOfPziE6Mm9nbVhFGdiyZwQL4qo7BI7RA26Wwz162XNEGVjnwetIhyBN79dv5IDPvGHHxuF2JXuiKBIj2MgIN+2GxQhdtddUvFqBYxtkWFBdY9Eiv1ULmGA6jMIyiXP5BZKmAdVAVr/xr8TJhVrQieVgulhP6OTOauRtTcGReI/0SJwXDQ==
  • Cc: <jbeulich@xxxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 01 Jul 2022 10:15:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

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. So in
this patch, we add "-fno-short-wchar" to override "-fshort-wchar"
for Arm32 to remove above warning.

Reported-and-Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
 xen/arch/arm/efi/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile
index dffe72e589..b06fb96c1f 100644
--- a/xen/arch/arm/efi/Makefile
+++ b/xen/arch/arm/efi/Makefile
@@ -1,5 +1,9 @@
 include $(srctree)/common/efi/efi-common.mk
 
+ifeq ($(CONFIG_ARM_32),y)
+CFLAGS-y += -fno-short-wchar
+endif
+
 ifeq ($(CONFIG_ARM_EFI),y)
 obj-y += $(EFIOBJ-y)
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
-- 
2.25.1




 


Rackspace

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