From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C382C433E0 for ; Wed, 27 May 2020 14:17:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 346EB2073B for ; Wed, 27 May 2020 14:17:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388986AbgE0ORC (ORCPT ); Wed, 27 May 2020 10:17:02 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:42241 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388141AbgE0ORC (ORCPT ); Wed, 27 May 2020 10:17:02 -0400 Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MPK73-1jNdyb1lNN-00PfUR; Wed, 27 May 2020 16:15:56 +0200 From: Arnd Bergmann To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Cc: Arnd Bergmann , stable@vger.kernel.org, "H. Peter Anvin" , Jiri Slaby , Juergen Gross , Herbert Xu , Tony Luck , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] x86: fix clang integrated assembler build Date: Wed, 27 May 2020 16:15:39 +0200 Message-Id: <20200527141553.1768675-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer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ANGh7KANO3z2xyKj5HsQgPsLrk2VQi0rbrR LNUvfiZ7HNzDzeYD4csCPzFo1Q0czax1TFof2QNccYY3Pxn0+Y= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang and gas seem to interpret the symbols in memmove_64.S and memset_64.S differently, such that clang does not make them 'weak' as expected, which leads to a linker error, with both ld.bfd and ld.lld: ld.lld: error: duplicate symbol: memmove >>> defined at common.c >>> kasan/common.o:(memmove) in archive mm/built-in.a >>> defined at memmove.o:(__memmove) in archive arch/arm64/lib/lib.a ld.lld: error: duplicate symbol: memset >>> defined at common.c >>> kasan/common.o:(memset) in archive mm/built-in.a >>> defined at memset.o:(__memset) in archive arch/arm64/lib/lib.a Copy the exact way these are written in memcpy_64.S, which does not have the same problem. I don't know why this makes a difference, and it would be good to have someone with a better understanding of assembler internals review it. It might be either a bug in the kernel or a bug in the assembler, no idea which one. My patch makes it work with all versions of clang and gcc, which is probably helpful even if it's a workaround for a clang bug. Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann --- arch/x86/lib/memmove_64.S | 4 ++-- arch/x86/lib/memset_64.S | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/lib/memmove_64.S b/arch/x86/lib/memmove_64.S index 7ff00ea64e4f..dcca01434be8 100644 --- a/arch/x86/lib/memmove_64.S +++ b/arch/x86/lib/memmove_64.S @@ -26,8 +26,8 @@ */ .weak memmove -SYM_FUNC_START_ALIAS(memmove) -SYM_FUNC_START(__memmove) +SYM_FUNC_START_ALIAS(__memmove) +SYM_FUNC_START_LOCAL(memmove) mov %rdi, %rax diff --git a/arch/x86/lib/memset_64.S b/arch/x86/lib/memset_64.S index 9ff15ee404a4..a97f2ea4e0b2 100644 --- a/arch/x86/lib/memset_64.S +++ b/arch/x86/lib/memset_64.S @@ -19,8 +19,8 @@ * * rax original destination */ -SYM_FUNC_START_ALIAS(memset) -SYM_FUNC_START(__memset) +SYM_FUNC_START_ALIAS(__memset) +SYM_FUNC_START_LOCAL(memset) /* * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended * to use it when possible. If not available, use fast string instructions. -- 2.26.2