]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: only link libgcc when compiler is gcc
authorDavid C. Manuelda <StormByte@gmail.com>
Fri, 4 Apr 2025 19:24:13 +0000 (21:24 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Apr 2025 22:02:37 +0000 (07:02 +0900)
When compiling in systems which do not have gcc installed
(like a musl+llvm system) the forced linkage "-lgcc" is
stopping it to compile. As when compiler is clang it do not
need to link explicitelly to gcc I've modified meson to only
link to gcc library when compiler is gcc.

Closes: #35162
src/boot/meson.build

index f88371b6b138b00b40d63fd0cf6d440e027a39a4..52f6350620c2fe2607c17442d9d73ee134f34176 100644 (file)
@@ -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',