Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3826103ybx; Sat, 9 Nov 2019 04:13:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwghiKPJu/gEn/j6k/BJGIemseq1VhdUqxaKg78EeyXIM9hDVHLOOpuLFTojs0Bqc6yhTQO X-Received: by 2002:a50:e002:: with SMTP id e2mr16091942edl.278.1573301614857; Sat, 09 Nov 2019 04:13:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573301614; cv=none; d=google.com; s=arc-20160816; b=nqwaY3S8ZAlfrnNQP1kivUK5IElWIVmprxIyvKt+vvB/L2cwKhUXhJn276/8MhTY9S KrDSbIbvONgZyCb08okWVA+KXi1rVk0aQj2cpN2C3nnWtN2z1f+CvTT3KCFAyMp8ZtDi zOXbY8Viy0529pQqKIuJVUG/kqXTfe1uM52c4rzd0EiRqfiK3uqNHepNYMrKRf+qScKs AW2bCdWch+bn6m+NlKuDLCDI5ji0Yz/h8yw4puu+ZkL/JY9dqhAAeUU6wDPoEqOB9qgF Fn8YYyIt9xmuoO8w3V/LY6x0ZZwB69RN+tmgNI/rQOFyYddisIpW9Ob8zPCBJwlDGY+j ynCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Yt8Of7OzQamExcGTM8zKyZaMKjTlIkVTlPwq4hoQG0E=; b=IAwagdlTQ2kSkZTvAaC1RzTeG4swk+aTnVS1lsU/Gav0xUBiZKIRvgcks2Fq/M48Ow VnZ3oKX4eKc8RbCANQ4CjuB1inNwkzoUa8od4/seUJpEDdf+Cgg1ae7Nteg8Ywev/I2e 8gEC5EL4JB1M7Ul0baHpkSnof0ISPVev4bApiaZ885QhpANoD+Qwnq5YnH+AKtMunzbe UMIuDU9lyGXWMiFmFitNp8mibK9xtGh+xq5CSLJKjG+zEobZUVEeTOG0zg/ehoqsggWY GgQxDVQ0hChnYiE3StLMhfi1r7tI2UShBJuxGSzquJvXDpAuhZyfbC1x6vXZ9dMp51pP 3TNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kzCuIoS8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si5561387ejv.94.2019.11.09.04.13.01; Sat, 09 Nov 2019 04:13:34 -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=@gmail.com header.s=20161025 header.b=kzCuIoS8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726424AbfKIMMZ (ORCPT + 99 others); Sat, 9 Nov 2019 07:12:25 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54876 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbfKIMMZ (ORCPT ); Sat, 9 Nov 2019 07:12:25 -0500 Received: by mail-wm1-f68.google.com with SMTP id z26so8731311wmi.4; Sat, 09 Nov 2019 04:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yt8Of7OzQamExcGTM8zKyZaMKjTlIkVTlPwq4hoQG0E=; b=kzCuIoS800F0U3DY6gYOJ58Yb+8FNtf+YJB1TsPyLky/5yAIXjX1uWGeVrlabvGkuW TDvJNUSHqf/K7WttjFUZdX5fcMTey2gQgt1WdiwR+N2sojA3l09XO0SObHhPJvI0pAg5 V2cLNf2G0sSGygVxWZLE/4MGgNYzuvvFXqiu1lUGPteA72+xzHEh6PnUBZT7FZDwF8JV ZUNELKwtpMOcimQ1O2gwxzDOmJw8nEIJsWKJQDZTOeYzE50SP8n0+ghu2uuodmdDLJMt L9OhBRlirFJ+GwWQ8wrvWGsU7G8ca8HyIM4hrzlllYipx0HQ73d/sIIYPua0qpwhT25k 5qUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Yt8Of7OzQamExcGTM8zKyZaMKjTlIkVTlPwq4hoQG0E=; b=VqegyHXZz633Lu2XUuoLOsW+Uma0pUcafGsw4VM1QzcppL0fYqSmd71yT3KIGf828B coD4fUE4ZZ5DglxYFBnTZ5OzDDv9B9pEvVH/t/R7zc8VLmrWFsN2iDNHSBnaHxMyp2jU Ig5Wc3G30IIWqgvTiQ/YEG2f1kF/XG0O8RnLPAQpgqvQI5L/CWyqtniICq62PK+MrR3R TpEOKYNrOophaxCIUmACicR/RBGvtEpkxfGQ6pMO88BApYlZq6w3YJTj0f+/65AD+KIa 1+lpJyiw/23WPBT0ue4tkotidMml42UKttpITzv1L80ZcjYLZNu42nFycyvmBCPF8w19 hXJQ== X-Gm-Message-State: APjAAAWaEy8z3iAH6gmsRJWY1JNbTQukV46nvwV7YbQ8mbgYyJDH8UdT D+yZAMbELcY0Dv8YLLcDgW4= X-Received: by 2002:a1c:6683:: with SMTP id a125mr11420411wmc.74.1573301542997; Sat, 09 Nov 2019 04:12:22 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:40ac:ce00:417d:57dd:ed4c:6a6d]) by smtp.gmail.com with ESMTPSA id q15sm9238428wrr.82.2019.11.09.04.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2019 04:12:22 -0800 (PST) From: Luc Van Oostenryck To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Dooks , Luc Van Oostenryck Subject: [PATCH] kbuild: tell sparse about the $ARCH Date: Sat, 9 Nov 2019 13:12:16 +0100 Message-Id: <20191109121216.61381-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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