From patchwork Wed Feb 21 22:45:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 129139 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1126175ljc; Wed, 21 Feb 2018 14:45:34 -0800 (PST) X-Google-Smtp-Source: AH8x227UQhq3XBmYGB0/O+Swf9cCEKMb04yDQXz/TnuiPmvZV7MR9qeoKFfOO/oPtiWb1RoFyKY0 X-Received: by 10.98.73.4 with SMTP id w4mr4701506pfa.227.1519253134005; Wed, 21 Feb 2018 14:45:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519253134; cv=none; d=google.com; s=arc-20160816; b=eaqI37mtP4p/OqyZHqIXZ9sflb10voJ5nADEZGa3c4xPkdaHp56DU5Zh+d7p8oMqIg YR00eUCBVQk0OHina3FawFRj3vSea3x4B4oWPJgP3oRloSrq2wbE71/ft83ca3id6/md 6TYyTGs3bPTW/fGV6px6wN3t3Ug/V0g4A5doHk9xDtxnJmsh6NGiUWrusJFFQw3MtEPO MRmfCYELTZ22Dh1xWbCLh6LHpF5IECvrwsJqiPok+HsfRtXp7Top7rX5n4aOG7PW5piQ SALKDvc1KuXmBb7bnL38CDNq4ycpzvrsUwZxmjw7voppN0kKZFwov4w9nx3YTp9yeJrw LubQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:subject:to:from :date:arc-authentication-results; bh=qZMpvGjTqFrcoRvkco8wGnXmVeIftCFvoa7kuJMSP5A=; b=MWyMMI0v6Wbn/8aSMVcczDfZa1dExsmc2dpKUIURHrnDvRmTBZCz+COWiIrpHISIuL 7+9P8djVfUW19CE4U9yW6XzUikVzsQtsUdBj5oMCIL3aDfSWaUaQEJ0qQI0rTPhUSZ2J z+rdQIGeWlRoVAuWMHhOpsplB/E09vbBQ5XU0D3yWkt20dOWcCpaSpdtKTRa2huS4yFk pxxnm4H0ncU7ZOvv4c07mT1ev0k4w1DPJt4Vl3geiIbcLVCXa5wpuZYE9fd8hfxgv0hg Mlypua9BA3JB627O7WATg06TASJxzL+gj0l9g8ifQc1+EUR3RFlxcmLxvJe0nvZGXUMB ktPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 z23-v6si2364658pll.4.2018.02.21.14.45.33; Wed, 21 Feb 2018 14:45:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbeBUWpc (ORCPT + 10 others); Wed, 21 Feb 2018 17:45:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55446 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbeBUWpW (ORCPT ); Wed, 21 Feb 2018 17:45:22 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A149012C1; Wed, 21 Feb 2018 22:45:21 +0000 (UTC) Date: Wed, 21 Feb 2018 14:45:20 -0800 From: akpm@linux-foundation.org To: ak@linux.intel.com, akpm@linux-foundation.org, arnd@arndb.de, babu.moger@amd.com, gregkh@linuxfoundation.org, mm-commits@vger.kernel.org, nico@linaro.org, peterz@infradead.org, stable@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, will.deacon@arm.com, yamada.masahiro@socionext.com Subject: [patch 03/16] Kbuild: always define endianess in kconfig.h Message-ID: <20180221224520.H4WsWEhwf%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann Subject: Kbuild: always define endianess in kconfig.h Build testing with LTO found a couple of files that get compiled differently depending on whether asm/byteorder.h gets included early enough or not. In particular, include/asm-generic/qrwlock_types.h is affected by this, but there are probably others as well. The symptom is a series of LTO link time warnings, including these: net/netlabel/netlabel_unlabeled.h:223: error: type of 'netlbl_unlhsh_add' does not match original declaration [-Werror=lto-type-mismatch] int netlbl_unlhsh_add(struct net *net, net/netlabel/netlabel_unlabeled.c:377: note: 'netlbl_unlhsh_add' was previously declared here include/net/ipv6.h:360: error: type of 'ipv6_renew_options_kern' does not match original declaration [-Werror=lto-type-mismatch] ipv6_renew_options_kern(struct sock *sk, net/ipv6/exthdrs.c:1162: note: 'ipv6_renew_options_kern' was previously declared here net/core/dev.c:761: note: 'dev_get_by_name_rcu' was previously declared here struct net_device *dev_get_by_name_rcu(struct net *net, const char *name) net/core/dev.c:761: note: code may be misoptimized unless -fno-strict-aliasing is used drivers/gpu/drm/i915/i915_drv.h:3377: error: type of 'i915_gem_object_set_to_wc_domain' does not match original declaration [-Werror=lto-type-mismatch] i915_gem_object_set_to_wc_domain(struct drm_i915_gem_object *obj, bool write); drivers/gpu/drm/i915/i915_gem.c:3639: note: 'i915_gem_object_set_to_wc_domain' was previously declared here include/linux/debugfs.h:92:9: error: type of 'debugfs_attr_read' does not match original declaration [-Werror=lto-type-mismatch] ssize_t debugfs_attr_read(struct file *file, char __user *buf, fs/debugfs/file.c:318: note: 'debugfs_attr_read' was previously declared here include/linux/rwlock_api_smp.h:30: error: type of '_raw_read_unlock' does not match original declaration [-Werror=lto-type-mismatch] void __lockfunc _raw_read_unlock(rwlock_t *lock) __releases(lock); kernel/locking/spinlock.c:246:26: note: '_raw_read_unlock' was previously declared here include/linux/fs.h:3308:5: error: type of 'simple_attr_open' does not match original declaration [-Werror=lto-type-mismatch] int simple_attr_open(struct inode *inode, struct file *file, fs/libfs.c:795: note: 'simple_attr_open' was previously declared here All of the above are caused by include/asm-generic/qrwlock_types.h failing to include asm/byteorder.h after commit e0d02285f16e ("locking/qrwlock: Use 'struct qrwlock' instead of 'struct __qrwlock'") in linux-4.15. Similar bugs may or may not exist in older kernels as well, but there is no easy way to test those with link-time optimizations, and kernels before 4.14 are harder to fix because they don't have Babu's patch series We had similar issues with CONFIG_ symbols in the past and ended up always including the configuration headers though linux/kconfig.h. This works around the issue through that same file, defining either __BIG_ENDIAN or __LITTLE_ENDIAN depending on CONFIG_CPU_BIG_ENDIAN, which is now always set on all architectures since commit 4c97a0c8fee3 ("arch: define CPU_BIG_ENDIAN for all fixed big endian archs"). Link: http://lkml.kernel.org/r/20180202154104.1522809-2-arnd@arndb.de Signed-off-by: Arnd Bergmann Cc: Babu Moger Cc: Andi Kleen Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Nicolas Pitre Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Cc: Signed-off-by: Andrew Morton --- include/linux/kconfig.h | 6 ++++++ 1 file changed, 6 insertions(+) diff -puN include/linux/kconfig.h~kbuild-always-define-endianess-in-kconfigh include/linux/kconfig.h --- a/include/linux/kconfig.h~kbuild-always-define-endianess-in-kconfigh +++ a/include/linux/kconfig.h @@ -4,6 +4,12 @@ #include +#ifdef CONFIG_CPU_BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#else +#define __LITTLE_ENDIAN 1234 +#endif + #define __ARG_PLACEHOLDER_1 0, #define __take_second_arg(__ignored, val, ...) val