Re: [LTP] [PATCH 1/2] kvm: Fix compilation on x86

Cyril Hrubis
2022-06-08T14:37:53Z

Hi!
> Buildroot supports i386 pentium toolchains (br-i386-pentium-mmx-musl,
> br-i386-pentium4-full) which fail to compile because as is run without --32.

So we have a 32bit compiler but 64bit linker?

I guess that passing -m32 to 32bit compiler is harmless, so this can go
in.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> Suggested-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> testcases/kernel/kvm/Makefile | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
> index adab56952..8d5193d8e 100644
> --- a/testcases/kernel/kvm/Makefile
> +++ b/testcases/kernel/kvm/Makefile
> @@ -17,11 +17,14 @@ FILTER_OUT_MAKE_TARGETS := lib_guest lib_host lib_x86
> ifeq ($(HOST_CPU),x86_64)
> ifneq (,$(findstring m32,$(CFLAGS)))
> HOST_CPU = x86
> - GUEST_CFLAGS += -m32
> - ASFLAGS += --32
> endif
> endif
>
> +ifeq ($(HOST_CPU),x86)
> + GUEST_CFLAGS += -m32
> + ASFLAGS += --32
> +endif
> +
> # Some distros enable -pie by default. That breaks KVM payload linking.
> ifdef LTP_CFLAGS_NOPIE
> GUEST_CFLAGS += -fno-pie
> --
> 2.36.1
>

--
Cyril Hrubis
chrubis@suse.cz