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.
This commit is contained in:
Jan Janssen
2021-11-04 18:37:07 +01:00
parent 3c86dcc39c
commit 1224d57ba5
+3 -2
View 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,