From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752546AbbJOKUE (ORCPT ); Thu, 15 Oct 2015 06:20:04 -0400 Received: from mx2.parallels.com ([199.115.105.18]:47088 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbbJOKUB (ORCPT ); Thu, 15 Oct 2015 06:20:01 -0400 From: Andrey Ryabinin To: CC: Stephen Rothwell , , Andrey Ryabinin , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , , Andrew Morton , Andy Lutomirski , Andrey Konovalov , Kostya Serebryany , Alexander Potapenko , kasan-dev , Borislav Petkov , Denys Vlasenko , Andi Kleen , Dmitry Vyukov , Sasha Levin , Wolfram Gloger Subject: [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Date: Thu, 15 Oct 2015 13:19:51 +0300 Message-ID: <1444904391-18058-1-git-send-email-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.4.9 In-Reply-To: <20151015201834.350258bf@canb.auug.org.au> References: <20151015201834.350258bf@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some old versions of GCC doesn't handle __alias (or maybe a combination of 'static __always_inline __alias') right. GCC creates outline and unused copy of __read_once_size_check() function in the object file which references memcpy and causes the build failure: arch/x86/entry/vdso/vclock_gettime.o: In function `__read_once_size_check': vclock_gettime.c:(.text+0x5f): undefined reference to `memcpy' arch/x86/entry/vdso/vgetcpu.o: In function `__read_once_size_check': vgetcpu.c:(.text+0x2f): undefined reference to `memcpy' We could avoid using alias to work around this problem. Reported-by: Stephen Rothwell Signed-off-by: Andrey Ryabinin --- include/linux/compiler.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index aa2ae4c..3436a4c 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -231,8 +231,11 @@ void __read_once_size_nocheck(const volatile void *p, void *res, int size) __READ_ONCE_SIZE; } #else -static __always_inline __alias(__read_once_size_check) -void __read_once_size_nocheck(const volatile void *p, void *res, int size); +static __always_inline +void __read_once_size_nocheck(const volatile void *p, void *res, int size) +{ + __READ_ONCE_SIZE; +} #endif static __always_inline void __write_once_size(volatile void *p, void *res, int size) -- 2.4.9