aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2020-05-12 11:50:48 +0200
committerThomas Huth <thuth@redhat.com>2020-06-16 15:00:07 +0200
commitac9e075980a0be4cbaa70671de25462070af5adf (patch)
treead9dd43335a002c57128ef3d3148550d9fde5c7d
parent24a4a7c96a3b1c60d0785118a7ba61c442d621df (diff)
downloadkvm-unit-tests-ac9e075980a0be4cbaa70671de25462070af5adf.tar.gz
Always compile the kvm-unit-tests with -fno-common
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. Message-Id: <20200514192626.9950-6-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--Makefile2
-rw-r--r--lib/auxinfo.h3
-rw-r--r--x86/Makefile.common1
3 files changed, 3 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 754ed65..3ff2f91 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/lib/auxinfo.h b/lib/auxinfo.h
index 08b96f8..a46a1e6 100644
--- a/lib/auxinfo.h
+++ b/lib/auxinfo.h
@@ -13,7 +13,6 @@ struct auxinfo {
unsigned long flags;
};
-/* No extern! Define a common symbol. */
-struct auxinfo auxinfo;
+extern struct auxinfo auxinfo;
#endif
#endif
diff --git a/x86/Makefile.common b/x86/Makefile.common
index ab67ca0..2ea9c9f 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -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