Skip to contentSkip to conversation

xvisor: fix build with gcc-10

PATCH In review Martin Jansa 3 participants 3 messages Nov 6, 2020 – Nov 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xvisor: fix build with gcc-10

* with gcc-10 (which doesn't include -fcommon by default) it fails like this:
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/mmc.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio_bus.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio_io.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/core.o: previous definition here

---
 ...-Allow-Xvisor-to-compile-with-gcc-10.patch | 55 +++++++++++++++++++
 recipes-extended/xvisor/xvisor_git.bb         |  5 +-
 2 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch
recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch new file +55 -0
new file mode 100644
index 0000000..221a314
@@ -0,0 +1,55 @@
+From 417184cc41cfd33ae7b4c11c8396e0f47f43e2ba Mon Sep 17 00:00:00 2001
+From: Jean-Christophe Dubois <[email protected]>
+Date: Fri, 8 May 2020 15:17:36 +0200
+Subject: [PATCH] EMULATORS: Allow Xvisor to compile with gcc 10.
+
+With gcc 10 because some header files do not declare some variable
+definition as extern, the variable get duplicated in all files
+using it.
+
+This patch allow xvisor to compile with the latest gcc.
+
+Signed-off-by: Jean-Christophe Dubois <[email protected]>
+Reviewed-by: Anup Patel <[email protected]>
+---
+ drivers/mmc/core/core.h    |  2 +-
+ emulators/display/drawfn.h | 10 +++++-----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index d75d135a..e2ca3141 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -64,7 +64,7 @@ int mmc_go_idle(struct mmc_host *host);
+  * Note: Must be called with host->lock held.
+  */
+ extern struct vmm_bus sdio_bus_type;
+-struct vmm_device_type sdio_func_type;
++extern struct vmm_device_type sdio_func_type;
+ 
+ int __sdio_attach(struct mmc_host *host);
+ 
+diff --git a/emulators/display/drawfn.h b/emulators/display/drawfn.h
+index f9163cff..385deaf6 100644
+--- a/emulators/display/drawfn.h
++++ b/emulators/display/drawfn.h
+@@ -69,14 +69,14 @@ typedef void (*drawfn)(struct vmm_surface *,
+ 				 DRAWFN_ORDER_MAX * \
+ 				 DRAWFN_FORMAT_MAX)
+ 
+-drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
+ 
+-drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
+ 
+-drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
+ 
+-drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
+ 
+-drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
+ 
+ #endif
recipes-extended/xvisor/xvisor_git.bb +3 -2
index 64b0f22..50323d7 100644
@@ -11,8 +11,9 @@ inherit autotools-brokensep
 # This version support the RISC-V v0.5.0 Hypervisor extensions
 SRCREV = "b3dac5b1f61f23f21dc59b3880897cff78f3b618"
 SRC_URI = "git://github.com/avpatel/xvisor-next.git \
-           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
-          "
+    file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
+    file://0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch \
+"
 
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Martin Jansa

* with gcc-10 (which doesn't include -fcommon by default) it fails like this:
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/mmc.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio_bus.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio_io.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: error: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/sdio.o: multiple definition of 'sdio_func_type'
aarch64-oe-linux-ld: TOPDIR/BUILD/work/raspberrypi3_64-oe-linux/xvisor/git-r0/git/build/drivers/mmc/core/core.o: previous definition here

Alistair

Quoted 89 lines
---
 ...-Allow-Xvisor-to-compile-with-gcc-10.patch | 55 +++++++++++++++++++
 recipes-extended/xvisor/xvisor_git.bb         |  5 +-
 2 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch
recipes-extended/xvisor/files/0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch new file +55 -0
new file mode 100644
index 0000000..221a314
@@ -0,0 +1,55 @@
+From 417184cc41cfd33ae7b4c11c8396e0f47f43e2ba Mon Sep 17 00:00:00 2001
+From: Jean-Christophe Dubois <[email protected]>
+Date: Fri, 8 May 2020 15:17:36 +0200
+Subject: [PATCH] EMULATORS: Allow Xvisor to compile with gcc 10.
+
+With gcc 10 because some header files do not declare some variable
+definition as extern, the variable get duplicated in all files
+using it.
+
+This patch allow xvisor to compile with the latest gcc.
+
+Signed-off-by: Jean-Christophe Dubois <[email protected]>
+Reviewed-by: Anup Patel <[email protected]>
+---
+ drivers/mmc/core/core.h    |  2 +-
+ emulators/display/drawfn.h | 10 +++++-----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
+index d75d135a..e2ca3141 100644
+--- a/drivers/mmc/core/core.h
++++ b/drivers/mmc/core/core.h
+@@ -64,7 +64,7 @@ int mmc_go_idle(struct mmc_host *host);
+  * Note: Must be called with host->lock held.
+  */
+ extern struct vmm_bus sdio_bus_type;
+-struct vmm_device_type sdio_func_type;
++extern struct vmm_device_type sdio_func_type;
+
+ int __sdio_attach(struct mmc_host *host);
+
+diff --git a/emulators/display/drawfn.h b/emulators/display/drawfn.h
+index f9163cff..385deaf6 100644
+--- a/emulators/display/drawfn.h
++++ b/emulators/display/drawfn.h
+@@ -69,14 +69,14 @@ typedef void (*drawfn)(struct vmm_surface *,
+                                DRAWFN_ORDER_MAX * \
+                                DRAWFN_FORMAT_MAX)
+
+-drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_8[DRAWFN_FNTABLE_SIZE];
+
+-drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_15[DRAWFN_FNTABLE_SIZE];
+
+-drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_16[DRAWFN_FNTABLE_SIZE];
+
+-drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_24[DRAWFN_FNTABLE_SIZE];
+
+-drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
++extern drawfn drawfn_surface_fntable_32[DRAWFN_FNTABLE_SIZE];
+
+ #endif
recipes-extended/xvisor/xvisor_git.bb +3 -3
index 64b0f22..50323d7 100644
@@ -11,8 +11,9 @@ inherit autotools-brokensep
 # This version support the RISC-V v0.5.0 Hypervisor extensions
 SRCREV = "b3dac5b1f61f23f21dc59b3880897cff78f3b618"
 SRC_URI = "git://github.com/avpatel/xvisor-next.git \
-           file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
-          "
+    file://0001-TESTS-Don-t-specify-mabi-or-march-for-RISC-V.patch \
+    file://0001-EMULATORS-Allow-Xvisor-to-compile-with-gcc-10.patch \
+"
 
 S = "${WORKDIR}/git"
 
--

2.27.0

#2 lore raw

Re: [meta-virtualization][PATCH] xvisor: skip QA checks ldflags and textrel

In reply to Martin Jansa

Merged.

Bruce

In message: [meta-virtualization][PATCH] xvisor: skip QA checks ldflags and textrel

Quoted 29 lines · on 06/11/2020 Martin Jansa wrote:

* feel free to fix it properly, I don't use xvisor at all it just shown these 2 errors in my aarch64 world builds and this recipe needs more love than just these 2 issues like setting PV to something better than "git"

---
 recipes-extended/xvisor/xvisor_git.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-extended/xvisor/xvisor_git.bb +4 -0
index 50323d7..831c943 100644
@@ -49,3 +49,7 @@ FILES_${PN} += "/*.dtb"
 
 COMPATIBLE_HOST = "(aarch64|riscv64|riscv32).*"
 INHIBIT_PACKAGE_STRIP = "1"
+
+# ERROR: xvisor-git-r0 do_package_qa: QA Issue: File /vmm.elf in package xvisor doesn't have GNU_HASH (didn't pass LDFLAGS?) [ldflags]
+# ERROR: xvisor-git-r0 do_package_qa: QA Issue: xvisor: ELF binary /vmm.elf has relocations in .text [textrel]
+INSANE_SKIP_${PN} += "ldflags textrel"
Signature · 1 line
2.27.0