Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4807929ooa; Tue, 14 Aug 2018 10:50:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwhoQ8tb1dkWzJhlpE+j2EWJpg1hJerZ7ZLjLbCwmnewm+5LY8sAqQXvY+zDwsM6YrJ+JM8 X-Received: by 2002:a17:902:aa83:: with SMTP id d3-v6mr21329912plr.242.1534269006449; Tue, 14 Aug 2018 10:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534269006; cv=none; d=google.com; s=arc-20160816; b=fipc3YPCw00AC5I0NbcAr/bKfM6uWJ1f+sGjONEO+pclwiVo+w3PdVObjujF4TGayw zogrwDM7I2PuDO5An9Gd4h1PZZVYMyuMRP/9L/OlBHXcQASQ+o0ZkeGRMRh4Y9EmM84D 7RFbppAmW1Ns8wyETMWfIa7SmxbmxDyI/gFxFotARfy4IObytea6vmKea9Yc8MokMBrc rC5vg7QbVzvZJWtUyOD+yN9XFGnnhuDnL73UWfwOHjiuMHEZ4SbXFKgIcviZPC+LFI+h HrRRIhLMpj/YTFi9Mqk6nNWxfJipxmWaDMwx0L7Q72I6nh2dtxh9SpNcQ7FbKgtw4Trm e/iA== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=c15I0hYtTUovTx0rYRLg8/lp17b7Os+WAHMTCUlOPr8=; b=cFXc6jzPkUO/IM7KN2sbF1wxaEsKSKVproKik/6djuGGni/rCqwhsyUYfANgLi8c4K nC6kXyFFRqcUuWNYhQBqzh48BsjH66KMCklQQMP4eoWwO5Vlx+nu4HcmrBFmLFRtaGlZ ottBv1PetCPYWc4thOtbYM8llET9s1H1XbPAZ+t09nioEPg3WXFQLbNxih5yZ8eAxytu pL6KBXaVpFx1EQXhOlUpR9UkovDupry3Bcs8tHRewlr61mgpwI2CVs71f7p0J+fQxuGS SffXSVQU6yxdBvrLsK2vt52aps/UtT3F3Qprcs+6qH43e2UoqrNKXYsu8sidsh5zE2R1 kg0A== ARC-Authentication-Results: i=1; mx.google.com; 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 y92-v6si16732862plb.378.2018.08.14.10.49.51; Tue, 14 Aug 2018 10:50:06 -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; 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 S2391302AbeHNUg1 (ORCPT + 99 others); Tue, 14 Aug 2018 16:36:27 -0400 Received: from smtprelay0035.hostedemail.com ([216.40.44.35]:46879 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390418AbeHNUg0 (ORCPT ); Tue, 14 Aug 2018 16:36:26 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 0CC4C1803EF28; Tue, 14 Aug 2018 17:48:13 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:2:41:69:355:379:541:599:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1593:1594:1605:1730:1747:1777:1792:2194:2198:2199:2200:2393:2525:2559:2563:2682:2685:2692:2693:2828:2859:2895:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3165:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4050:4119:4184:4250:4321:4605:5007:6117:6119:6120:6238:7875:7901:7903:7904:8527:8660:9025:9121:9140:9592:10004:10848:11026:11232:11233:11473:11658:11914:12043:12291:12295:12296:12438:12555:12660:12683:12740:12760:12895:13019:13141:13148:13230:13439:14096:14097:14659:21060:21080:21433:21451:21627:30012:30054:30070:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LF X-HE-Tag: metal85_81bf613c2b717 X-Filterd-Recvd-Size: 8597 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Tue, 14 Aug 2018 17:48:11 +0000 (UTC) Message-ID: <4cdd4ab9ddd16f1fb168266643264595782fd890.camel@perches.com> Subject: Re: Build failures with gcc 4.5 and older From: Joe Perches To: Guenter Roeck , linux-kernel@vger.kernel.org Cc: Rik van Riel , Mike Galbraith , Dave Hansen , Linus Torvalds , Andrew Morton Date: Tue, 14 Aug 2018 10:48:10 -0700 In-Reply-To: <20180814170904.GA12768@roeck-us.net> References: <20180814170904.GA12768@roeck-us.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-08-14 at 10:09 -0700, Guenter Roeck wrote: > Hi, > > Since commit c1a2f7f0c0645 ("mm: Allocate the mm_cpumask > (mm->cpu_bitmap[]) dynamically based on nr_cpu_ids"), building > the Linux kernel with gcc version 4.5 and older fails as follows. > > In file included from ./include/linux/mm.h:17:0, > from ./include/linux/pid_namespace.h:7, > from ./include/linux/ptrace.h:10, > from arch/openrisc/kernel/asm-offsets.c:32: > ./include/linux/mm_types.h:497:16: error: flexible array member in otherwise empty struct > > This is just an example with gcc 4.5.1 for or32. I have seen the problem > with gcc 4.4 (for unicore32) as well. > > Does that mean that gcc 4.5 and older are now officially no longer > supported for compiling the kernel ? > > If so, would it make sense to update include/linux/compiler-gcc.h > accordingly ? And Documentation/process/changes.rst which shows a minimum version required of gcc as 3.2, etc... With cleaning up now unnecessary version tests in compiler-gcc.h, something like: --- Documentation/process/changes.rst | 2 +- include/linux/compiler-gcc.h | 86 ++++++++------------------------------- 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index 7a92a06f90de..61f918b10a0c 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst @@ -29,7 +29,7 @@ you probably needn't concern yourself with isdn4k-utils. ====================== =============== ======================================== Program Minimal version Command to check the version ====================== =============== ======================================== -GNU C 3.2 gcc --version +GNU C 4.6 gcc --version GNU make 3.81 make --version binutils 2.20 ld -v flex 2.5.35 flex --version diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 573f5a7d42d4..020e4b9eee5c 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -10,6 +10,10 @@ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) +#if GCC_VERSION < 40600 +# error Sorry, your compiler is too old - please upgrade it. +#endif + /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ @@ -58,6 +62,12 @@ #define OPTIMIZER_HIDE_VAR(var) \ __asm__ ("" : "=r" (var) : "0" (var)) +/* + * A trick to suppress uninitialized variable warning without generating any + * code + */ +#define uninitialized_var(x) x = x + #ifdef __CHECKER__ #define __must_be_array(a) 0 #else @@ -91,7 +101,7 @@ * A lot of inline functions can cause havoc with function tracing. */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) + !defined(CONFIG_OPTIMIZE_INLINING) #define inline \ inline __attribute__((always_inline, unused)) notrace __gnu_inline #else @@ -148,47 +158,13 @@ #define __always_unused __attribute__((unused)) #define __mode(x) __attribute__((mode(x))) -/* gcc version specific checks */ - -#if GCC_VERSION < 30200 -# error Sorry, your compiler is too old - please upgrade it. -#endif - -#if GCC_VERSION < 30300 -# define __used __attribute__((__unused__)) -#else -# define __used __attribute__((__used__)) -#endif - -#ifdef CONFIG_GCOV_KERNEL -# if GCC_VERSION < 30400 -# error "GCOV profiling support for gcc versions below 3.4 not included" -# endif /* __GNUC_MINOR__ */ -#endif /* CONFIG_GCOV_KERNEL */ - -#if GCC_VERSION >= 30400 #define __must_check __attribute__((warn_unused_result)) #define __malloc __attribute__((__malloc__)) -#endif - -#if GCC_VERSION >= 40000 - -/* GCC 4.1.[01] miscompiles __weak */ -#ifdef __KERNEL__ -# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -# error Your version of gcc miscompiles the __weak directive -# endif -#endif #define __used __attribute__((__used__)) #define __compiler_offsetof(a, b) \ __builtin_offsetof(a, b) -#if GCC_VERSION >= 40100 -# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -#endif - -#if GCC_VERSION >= 40300 /* Mark functions as cold. gcc will assume any path leading to a call * to them will be unlikely. This means a lot of manual unlikely()s * are unnecessary now for any paths leading to the usual suspects @@ -207,24 +183,19 @@ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -#ifndef __CHECKER__ -# define __compiletime_warning(message) __attribute__((warning(message))) -# define __compiletime_error(message) __attribute__((error(message))) -#endif /* __CHECKER__ */ -#endif /* GCC_VERSION >= 40300 */ - -#if GCC_VERSION >= 40400 #define __optimize(level) __attribute__((__optimize__(level))) #define __nostackprotector __optimize("no-stack-protector") -#endif /* GCC_VERSION >= 40400 */ -#if GCC_VERSION >= 40500 +#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) #ifndef __CHECKER__ +#define __compiletime_warning(message) __attribute__((warning(message))) +#define __compiletime_error(message) __attribute__((error(message))) + #ifdef LATENT_ENTROPY_PLUGIN #define __latent_entropy __attribute__((latent_entropy)) #endif -#endif +#endif /* __CHECKER__ */ /* * calling noreturn functions, __builtin_unreachable() and __builtin_trap() @@ -262,10 +233,6 @@ #define randomized_struct_fields_end } __randomize_layout; #endif -#endif /* GCC_VERSION >= 40500 */ - -#if GCC_VERSION >= 40600 - /* * When used with Link Time Optimization, gcc can optimize away C functions or * variables which are referenced only from assembly code. __visible tells the @@ -274,8 +241,7 @@ */ #define __visible __attribute__((externally_visible)) -#endif /* GCC_VERSION >= 40600 */ - +/* gcc version specific checks */ #if GCC_VERSION >= 40900 && !defined(__CHECKER__) /* @@ -309,10 +275,8 @@ * folding in __builtin_bswap*() (yet), so don't set these for it. */ #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__) -#if GCC_VERSION >= 40400 #define __HAVE_BUILTIN_BSWAP32__ #define __HAVE_BUILTIN_BSWAP64__ -#endif #if GCC_VERSION >= 40800 #define __HAVE_BUILTIN_BSWAP16__ #endif @@ -341,10 +305,9 @@ * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html */ #define __designated_init __attribute__((designated_init)) +#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 #endif -#endif /* gcc version >= 40000 specific checks */ - #if !defined(__noclone) #define __noclone /* not needed */ #endif @@ -353,16 +316,6 @@ #define __no_sanitize_address #endif -/* - * A trick to suppress uninitialized variable warning without generating any - * code - */ -#define uninitialized_var(x) x = x - -#if GCC_VERSION >= 50100 -#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 -#endif - /* * Turn individual warnings and errors on and off locally, depending * on version. @@ -375,12 +328,9 @@ #define __diag_GCC_warn warning #define __diag_GCC_error error -/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ -#if GCC_VERSION >= 40600 #define __diag_str1(s) #s #define __diag_str(s) __diag_str1(s) #define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) -#endif #if GCC_VERSION >= 80000 #define __diag_GCC_8(s) __diag(s)