]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Disable use of common symbols
authorMichael Brown <mcb30@ipxe.org>
Tue, 24 Jun 2025 12:32:49 +0000 (13:32 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 24 Jun 2025 13:40:57 +0000 (14:40 +0100)
We no longer have any requirement for common symbols.  Disable common
symbols via the -fno-common compiler option, and simplify the test for
support of -fdata-sections (which can return a false negative when
common symbols are enabled).

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

index 3d4e731f6f14c090552c4467f43d8d3349bb3cfb..7a965130e8f40ea480af58e58b90c8b768981992 100644 (file)
@@ -483,7 +483,7 @@ CFLAGS              += -Os
 CFLAGS         += -g
 ifeq ($(CCTYPE),gcc)
 CFLAGS         += -ffreestanding
-CFLAGS         += -fcommon
+CFLAGS         += -fno-common
 CFLAGS         += -Wall -W -Wformat-nonliteral
 CFLAGS         += -Wno-array-bounds -Wno-dangling-pointer
 HOST_CFLAGS    += -Wall -W -Wformat-nonliteral
@@ -503,17 +503,14 @@ ASFLAGS           += --fatal-warnings
 HOST_CFLAGS    += -Werror
 endif
 
-# Enable per-item sections and section garbage collection.  Note that
-# some older versions of gcc support -fdata-sections but treat it as
-# implying -fno-common, which would break our build.  Some other older
-# versions issue a spurious and uninhibitable warning if
-# -ffunction-sections is used with -g, which would also break our
-# build since we use -Werror.
+# Enable per-item sections and section garbage collection.  Some older
+# versions of gcc issue a spurious and uninhibitable warning if
+# -ffunction-sections is used with -g, which would break our build
+# since we use -Werror.
 #
 ifeq ($(CCTYPE),gcc)
-DS_TEST                = $(ECHO) 'char x;' | \
-                 $(CC) -fdata-sections -S -x c - -o - 2>/dev/null | \
-                 grep -E '\.comm' > /dev/null
+DS_TEST                = $(CC) -fdata-sections -c -x c /dev/null \
+                 -o /dev/null 2>/dev/null
 DS_FLAGS       := $(shell $(DS_TEST) && $(ECHO) '-fdata-sections')
 FS_TEST                = $(CC) -ffunction-sections -g -c -x c /dev/null \
                  -o /dev/null 2>/dev/null