Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1116675imm; Wed, 22 Aug 2018 19:44:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbUnWNaBCLrJ8rmXMuJjQZVP9DZsGGcQNx1QVNyM+AH06FjeCld+E+668q35EZ+n8tKDnSr X-Received: by 2002:a62:2285:: with SMTP id p5-v6mr10862733pfj.53.1534992296249; Wed, 22 Aug 2018 19:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534992296; cv=none; d=google.com; s=arc-20160816; b=AU/oL6I3uZRIEhNwX7TJJC1UyD+tCrzDwbcWjgr4SmTKVuElwUopu+aTGBezMPjt+x PBC/65aFdo4nr6tghu2LIzKvJZc4iOStzg6ibgQbM8NBEamKQdSlOkgjJI8lpHcuYuQ1 bSYStD4aOXKJYulMxGD47xwtk2eV1QMYdkd6V8eKUJo4m00buV0O7agiWC4462vfyCo/ hyJrlvIO9TpHrx1KRW79em0JJJ/PUkkrAj8DBh/P7YhiWbARekX0DXViTpN2KwOELyzA jwaRqd80MEFHtlXbMEFicQR+/+xGB2myGpBXabyTa3OR5Lk2wNa+RCxCbgyi9SQt9sdW 1A3w== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=pr4KSdFDa2kSutSW4zW2TlTft+HohByN6htWclmlZUE=; b=V5NztL3mZvx9h2XbmwBIskUZi8DeJqilQRnUFfHoEV7L1gu3n8BLjiJRckp0B88/LS r7HCIiOOiqjyFbUwuwJYx1d0yCrvaCnFwDxl6ztalC/cwHstqZ8y3A2pzKkCgSB7o9/h NJxaU9W7QNlGvvASomM4Heyj0oIAb+p7Px8fKjFZFTJKeMbz3hhgwe4JtT/oQcOHt4OG RQttJ24Sg+fDAPQ1l45X2kSjVw8g8rw24+9EBsTpgIKfi/7LKU/qN2WkCm7VE3CtfRoh qq/tNO+AB3qg+u7Z8ybJHO73ly1OPvSNDxQChiXW9iblGlf4G+z/1LAwZBaJlS3gypkU s5nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="I20NGB/u"; 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 c3-v6si3068288pld.457.2018.08.22.19.44.40; Wed, 22 Aug 2018 19:44:56 -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=@nifty.com header.s=dec2015msa header.b="I20NGB/u"; 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 S1727473AbeHWGLA (ORCPT + 99 others); Thu, 23 Aug 2018 02:11:00 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:49947 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726676AbeHWGLA (ORCPT ); Thu, 23 Aug 2018 02:11:00 -0400 Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) (authenticated) by conssluserg-05.nifty.com with ESMTP id w7N2hKdC023390 for ; Thu, 23 Aug 2018 11:43:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com w7N2hKdC023390 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1534992201; bh=pr4KSdFDa2kSutSW4zW2TlTft+HohByN6htWclmlZUE=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=I20NGB/uWOqxno6+jd7l09lDUr9G1iHv8mow1Gt/MIPavylzdZRswyooAtuDGsDxP Xn5mMq+TSE8PETydNbRyH3jbPOtpU3CDNiMy4WQXARSHjg3BNOcpr0b8nWzEw+6FZb 8sZVogZA9rG9Y/88KY0Ub19C2m84Pl8h6IdfB4P+pHt96tIvHddA9IFWAZ5BaJS4ca AuShgjNrLqPdGgcjlOhiDN8tvur5ylanOOay9PCN0uNkP4xbt3r/DHU1H0xczXpnvV R8201d6JGq9BwXjklnyGpfCZgnRtbkxtMGFV8vcwaZivNeAHFkl3Dal8j6qty/VgLF PZyMMG337L9kQ== X-Nifty-SrcIP: [209.85.222.49] Received: by mail-ua1-f49.google.com with SMTP id l2-v6so2316113uaf.11 for ; Wed, 22 Aug 2018 19:43:20 -0700 (PDT) X-Gm-Message-State: AOUpUlGb9V69OFC/PFY51Q2jo1OKbE3TUrsR1bmgu57l2JUHw/3gvWpI 5hzIqgsUjMHGW1jnaHhng3ia2HqTZNMFNeayxAI= X-Received: by 2002:ab0:14b3:: with SMTP id d48-v6mr39362716uae.88.1534992199514; Wed, 22 Aug 2018 19:43:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:2642:0:0:0:0:0 with HTTP; Wed, 22 Aug 2018 19:42:39 -0700 (PDT) In-Reply-To: <20180822233724.110454-1-ndesaulniers@google.com> References: <20180822233724.110454-1-ndesaulniers@google.com> From: Masahiro Yamada Date: Thu, 23 Aug 2018 11:42:39 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] include/linux/compiler*.h: make compiler-*.h mutually exclusive To: Nick Desaulniers Cc: Linus Torvalds , Kees Cook , Joe Perches , Jonathan Corbet , Arnd Bergmann , David Woodhouse , Linux Kernel Mailing List , Thomas Gleixner , Will Deacon , Geert Uytterhoeven , Ingo Molnar , Andrew Morton , asmadeus@codewreck.org, Daniel Borkmann , "H. Peter Anvin" 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 Hi Nick 2018-08-23 8:37 GMT+09:00 Nick Desaulniers : > Commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6") > recently exposed a brittle part of the build for supporting non-gcc > compilers. > > Both Clang and ICC define __GNUC__, __GNUC_MINOR__, and > __GNUC_PATCHLEVEL__ for quick compatibility with code bases that haven't > added compiler specific checks for __clang__ or __INTEL_COMPILER. > > This is brittle, as they happened to get compatibility by posing as a > certain version of GCC. This broke when upgrading the minimal version > of GCC required to build the kernel, to a version above what ICC and > Clang claim to be. > > Rather than always including compiler-gcc.h then undefining or > redefining macros in compiler-intel.h or compiler-clang.h, let's > separate out the compiler specific macro definitions into mutually > exclusive headers, do more proper compiler detection, and keep shared > definitions in compiler_types.h. > > Reported-by: Masahiro Yamada > Suggested-by: Eli Friedman > Suggested-by: Joe Perches > Signed-off-by: Nick Desaulniers > --- > arch/arm/kernel/asm-offsets.c | 13 +- > drivers/gpu/drm/i915/i915_utils.h | 2 +- > drivers/watchdog/kempld_wdt.c | 5 - > include/linux/compiler-clang.h | 20 ++- > include/linux/compiler-gcc.h | 88 ----------- > include/linux/compiler-intel.h | 13 +- > include/linux/compiler_types.h | 238 ++++++++++++++---------------- > mm/ksm.c | 4 +- > mm/migrate.c | 3 +- > 9 files changed, 133 insertions(+), 253 deletions(-) If I build ARM linux with Clang, I see the following error. arch/arm/firmware/trusted_foundations.c:34:13: error: variable has incomplete type 'void' static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) ^ arch/arm/firmware/trusted_foundations.c:34:20: error: expected ';' after top level declarator static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) ^ ; arch/arm/firmware/trusted_foundations.c:77:25: error: use of undeclared identifier 'trusted_foundations_ops' register_firmware_ops(&trusted_foundations_ops); ^ 3 errors generated. scripts/Makefile.build:307: recipe for target 'arch/arm/firmware/trusted_foundations.o' failed make[2]: *** [arch/arm/firmware/trusted_foundations.o] Error 1 Makefile:1057: recipe for target 'arch/arm/firmware' failed make[1]: *** [arch/arm/firmware] Error 2 make[1]: *** Waiting for unfinished jobs.... __naked is defined in It was previous included by all compilers, but now it is only by _true_ GCC. Even if I move the __naked definition to , I see a different error. arch/arm/firmware/trusted_foundations.c:47:10: error: parameter references not allowed in naked functions : "r" (type), "r" (arg1), "r" (arg2) ^ arch/arm/firmware/trusted_foundations.c:34:13: note: attribute is here static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) ^ ./include/linux/compiler_types.h:277:33: note: expanded from macro '__naked' #define __naked __attribute__((naked)) ^ I do not know what a correct fix is. -- Best Regards Masahiro Yamada