[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQops2qF9Ljf+1xg8SKif89mLrjfaKosWrCbfMCzfwnOA@mail.gmail.com>
Date: Sat, 9 Nov 2019 23:23:49 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ben Dooks <ben.dooks@...ethink.co.uk>
Subject: Re: [PATCH] kbuild: tell sparse about the $ARCH
On Sat, Nov 9, 2019 at 9:12 PM Luc Van Oostenryck
<luc.vanoostenryck@...il.com> wrote:
>
> Sparse uses the same executable for all archs and uses flags
> like -m64, -mbig-endian or -D__arm__ for arch-specific parameters.
> But Sparse also uses value from the host machine used to build
> Sparse as default value for the target machine.
>
> This works, of course, well for native build but can create
> problems when cross-compiling, like defining both '__i386__'
> and '__arm__' when cross-compiling for arm on a x86-64 machine.
>
> Fix this by explicitely telling sparse the target architecture.
>
> Reported-by: Ben Dooks <ben.dooks@...ethink.co.uk>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
> ---
Applied to linux-kbuild. Thanks.
> Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 6f54f2f95743..05a8906dde63 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -937,6 +937,9 @@ ifeq ($(CONFIG_RELR),y)
> LDFLAGS_vmlinux += --pack-dyn-relocs=relr
> endif
>
> +# make the checker run with the right architecture
> +CHECKFLAGS += --arch=$(ARCH)
> +
> # insure the checker run with the right endianness
> CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
>
> --
> 2.24.0
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists