@@ -49,7 +49,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
-COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing
+COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
COMMON_CFLAGS += -Wignored-qualifiers -Werror
@@ -13,7 +13,6 @@ struct auxinfo {
unsigned long flags;
};
-/* No extern! Define a common symbol. */
-struct auxinfo auxinfo;
+extern struct auxinfo auxinfo;
#endif
#endif
@@ -5,6 +5,7 @@ all: directories test_cases
cflatobjs += lib/pci.o
cflatobjs += lib/pci-edu.o
cflatobjs += lib/alloc.o
+cflatobjs += lib/auxinfo.o
cflatobjs += lib/vmalloc.o
cflatobjs += lib/alloc_page.o
cflatobjs += lib/alloc_phys.o
The new GCC v10 uses -fno-common by default. To avoid that we commit code that declares global variables twice and thus fails to link with the latest version, we should also compile with -fno-common when using older versions of the compiler. However, this now also means that we can not play the trick with the common auxinfo struct anymore. Thus declare it as extern in the header now and link auxinfo.c on x86, too. Signed-off-by: Thomas Huth <thuth@redhat.com> --- Makefile | 2 +- lib/auxinfo.h | 3 +-- x86/Makefile.common | 1 + 3 files changed, 3 insertions(+), 3 deletions(-)