From patchwork Mon Nov 14 11:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098627wru; Mon, 14 Nov 2022 03:50:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4IE9EIbXpJc279RZlcSpqcLatMMtfa5L7HfoJzVTeN1dPKpPT8p8c28WMDRIwoDaoMDiJB X-Received: by 2002:a17:907:c94:b0:78d:b8ab:9a5a with SMTP id gi20-20020a1709070c9400b0078db8ab9a5amr9925528ejc.454.1668426627001; Mon, 14 Nov 2022 03:50:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426626; cv=none; d=google.com; s=arc-20160816; b=kUELaxhX5+ndAivyTkaKIMLD/Nx2IkFlmQfNj0HimgjO1pt9Z27fdTkTPk3nPvFhiy 9RFzaqw6OsbrweLn0IdvkiS/D6jUEzxN5sHKTMGmIHxCiMuAgePsVDo96L3Ar43rMYfh /lvdl8iK2ad5f4sKEw1yzBDVqBS558NDwWjECU8Gm32pw4phnNZ8DuUsbbI7exoQTbLU EmsZcCCnShj+7gWuBOKQn0vtZrtx7y0T9uv/3RAppcQBtKaeTN0mgtJeVQXLW+71Tl5M te/vtB/2Bn9rmG8Iw7z74Nek7qBd88QSBN/p6ld4b8UgKtGcg6nhJAKvfn0D5yxY9rcf XZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WPBU7UxL6LPnR5x/J5PrEh4xEFZt/PbTMPnv6dZIqf0=; b=WS6uGYMWiGx32AuU6S7Jhjkf+IDldvKA/BEfqAGMZ3NiP8cJi6MUYyQBEiHtttt0Xq K2G18BiIb/xBVXs/qryf0VlMokYmp86qS0pohBsYhXgdorbYE+dCbhVrBFz59j046bkh bZAwvUl3c8iyYUvZL9WhvOktHBiBJWvfMpNOVOp06NDk5IyBHSWh7KCE0Nqn/4r2hApF j6EetvSgcy2rcKb0yu8pX7w4mdqLwdy8vF2wd9d4SpGU/za87JMwdcreQrTF9efuwU3C 7rLMF+xIkc2T0EHm0k+AR4w1RlbdRNIhWyrugGY65bz3+yNAilw48/Cg91gn3jerPKYN TNwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z56jXBWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du2-20020a17090772c200b007aedb84056csi4806688ejc.718.2022.11.14.03.50.02; Mon, 14 Nov 2022 03:50:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z56jXBWI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236830AbiKNLsx (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbiKNLsK (ORCPT ); Mon, 14 Nov 2022 06:48:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8415264BF for ; Mon, 14 Nov 2022 03:45:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72A66B80E78 for ; Mon, 14 Nov 2022 11:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9976C433D7; Mon, 14 Nov 2022 11:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426337; bh=VYQURovUo97zO8sJmHkHAsr8KxvRG48y3FQbb9I2wLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z56jXBWIsBXBUMabvHqQKKRnY5i9Yvn3pWB+MImH0iB9rNmtARnU/nYhyOp87J2KY ml3vFdOHGOQgMiMSvx5Mk9jDreX5NOGSklPB09RpuPYi+6TENrcT7e60VFQGSmIUnR 3LKqf5Jt4rbq42rrcKS6/ItDLaLySbMldOWP6LlnQs755cD5K9NsUQaLQN9y1Hq8Qa ntYAvZPVESwrDLyh1XRFO6i3Cd2GeaSSmag4Fhiys6xEuadykc9BW7b3Vt3njgjZbX 5xCxKCBLPRNrwm7FWVhhsk+4CZhs9ltA6UF4Nnmd7n16b/JKDFvmZ10Qakl4qVQnv5 8u7O4bFsjNrJw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 41/46] x86/lib, lto: Mark 32bit mem{cpy,move,set} as __used Date: Mon, 14 Nov 2022 12:43:39 +0100 Message-Id: <20221114114344.18650-42-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472118661164895?= X-GMAIL-MSGID: =?utf-8?q?1749472118661164895?= From: Andi Kleen gcc doesn't always recognize that memcpy/set/move called through __builtins are referenced because the reference happens too late in the RTL expansion phase. This can make LTO to drop them, leading to undefined symbols. Mark them as __used to avoid that. This is only needed on 32bit, on 64bit they're assembler anyways. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/lib/memcpy_32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c index ef3af7ff2c8a..53fa1cac79d1 100644 --- a/arch/x86/lib/memcpy_32.c +++ b/arch/x86/lib/memcpy_32.c @@ -6,19 +6,19 @@ #undef memset #undef memmove -__visible void *memcpy(void *to, const void *from, size_t n) +__used __visible void *memcpy(void *to, const void *from, size_t n) { return __memcpy(to, from, n); } EXPORT_SYMBOL(memcpy); -__visible void *memset(void *s, int c, size_t count) +__used __visible void *memset(void *s, int c, size_t count) { return __memset(s, c, count); } EXPORT_SYMBOL(memset); -__visible void *memmove(void *dest, const void *src, size_t n) +__used __visible void *memmove(void *dest, const void *src, size_t n) { int d0,d1,d2,d3,d4,d5; char *ret = dest;