[U-Boot] [PATCH v0 03/20] short-wchar

Rob Clark robdclark at gmail.com
Fri Aug 4 19:31:45 UTC 2017


For now, pending conclusion on proposal about using c11 and u"string"
instead of L"string" plus -fshort-wchar.

Background: UEFI uses utf16 strings universally.  An UEFI implementation
that does not use -fshort-wchar has to do a lot of cumbersome charset
conversion back/forth.  Mixing object files that use -fshort-wchar and
others that do not is a bad idea (and gcc will warn about it).  There
are 3 reasonable solutions that I can think of:

 1) Use -fshort-wchar across the board.  We don't dynamically link
    against other shared libraries at runtime, so there isn't much
    downside to this approach.  Heinrich brought up ext4, which uses
    utf32, but I guess this mostly matters for fs_ls(), and it does
    not seem so bad for it to do utf32->utf8 conversion.

 2) Use -fshort-wchar only if CONFIG_EFI_LOADER=y.. UEFI only requires
    fat/vfat so we don't need ext4 and efi loader at the same time.

 3) Go with Heinrich's suggestion of requiring c11.  Possibly this
    requirement could be loosened to only require c11 for efi loader.
    This seems like the best approach, and at least no one has so
    far brought up any objection to his proposal.

Not-signed-off-by: Rob Clark <robdclark at gmail.com>
---
 config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mk b/config.mk
index b77d58903c..5ad9e7198d 100644
--- a/config.mk
+++ b/config.mk
@@ -74,7 +74,7 @@ endif
 RELFLAGS := $(PLATFORM_RELFLAGS)
 
 PLATFORM_CPPFLAGS += $(RELFLAGS)
-PLATFORM_CPPFLAGS += -pipe
+PLATFORM_CPPFLAGS += -pipe -fshort-wchar
 
 LDFLAGS += $(PLATFORM_LDFLAGS)
 LDFLAGS_FINAL += -Bstatic
-- 
2.13.0



More information about the U-Boot mailing list