Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3955420ybx; Sat, 9 Nov 2019 06:27:49 -0800 (PST) X-Google-Smtp-Source: APXvYqy5A2lrc98hJGPJ7j/XgqvltEe/u960waDH9PJCVHz5R0uhr4b7UXUvCxOy6pqfr6ikng/Q X-Received: by 2002:a05:6402:1157:: with SMTP id g23mr16831963edw.260.1573309669218; Sat, 09 Nov 2019 06:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573309669; cv=none; d=google.com; s=arc-20160816; b=t3fsG45v87jEk9f1VTBhrjdb379i/LLIM4TVfmHSTk3Cwia+hLO7IqOkj4TKGac9QU aTF1FkeUeaPHXZdV2Mqt9vCX+oUR1kqGsSh3elmx0q7g6AVQKiNWoCiI+O9XJwwoE7U7 ckWUo2hL6V14u0dhq8rMtNa5hB76RjjGn56+IQ4SJTzIo6F+3J8LIpB59q9qSHzoOMxC uX+aea9k62pmYlLbV+JMSJjqM67BoX2mQz/hN/jmOEekDKA8x7BogaoGawmymv9Nq+3L iPOsQzcPt5ssig7ziPIPregF7P17mUdUGQH2VYytnDUzvYK3Cth4wD8Tazt1PTbR8Z/S 3KbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=we+lWwQKgiRWTuKBGrRbQkLgZvihSe+fisYez56gxuA=; b=r/UmQ4GXuijyEZF8SC1DjkOn2EtLko5ZjNvgliCRmvH3gqmjpegv2AK5jQsMZBjQQR ZT3mjtqNHjHi6fP5GCsiJfVg4CAnAUw5Q95GPtnX4MEdcXzS6JHGs+rxTDHrxknN0Bex ReBVNRhnhj7LNnnyC2yPoVuOfKFJwdE41rWQDSb0ijSvDCix6ilsbObQWF7ijpSrVr3c 3ir8/d9R2RcQVq3WCcd7ClMqE1dHgtXVM6j7C/nH7L5JY8CObttMNHGPIgTZaEUoNL7N h1+ADD52HLmRRNf08ihK+KPZR5QQnxQ6sfvpIBwxBKxO826JH9tu+enFZLU7rwXooCQC TC+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=15hRcZka; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si376489ejt.308.2019.11.09.06.27.25; Sat, 09 Nov 2019 06:27:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=15hRcZka; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726520AbfKIOYk (ORCPT + 99 others); Sat, 9 Nov 2019 09:24:40 -0500 Received: from conssluserg-06.nifty.com ([210.131.2.91]:28350 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbfKIOYk (ORCPT ); Sat, 9 Nov 2019 09:24:40 -0500 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (authenticated) by conssluserg-06.nifty.com with ESMTP id xA9EOQ29020824; Sat, 9 Nov 2019 23:24:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com xA9EOQ29020824 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1573309467; bh=we+lWwQKgiRWTuKBGrRbQkLgZvihSe+fisYez56gxuA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=15hRcZka3kIGQ2ELqjKXhpN+kEUoi45ySQ3QfWoN1dL/YNtDMUlQQfaTbo36YXZWU jJ1/q+iB9jSGKKJ37iZgmuvAXFtkdEOjOcBNF1xEp+17uKR0XfpmVvPN6MRu/9pAyl t4MYD9Rb+idCR7NN8jjrKlkTOOgudDLGsTUg6mqrALcAMREyQozQ71XVow2JJ3/Pay doabGTNqvm+mTvBobWBO6a7oJyJ8iDcOkpD6mUGLcZFwsLCc9ViZjNZMItaCW21MLA C71nGKKzmnV/FO1AYl9CCA5AiglbsrNZAI5+7ChwU4lEgM34ZV4aFyhd1rPWqIwVXv Z3Aa3tXw5hvOA== X-Nifty-SrcIP: [209.85.217.52] Received: by mail-vs1-f52.google.com with SMTP id b184so5815631vsc.5; Sat, 09 Nov 2019 06:24:26 -0800 (PST) X-Gm-Message-State: APjAAAVhTKgOrY7Z2cR8j9ia1cL2YrwVVnQ/UODfVLGugWElVNzHE16I W3kmzHerohQOLGKX7U2JcTYfN9isgrveEhgAhS0= X-Received: by 2002:a67:2d08:: with SMTP id t8mr13089811vst.155.1573309465580; Sat, 09 Nov 2019 06:24:25 -0800 (PST) MIME-Version: 1.0 References: <20191109121216.61381-1-luc.vanoostenryck@gmail.com> In-Reply-To: <20191109121216.61381-1-luc.vanoostenryck@gmail.com> From: Masahiro Yamada Date: Sat, 9 Nov 2019 23:23:49 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: tell sparse about the $ARCH To: Luc Van Oostenryck Cc: Linux Kbuild mailing list , Linux Kernel Mailing List , Ben Dooks Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 9, 2019 at 9:12 PM Luc Van Oostenryck 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 > Signed-off-by: Luc Van Oostenryck > --- 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