[ipxe-devel] [PATCH] [build] Be explicit about -fcommon compiler directive

Bruce Rogers brogers at suse.com
Wed May 6 21:03:02 UTC 2020


gcc10 switched default behavior from -fcommon to -fno-common. Since
"__shared" relies on the legacy behavior, explicitly specify it.

Signed-off-by: Bruce Rogers <brogers at suse.com>
---
 src/Makefile.housekeeping | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 1dd14794..8fb2b958 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -170,6 +170,16 @@ CFI_FLAGS := $(shell $(CFI_TEST) && \
 WORKAROUND_CFLAGS += $(CFI_FLAGS)
 endif
 
+# gcc 10 switched default behavior from -fcommon to -fno-common. Since
+# "__shared" relies on the legacy behavior, explicitly specify it.
+#
+ifeq ($(CCTYPE),gcc)
+FCOMMON_TEST = $(CC) -fcommon -x c -c /dev/null \
+		   -o /dev/null >/dev/null 2>&1
+FCOMMON_FLAGS := $(shell $(FCOMMON_TEST) && $(ECHO) '-fcommon')
+WORKAROUND_CFLAGS += $(FCOMMON_FLAGS)
+endif
+
 # gcc 4.6 generates spurious warnings if -Waddress is in force.
 # Inhibit this.
 #
-- 
2.26.2




More information about the ipxe-devel mailing list