Skip to contentSkip to conversation

kvm-unit-tests: Fix x86_64 to use host compiler

PATCH Superseded Cyril Bur 2 participants 3 messages Oct 25, 2016 – Oct 26, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Cyril Bur

author
#0 lore raw

PATCH 1/1 kvm-unit-tests: Fix x86_64 to use host compiler

kvm-unit-tests requires a multilib compiler for x86_64 as it compiles 32bit boot code.

This patch uses the BR2_HOSTARCH_NEEDS_IA32_COMPILER option to enforce this and avoids using TARGET_CROSS for x86_64 targets and uses the host 32bit (and 64bit) capable compiler.

---
Patch was sent as an RFC initally with the note:

Should be able to be merged as is but I hope the RFC might attract more eyes as this has me in an x86 caveat world that I'm utterly unfamilair with.

With this patch my Power build machine fails to build kvm-unit-tests for x86_64 (expected, I see the message about BR2_HOSTARCH_NEEDS_IA32_COMPILER) and has no problems building for ARM. My x86_64 build machine can build for x86_64 and still build other architectures.

It has been over three weeks and no comments, I believe it would fix the repeated build breakage of kvm-unit-tests x86_64

 package/kvm-unit-tests/Config.in         |  1 +
 package/kvm-unit-tests/kvm-unit-tests.mk | 14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
package/kvm-unit-tests/Config.in +1 -0
index f771896..d72c734 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_KVM_UNIT_TESTS
 	bool "kvm-unit-tests"
+	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64=y
 	depends on BR2_arm || BR2_i386 || BR2_powerpc64 || \
 		BR2_powerpc64le || BR2_x86_64
 	help
package/kvm-unit-tests/kvm-unit-tests.mk +9 -5
index 7fd03ad..cdce1e4 100644
@@ -4,20 +4,25 @@
 #
 ################################################################################
 
-KVM_UNIT_TESTS_VERSION = 0b04ed0610035792514fd8499eb4dacc185520d9
+KVM_UNIT_TESTS_VERSION = 9111ccab0bb42d93d9f2b84c9089b5790e763056
 KVM_UNIT_TESTS_SITE = $(BR2_KERNEL_MIRROR)/scm/virt/kvm/kvm-unit-tests.git
 KVM_UNIT_TESTS_SITE_METHOD = git
 KVM_UNIT_TESTS_LICENSE = LGPLv2
 KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT
 
+#Use HOSTCC for x86_64 as we'll need to compile 32bit code
+#which buildroot cross compilers often can't do
+ifeq ($(BR2_x86_64),y)
+KVM_UNIT_TESTS_ARCH = x86_84
+else
+KVM_UNIT_TESTS_CONF_OPTS = --cross-prefix="$(TARGET_CROSS)"
+endif
 ifeq ($(BR2_arm),y)
 KVM_UNIT_TESTS_ARCH = arm
 else ifeq ($(BR2_i386),y)
 KVM_UNIT_TESTS_ARCH = i386
 else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
 KVM_UNIT_TESTS_ARCH = ppc64
-else ifeq ($(BR2_x86_64),y)
-KVM_UNIT_TESTS_ARCH = x86_84
 endif
 
 ifeq ($(BR2_ENDIAN),"LITTLE")
@@ -26,9 +31,8 @@ else
 KVM_UNIT_TESTS_ENDIAN = big
 endif
 
-KVM_UNIT_TESTS_CONF_OPTS =\
+KVM_UNIT_TESTS_CONF_OPTS +=\
 	--arch="$(KERNEL_ARCH)" \
-	--cross-prefix="$(TARGET_CROSS)" \
 	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
 
 define KVM_UNIT_TESTS_CONFIGURE_CMDS
Signature · 1 line
2.10.1
#1 lore raw

PATCH 1/1 kvm-unit-tests: Fix x86_64 to use host compiler

Cyril,

Thanks for fixing this issue!

package/kvm-unit-tests/kvm-unit-tests.mk line 7

Quoted 10 lines · Cyril Bur
package/kvm-unit-tests/kvm-unit-tests.mk +1 -1
index 7fd03ad..cdce1e4 100644
@@ -4,20 +4,25 @@
 #
 ################################################################################
 
-KVM_UNIT_TESTS_VERSION = 0b04ed0610035792514fd8499eb4dacc185520d9
+KVM_UNIT_TESTS_VERSION = 9111ccab0bb42d93d9f2b84c9089b5790e763056

Is this bump related to using the host compiler on x86-64 ? I don't think it is, so it should be a separate patch. Or if it's related, it should be explained in the commit log.

package/kvm-unit-tests/kvm-unit-tests.mk line 14

Quoted 7 lines
package/kvm-unit-tests/kvm-unit-tests.mk +2 -0
 KVM_UNIT_TESTS_SITE = $(BR2_KERNEL_MIRROR)/scm/virt/kvm/kvm-unit-tests.git
 KVM_UNIT_TESTS_SITE_METHOD = git
 KVM_UNIT_TESTS_LICENSE = LGPLv2
 KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT
 
+#Use HOSTCC for x86_64 as we'll need to compile 32bit code
+#which buildroot cross compilers often can't do

Add one space after the # on each line.

Quoted 4 lines
package/kvm-unit-tests/kvm-unit-tests.mk +4 -0
+ifeq ($(BR2_x86_64),y)
+KVM_UNIT_TESTS_ARCH = x86_84
+else
+KVM_UNIT_TESTS_CONF_OPTS = --cross-prefix="$(TARGET_CROSS)"

package/kvm-unit-tests/kvm-unit-tests.mk line 26

Quoted 10 lines
package/kvm-unit-tests/kvm-unit-tests.mk +1 -2
+endif
 ifeq ($(BR2_arm),y)
 KVM_UNIT_TESTS_ARCH = arm
 else ifeq ($(BR2_i386),y)
 KVM_UNIT_TESTS_ARCH = i386
 else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
 KVM_UNIT_TESTS_ARCH = ppc64
-else ifeq ($(BR2_x86_64),y)
-KVM_UNIT_TESTS_ARCH = x86_84
 endif

Please keep this sequence of ifeq / else ifeq / else ifeq / endif, and instead add:

# For all architectures but x86-64, use the cross-compiler. On x86-64,

# use the host compiler, since we need to build 32 bits binaries
ifneq ($(BR2_x86_64),y)
KVM_UNIT_TESTS_CONF_OPTS = --cross-prefix="$(TARGET_CROSS)"
endif

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
author
#2 lore raw

PATCH 1/1 kvm-unit-tests: Fix x86_64 to use host compiler

Quoted 52 lines · Thomas Petazzoni

Cyril,

Thanks for fixing this issue!

package/kvm-unit-tests/kvm-unit-tests.mk line 7

Quoted 12 lines · Cyril Bur
package/kvm-unit-tests/kvm-unit-tests.mk +0 -0
index 7fd03ad..cdce1e4 100644
@@ -4,20 +4,25 @@

?# ?##################################################################
##############
?

package/kvm-unit-tests/kvm-unit-tests.mk +1 -1
-KVM_UNIT_TESTS_VERSION = 0b04ed0610035792514fd8499eb4dacc185520d9
+KVM_UNIT_TESTS_VERSION = 9111ccab0bb42d93d9f2b84c9089b5790e763056

Is this bump related to using the host compiler on x86-64 ? I don't think it is, so it should be a separate patch. Or if it's related, it should be explained in the commit log.

package/kvm-unit-tests/kvm-unit-tests.mk line 14

Quoted 8 lines

?KVM_UNIT_TESTS_SITE = $(BR2_KERNEL_MIRROR)/scm/virt/kvm/kvm-unit- tests.git
?KVM_UNIT_TESTS_SITE_METHOD = git ?KVM_UNIT_TESTS_LICENSE = LGPLv2 ?KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT
?

package/kvm-unit-tests/kvm-unit-tests.mk +2 -0
+#Use HOSTCC for x86_64 as we'll need to compile 32bit code
+#which buildroot cross compilers often can't do

Add one space after the # on each line.

Quoted 13 lines
package/kvm-unit-tests/kvm-unit-tests.mk +5 -0
+ifeq ($(BR2_x86_64),y)
+KVM_UNIT_TESTS_ARCH = x86_84
+else
+KVM_UNIT_TESTS_CONF_OPTS = --cross-prefix="$(TARGET_CROSS)"
+endif

?ifeq ($(BR2_arm),y)
?KVM_UNIT_TESTS_ARCH = arm
?else ifeq ($(BR2_i386),y)
?KVM_UNIT_TESTS_ARCH = i386
?else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
?KVM_UNIT_TESTS_ARCH = ppc64

package/kvm-unit-tests/kvm-unit-tests.mk +0 -2
-else ifeq ($(BR2_x86_64),y)
-KVM_UNIT_TESTS_ARCH = x86_84
Quoted 1 line

?endif

Please keep this sequence of ifeq / else ifeq / else ifeq / endif, and
instead add:

Quoted 9 lines

# For all architectures but x86-64, use the cross-compiler. On x86- 64,

# use the host compiler, since we need to build 32 bits binaries
ifneq ($(BR2_x86_64),y)
KVM_UNIT_TESTS_CONF_OPTS = --cross-prefix="$(TARGET_CROSS)"
endif

Thanks,

Thanks for the review,

I've addressed all these issues in v2

Cyril

Quoted 1 line

Thomas