diff --git a/src/boot/meson.build b/src/boot/meson.build index f88371b6b1..52f6350620 100644 --- a/src/boot/meson.build +++ b/src/boot/meson.build @@ -178,7 +178,6 @@ if get_option('mode') == 'developer' and get_option('debug') endif efi_c_ld_args = [ - '-lgcc', '-nostdlib', '-static-pie', '-Wl,--entry=efi_main', @@ -202,6 +201,11 @@ efi_c_ld_args = [ '-z', 'separate-code', ] +# Check if the compiler is GCC and then we link to lgcc in that case only +if cc.get_id() == 'gcc' + efi_c_ld_args += ['-lgcc'] +endif + efi_c_ld_args += cc.get_supported_link_arguments( # binutils >= 2.38 '-Wl,-z,nopack-relative-relocs',