Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp921615ybl; Fri, 10 Jan 2020 08:57:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxrEBKMm23qLOcPrrifj7SnP8l8SWOOlg4oz+G7n/xJxAhEXSx66RjVHREUwl4TokY4kRdm X-Received: by 2002:a05:6830:114f:: with SMTP id x15mr3223504otq.291.1578675478758; Fri, 10 Jan 2020 08:57:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578675478; cv=none; d=google.com; s=arc-20160816; b=QxfFUbwA7+4aKCQmFin0vigYi5b4U6F/ckyZHumTsWf7KuFJYWn3XnJ5GJj3g24DIz cB8vj9IGANQR60lFSAop1NOQyboBVIrfyo+A7Cx/uPx/oYk6MAyizTE2zxMAecwR3nhN yGijdsNXzcvx2BvyS5XFg7HJrWek08Bjug6AMkdnSPcViYP7kY5cWmQLWaMjcvNycHZK jj3eAV10qHiRWfBM2qhhNKq0HNoPjGjWQRPG/ljM1HgiBlimPL0TtNj9vaErlYYO4EgK Z/jvyRoijT0vxMcjiZf39wOH+xT0FmIPaEqhLvqbGWAR1w/nQdY3aJpEfEtzNFh3QWUr xb+Q== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=fCbL8c+v8JbLjzqoyCTKk0NPUpm47+RFxYtriv1bpCk=; b=aQUUpfcCkm83ulNqxd//E2AdIzPnSBifGMsL1lLqWv813qPKUbN6zDW6HrhH/m2jt/ /K2tXbOFAYkPRiTEydU+1v3vfCbM8DJCnxoRspMYfx28DTs8ChJZue2pVHZB/imK5gY9 JWNamF84GKBfvGKTlKNUYNe85kH3/qoQvm/Ar96Wa4Dlf2iNHSwwV+p95maqLqHpRlNp 1M/L+Nu/dCEeuoNTZUCW29g+AI7NTbj89cFRrByY+Dj56Qas2ko1RcneayQZc7VLhFVF 33rPTROx9/42o6Pp6SIhS4yaw8J55hapYFzAkflxFR7W/okMzgJoETMepcchJbH3P+DC bivQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ubqczTcX; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si1668082otl.258.2020.01.10.08.57.47; Fri, 10 Jan 2020 08:57:58 -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=@kernel.org header.s=default header.b=ubqczTcX; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728574AbgAJQ4q (ORCPT + 99 others); Fri, 10 Jan 2020 11:56:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:59888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728258AbgAJQ4p (ORCPT ); Fri, 10 Jan 2020 11:56:45 -0500 Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A5B9920721; Fri, 10 Jan 2020 16:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578675404; bh=4nVI30gKryW63hLtZQ4pIBrmPzl/yd4sdMuuHmRHkD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubqczTcX2w73nHNzdZZqcmMn1Bl482OS8axtgQHMS9EalHO7PdFYszzyYDhn7MjSO 6cMFkzD6bOSEqBIEeFyqmxH/sKhjzlY10OTQF6c2NXk8dmVmQWNhKC4TGQgEkREkkh KQdzij/G1jPYzm2m6R7Twb+zXyE4MT/j2wavyDTE= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, kernel-team@android.com, Will Deacon , Michael Ellerman , Peter Zijlstra , Linus Torvalds , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann Subject: [RFC PATCH 1/8] compiler/gcc: Emit build-time warning for GCC prior to version 4.8 Date: Fri, 10 Jan 2020 16:56:29 +0000 Message-Id: <20200110165636.28035-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110165636.28035-1-will@kernel.org> References: <20200110165636.28035-1-will@kernel.org> 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 Prior to version 4.8, GCC may miscompile READ_ONCE() by erroneously discarding the 'volatile' qualifier: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 We've been working around this using some nasty hacks which make READ_ONCE() both horribly complicated and also prevent us from enforcing that it is only used on scalar types. Since GCC 4.8 is pretty old for kernel builds now, emit a warning if we detect it during the build. Suggested-by: Linus Torvalds Cc: Peter Zijlstra Cc: Michael Ellerman Cc: Arnd Bergmann Cc: Christian Borntraeger Signed-off-by: Will Deacon --- include/linux/compiler-gcc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index d7ee4c6bad48..62afe874073e 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -14,6 +14,10 @@ # error Sorry, your compiler is too old - please upgrade it. #endif +#if GCC_VERSION < 40800 +# warning Your compiler is old and may miscompile the kernel due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 - please upgrade it. +#endif + /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ -- 2.25.0.rc1.283.g88dfdc4193-goog