public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] Kconfig: add option to build with -fshort-wchar
Date: Wed,  9 Aug 2017 19:14:31 -0400	[thread overview]
Message-ID: <20170809231441.22691-2-robdclark@gmail.com> (raw)
In-Reply-To: <20170809231441.22691-1-robdclark@gmail.com>

UEFI expects strings to be UTF-16.  So add an option so that when
EFI_LOADER is enabled, we can use the expected unicode string size.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 Kconfig                | 8 ++++++++
 Makefile               | 4 ++++
 lib/efi_loader/Kconfig | 1 +
 3 files changed, 13 insertions(+)

diff --git a/Kconfig b/Kconfig
index c1451bceda..7319f1fa94 100644
--- a/Kconfig
+++ b/Kconfig
@@ -53,6 +53,14 @@ config CC_OPTIMIZE_FOR_SIZE
 
 	  This option is enabled by default for U-Boot.
 
+config CC_SHORT_WCHAR
+	bool "Use 16b wchar"
+	default n
+	help
+	  Enabling this option will pass "-fshort-wchar" to gcc, for
+	  16bit unicode strings.  This is used by EFI_LOADER, as the
+	  UEFI spec defines strings to be UTF-16.
+
 config DISTRO_DEFAULTS
 	bool "Select defaults suitable for booting general purpose Linux distributions"
 	default y if ARCH_SUNXI || TEGRA
diff --git a/Makefile b/Makefile
index 50a002e72f..91b11f5a7b 100644
--- a/Makefile
+++ b/Makefile
@@ -590,6 +590,10 @@ else
 KBUILD_CFLAGS	+= -O2
 endif
 
+ifdef CONFIG_CC_SHORT_WCHAR
+KBUILD_CFLAGS	+= -fshort-wchar
+endif
+
 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks)
 
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d2b6327119..e28ef51ad4 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -1,6 +1,7 @@
 config EFI_LOADER
 	bool "Support running EFI Applications in U-Boot"
 	depends on (ARM || X86) && OF_LIBFDT
+	select CC_SHORT_WCHAR
 	default y
 	help
 	  Select this option if you want to run EFI applications (like grub2)
-- 
2.13.0

  reply	other threads:[~2017-08-09 23:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 23:14 [U-Boot] [PATCH 0/5] vsprintf and short-wchar for EFI_LOADER Rob Clark
2017-08-09 23:14 ` Rob Clark [this message]
2017-08-10  2:28   ` [U-Boot] [PATCH 1/5] Kconfig: add option to build with -fshort-wchar Tom Rini
2017-08-09 23:14 ` [U-Boot] [PATCH 2/5] lib: add some utf16 handling helpers Rob Clark
2017-08-13 21:36   ` Simon Glass
2017-08-09 23:14 ` [U-Boot] [PATCH 3/5] vsprintf.c: add UTF-16 string (%ls) support Rob Clark
2017-08-13 21:36   ` Simon Glass
2017-08-09 23:14 ` [U-Boot] [PATCH 4/5] vsprintf.c: add GUID printing Rob Clark
2017-08-15 20:12   ` Heinrich Schuchardt
2017-08-09 23:14 ` [U-Boot] [PATCH 5/5] examples: add fallback memcpy Rob Clark
2017-09-06 15:31 ` [U-Boot] [PATCH 0/5] vsprintf and short-wchar for EFI_LOADER Heinrich Schuchardt
2017-09-06 16:45   ` Tom Rini
2017-09-06 18:14     ` Rob Clark
2017-09-06 18:16       ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170809231441.22691-2-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox