Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp38169ybp; Thu, 10 Oct 2019 13:35:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI0pQbG+3YnNhaaZJTeSqFd/8YwqeiXgYmSsBweTys/9Ta+7OCXE7xX7uWRpZq+d/RXcsI X-Received: by 2002:aa7:de02:: with SMTP id h2mr10092428edv.212.1570739707319; Thu, 10 Oct 2019 13:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739707; cv=none; d=google.com; s=arc-20160816; b=XEpSqODB1IOEd/vh+oJGT0wC+bU1qNaw074cmUzmZASHTm9atig986AHZoNn7GSo06 Vztw08u/BKVpQ0jZK5xuzIUsHyWJhuVqy6n72aN4M+riTaxYmQAFcEnsBpcX9BOz3ZRb gisfOkuysbzsWAzA1OUVsBGjXMvvqEGIzjKX/p2GpfnbuDJphjaBq7p9tLH5T8euz0+J RWEa156LzBBuzCd93wj4iQ781qkzwx/mnrJ1mx/JwwPCatDUzIcQzFc+7SQ8V076kWL0 4odUl8TOIaAy9NQTH4MKxRG3BQI8d/vk6H4SBTaAfeUO6d1p9lLYuxdCGCdRq3ofSWXJ Ae5A== 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=fWk3YhiiJHg8k8ptjSkAx7ItL9F1legAJpF+beihn+4=; b=kQE8bSmzX4FwzIP20Kn5aJh6ZK3eSRUdgiLOM85wGv1v1r/FKoiNHATX6+dpmkXd2H lCko5QB/Q4638AMxkRgNOZUiuWacc3UjUNFMfRjPfacYuXNEprro36YjtQXtVOzvoTL6 mq/gTd1s5HQyQt6GWcEfaV9SQIjJvgOFIXQehQ+KsI4xFuKe7xGprKDuCZiFRvWGRr4C aSuDCwWH23a24bgFXISsYBIqK1d+gRqV/ZRSc00akhpovNRkN+Mn0mWihld1AiLhUmfm lJP41H6GXEftZP6x4LHa/PkKVpsWiV95nssfPccc13mFyrM441ADjMnjgxdEwxy4veAw mCow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nzzPZFBy; 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 d9si4352047edb.371.2019.10.10.13.34.43; Thu, 10 Oct 2019 13:35:07 -0700 (PDT) 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=nzzPZFBy; 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 S1727005AbfJJUc2 (ORCPT + 99 others); Thu, 10 Oct 2019 16:32:28 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40828 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUc2 (ORCPT ); Thu, 10 Oct 2019 16:32:28 -0400 Received: by mail-ot1-f68.google.com with SMTP id y39so6067439ota.7; Thu, 10 Oct 2019 13:32:27 -0700 (PDT) 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=fWk3YhiiJHg8k8ptjSkAx7ItL9F1legAJpF+beihn+4=; b=nzzPZFByrpOo0NvlBOUhGFQUZP2Zqe60DgnyztdpxgMoIpUWkyzpl5Z+TrlaDdjzRi 3NCJrGLGAb77NBhiFeC3ttL8yXBov+S8RXCOTej35+cZIUWTtSSc//r2RD4HD5Jfapcv AvFTqMtDmnKbTguqLzRt76FOxK6iU7fhJdWPiPSNZcA5Nhay/TWmbiQn7moWj9jsEwPq tka0fyspeegLizi+iUZSnwGF3Wyvv4G8HsUmOkPnfw2HFjvrEiFoTDAsKWrp6RLXmO3z qs451Dr7MiITaSUZs9icAnNS5Y2nghpjMfHmV10zro8sq+SaayVxdvZ0AuFlXrGg96Br PQ6A== 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=fWk3YhiiJHg8k8ptjSkAx7ItL9F1legAJpF+beihn+4=; b=WMFaB94NjRL48tFhnbXF898YXn+IuO4Hs53HFPT5EppSvbRij9jNIvDr9i/BYbSrK1 Vj2jKUwGSoFW7izP3QJ7p8p0R6U2bTKU8hPLvyg+Ei8mtGCi3jd0x59Zr5QKl2MKG++V 0JRroIIqiwXzGMO4Hj8N/YAJ5DTqce8TNiulxNSLeyy6YYAFw144QGzSFr6TBmwWuV96 wCo+d9jGuMaqKC7lM1RjV+tXkhor2ZB4pciodc347ra8D1HPWqmofLsw54aiV82Zdrhv FOyOPQXP0pYMXuHa30zH7K/frx7uInzevyMOfR0jxzxM8U7x2C54UGGZCvmMvlkUkNTP avng== X-Gm-Message-State: APjAAAXkeCj9m5wwLiFJLs2tU8RDCHNY41q4stRHuJoQ7K8cJzYm7JNm /VviRobJczkrL9SJoXDEfJ4= X-Received: by 2002:a9d:5605:: with SMTP id e5mr9056238oti.150.1570739546944; Thu, 10 Oct 2019 13:32:26 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id l17sm1726636oic.24.2019.10.10.13.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 13:32:26 -0700 (PDT) From: Nathan Chancellor To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor Subject: [PATCH] mips: Fix unroll macro when building with Clang Date: Thu, 10 Oct 2019 13:31:59 -0700 Message-Id: <20191010203159.20565-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Building with Clang errors after commit 6baaeadae911 ("MIPS: Provide unroll() macro, use it for cache ops") since the GCC_VERSION macro is defined in include/linux/compiler-gcc.h, which is only included in compiler.h when using GCC: In file included from arch/mips/kernel/mips-mt.c:20: ./arch/mips/include/asm/r4kcache.h:254:1: error: use of undeclared identifier 'GCC_VERSION'; did you mean 'S_VERSION'? __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, ) ^ ./arch/mips/include/asm/r4kcache.h:219:4: note: expanded from macro '__BUILD_BLAST_CACHE' cache_unroll(32, kernel_cache, indexop, ^ ./arch/mips/include/asm/r4kcache.h:203:2: note: expanded from macro 'cache_unroll' unroll(times, _cache_op, insn, op, (addr) + (i++ * (lsize))); ^ ./arch/mips/include/asm/unroll.h:28:15: note: expanded from macro 'unroll' BUILD_BUG_ON(GCC_VERSION >= 40700 && \ ^ Use CONFIG_GCC_VERSION, which will always be set by Kconfig. Additionally, Clang 8 had improvements around __builtin_constant_p so use that as a lower limit for this check with Clang (although MIPS wasn't buildable until Clang 9); building a kernel with Clang 9.0.0 has no issues after this change. Fixes: 6baaeadae911 ("MIPS: Provide unroll() macro, use it for cache ops") Link: https://github.com/ClangBuiltLinux/linux/issues/736 Signed-off-by: Nathan Chancellor --- arch/mips/include/asm/unroll.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/unroll.h b/arch/mips/include/asm/unroll.h index df1cdcfc5a47..c628747d4ecd 100644 --- a/arch/mips/include/asm/unroll.h +++ b/arch/mips/include/asm/unroll.h @@ -25,7 +25,8 @@ * generate reasonable code for the switch statement, \ * so we skip the sanity check for those compilers. \ */ \ - BUILD_BUG_ON(GCC_VERSION >= 40700 && \ + BUILD_BUG_ON((CONFIG_GCC_VERSION >= 40700 || \ + CONFIG_CLANG_VERSION >= 80000) && \ !__builtin_constant_p(times)); \ \ switch (times) { \ -- 2.23.0