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=-6.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 002C3C433DF for ; Wed, 27 May 2020 18:28:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1B0C20890 for ; Wed, 27 May 2020 18:28:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CSfBTkf/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="s5sgK5hV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1B0C20890 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KxumxuT68cHvDKOa/mbA/gEjpg83HIhsFxy4SZ0N1Rs=; b=CSfBTkf/XcGkJIygYJAXRuYfS myUkLyTnRlBvklr6JnUKtRouGN11u/hgkw0tGJtOjEkKgppQnV3eLjvDFEuIwCCQG48aBvGV/U1Cs XU9R2jmwzMptaRNJSjXp+OUQOHzRwvZu3SA6ujtOsPoIoenWWHq8F+RcEjjmqpvUyeEe96dpZLm4y v3WOHFDbn4pLNM3lQn/NwMgLAWpir7N8pDt9g5LdgTBqbY4i+daJxRz3I5ITkm6+C48uH6AQw6kAb VeoG7fZ6ETzJH6gaQJZP7evzSkFpZBtW8FUNB/4QKzV+ba0/kugXoIpw/3NZwQ+gv0ggXYE2oJTVB DxK44afBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1je0nQ-0003uq-Er; Wed, 27 May 2020 18:28:56 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1je0nN-0003tv-JG for linux-arm-kernel@lists.infradead.org; Wed, 27 May 2020 18:28:55 +0000 Received: by mail-pf1-x443.google.com with SMTP id g5so726487pfm.10 for ; Wed, 27 May 2020 11:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iA+KkSp+x1pCOvFG2laI62cGHgeFrOqb4fOzsNTxNXU=; b=s5sgK5hVj6s8lKi3Rri8hD77o4Tgsh/f//XKeSLPPL6IoaX/9mCJYEHRJ32vVuTTGB dFOJ6DX54r/GDHqGsERVaSkKn7VZP6w7vmoq01S+s7Vgp4NCjhtVzBjBz/ibFnvGcWta mSfHvumiHewYuXpM4XZwLfp01LJYUKENxLfVUkXnOtA0BezWqdmG+dG9FruFxrFvx+z0 OLSDlugaSodJcE0avHyTiDxelPvs1YxJU3Ddg4TK5lzP7IpA32ZcQqmyQOKAlpQDiDDP fF30dP0+KbJyDOf08di6glcZut8WphRJqfLPENPijbkDbzZ6pcV6gQGYyCj6OH9Rd9v6 fRqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iA+KkSp+x1pCOvFG2laI62cGHgeFrOqb4fOzsNTxNXU=; b=YoLr0iCtPRG40eE1lsi74Dc/IPbRPSBNzJqSMAP0xnMXZKAwjZFGVXRLhI2YTVYCof TSbGS8BYDiEZvUKaSf8tdMec86H+TkbvZzeRHVsjErrGD+0HZ88VKEZ1izUEinH7Pmzd CaCBlwQB5A/swToqQD6zrr0WFzvTtVsa/lRFDtpPZV7v2zWeCHZEWe++DX6BgZXLz4BX aO6w/00aE8kACWutPEe+5GnKt7pU2Kp0ZHw+qdwUczKM6LYw/vjRFQwRQaVjUluxItgH jy1MELPcNlv/ef2u8sii8WK/nSlwV0OmWWcnLzSQed1DayTatzSYbgN8/MqpuLCxBTHu 8GUw== X-Gm-Message-State: AOAM53116gwEUpRR8kVxHFVaFTiOIFljiJxZc0b+qP5SHbMKs/odCYz0 exJu9rLoQE7xMVGKwV9G2apw1Q== X-Google-Smtp-Source: ABdhPJy79EBrfQSWmv0ROoxKkjCOvcXwdJtlDQLwN27cdTeaTy6nksFR7zHfbpPjZAN2LXNgjfyAZw== X-Received: by 2002:a63:e008:: with SMTP id e8mr5139090pgh.451.1590604128900; Wed, 27 May 2020 11:28:48 -0700 (PDT) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id z8sm2517225pgc.80.2020.05.27.11.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 11:28:48 -0700 (PDT) Date: Wed, 27 May 2020 11:28:43 -0700 From: Fangrui Song To: Nick Desaulniers Subject: Re: [PATCH] arm64: fix clang integrated assembler build Message-ID: <20200527182843.g6tbow4lqsvwl2ah@google.com> References: <20200527141435.1716510-1-arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_112853_657839_08FEEC27 X-CRM114-Status: GOOD ( 21.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Will Deacon , clang-built-linux , Catalin Marinas , LKML , "# 3.4.x" , Jian Cai , Alexios Zavras , Bill Wendling , Enrico Weigelt , Linux ARM Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-05-27, 'Nick Desaulniers' via Clang Built Linux wrote: >On Wed, May 27, 2020 at 7:14 AM Arnd Bergmann wrote: >> >> clang and gas seem to interpret the symbols in memmove.S and >> memset.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. > >+ Bill, Fangrui, Jian >I think we saw this bug or a very similar bug internally around the >ordering of .weak to .global. This may be another instance of https://sourceware.org/pipermail/binutils/2020-March/000299.html https://lore.kernel.org/linuxppc-dev/20200325164257.170229-1-maskray@google.com/ I haven't checked but there may be both a .globl directive and a .weak directive >> Cc: stable@vger.kernel.org >> Signed-off-by: Arnd Bergmann >> --- >> --- >> arch/arm64/lib/memcpy.S | 3 +-- >> arch/arm64/lib/memmove.S | 3 +-- >> arch/arm64/lib/memset.S | 3 +-- >> 3 files changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S >> index e0bf83d556f2..dc8d2a216a6e 100644 >> --- a/arch/arm64/lib/memcpy.S >> +++ b/arch/arm64/lib/memcpy.S >> @@ -56,9 +56,8 @@ >> stp \reg1, \reg2, [\ptr], \val >> .endm >> >> - .weak memcpy >> SYM_FUNC_START_ALIAS(__memcpy) >> -SYM_FUNC_START_PI(memcpy) >> +SYM_FUNC_START_WEAK_PI(memcpy) >> #include "copy_template.S" >> ret >> SYM_FUNC_END_PI(memcpy) >> diff --git a/arch/arm64/lib/memmove.S b/arch/arm64/lib/memmove.S >> index 02cda2e33bde..1035dce4bdaf 100644 >> --- a/arch/arm64/lib/memmove.S >> +++ b/arch/arm64/lib/memmove.S >> @@ -45,9 +45,8 @@ C_h .req x12 >> D_l .req x13 >> D_h .req x14 >> >> - .weak memmove >> SYM_FUNC_START_ALIAS(__memmove) >> -SYM_FUNC_START_PI(memmove) >> +SYM_FUNC_START_WEAK_PI(memmove) >> cmp dstin, src >> b.lo __memcpy >> add tmp1, src, count >> diff --git a/arch/arm64/lib/memset.S b/arch/arm64/lib/memset.S >> index 77c3c7ba0084..a9c1c9a01ea9 100644 >> --- a/arch/arm64/lib/memset.S >> +++ b/arch/arm64/lib/memset.S >> @@ -42,9 +42,8 @@ dst .req x8 >> tmp3w .req w9 >> tmp3 .req x9 >> >> - .weak memset >> SYM_FUNC_START_ALIAS(__memset) >> -SYM_FUNC_START_PI(memset) >> +SYM_FUNC_START_WEAK_PI(memset) >> mov dst, dstin /* Preserve return value. */ >> and A_lw, val, #255 >> orr A_lw, A_lw, A_lw, lsl #8 >> -- >> 2.26.2 > >-- >Thanks, >~Nick Desaulniers > >-- >You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. >To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. >To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/CAKwvOdnNxj-MdKj3aWoefF2W9PPG-TSeNU4Ym-N8NODJB5Yw_w%40mail.gmail.com. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel