From: Jan Janssen Date: Tue, 26 Oct 2021 08:56:17 +0000 (+0200) Subject: sd-boot: Always compile with -ffreestanding and -fshort-wchar X-Git-Tag: v250-rc1~355^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1224d57ba533c8cda8a5b610588b7032b07492e1;p=thirdparty%2Fsystemd.git sd-boot: Always compile with -ffreestanding and -fshort-wchar 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. --- diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index e6bb7d7c6af..5108cfa59eb 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -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,