]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[linux] Disable implicit linking against libatomic libatomic
authorMichael Brown <mcb30@ipxe.org>
Mon, 1 Jun 2026 13:12:39 +0000 (14:12 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 1 Jun 2026 13:18:43 +0000 (14:18 +0100)
GCC 16 attempts to link against -latomic_asneeded by default, and
expects that this library will be provided by the installed build
toolchain alongside libgcc.

The Fedora cross-gcc packages do not include libatomic, which causes
the build to fail.

We do not require any functions provided by libatomic.  Work around
the missing packaged files in Fedora by disabling gcc's implicit
linking via the -fno-link-libatomic build option.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.linux

index 1e3eb5b4dc4b3d977ac57bd2703c8bb9343d0354..5df7394b24a9bf55cf5cce923bb34996e1d9a8ee 100644 (file)
@@ -42,6 +42,13 @@ ifneq ($(NO_WERROR),1)
 LINUX_CFLAGS   += -Werror
 endif
 
+# Check for implicit libatomic
+#
+LIBATOMIC_TEST = $(CC) $(LINUX_CFLAGS) -x c /dev/null -nostartfiles \
+                     -fno-link-libatomic -o /dev/null >/dev/null 2>&1
+LIBATOMIC_FLAGS        := $(shell $(LIBATOMIC_TEST) && $(ECHO) '-fno-link-libatomic')
+LINUX_CFLAGS   += $(LIBATOMIC_FLAGS)
+
 # Check for libslirp
 #
 LIBSLIRP_TEST = $(CC) $(LINUX_CFLAGS) -x c /dev/null -nostartfiles \