]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Always compile with -ffreestanding and -fshort-wchar
authorJan Janssen <medhefgo@web.de>
Tue, 26 Oct 2021 08:56:17 +0000 (10:56 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 4 Nov 2021 17:37:07 +0000 (18:37 +0100)
This is not a hosted environment and we should not pretend otherwise
if -ffreestanding is not supported.

With EFI strings being in UCS2, it is not supported to build without
-fshort-wchar as gcc/clang default to a w_char_t size of 4 bytes.

This also makes the charset for wide chars explicit on gcc. This way
we get a nice error message if anyone ever tries to add ðŸ’© to strings.

src/boot/efi/meson.build

index e6bb7d7c6af77d1672f8b197b57daab3f70d0df4..5108cfa59ebc7f9ff4fca1cc8d2cc1f82e790da6 100644 (file)
@@ -197,11 +197,10 @@ if have_gnu_efi
         compile_args = cc.get_supported_arguments(
                 basic_disabled_warnings +
                 possible_common_cc_flags + [
-                        '-ffreestanding',
                         '-fno-stack-protector',
                         '-fno-strict-aliasing',
                         '-fpic',
-                        '-fshort-wchar',
+                        '-fwide-exec-charset=UCS2',
                         '-Wall',
                         '-Wextra',
                         '-Wsign-compare',
@@ -209,6 +208,8 @@ if have_gnu_efi
         ) + [
                 '-nostdlib',
                 '-std=gnu99',
+                '-ffreestanding',
+                '-fshort-wchar',
                 '-isystem', efi_incdir,
                 '-isystem', efi_incdir / gnu_efi_path_arch,
                 '-I', fundamental_path,