Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5393871rwb; Mon, 14 Nov 2022 04:09:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5QMQz78cEJSgFRXRzvIveKaOwKzOpF1+ylD0tucPzUOp8tONVOB922dQhh7K1S/g10BD/k X-Received: by 2002:a63:5554:0:b0:46f:7e1c:77be with SMTP id f20-20020a635554000000b0046f7e1c77bemr11749723pgm.32.1668427790853; Mon, 14 Nov 2022 04:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668427790; cv=none; d=google.com; s=arc-20160816; b=w2MqZAiHvyd0vTPGJy8gikug8V391FuvsA5Z7si6eWqFn9orUl08zPMVxhvjkxAOAU 62cVOBryDQbUDGBYWr6EH5hhXlbSOq1DfhkSYX2Q3nefu+xxqLAFHGVnks5TKsNH/a0M Ep0KKnnjCf8wcjP3NUn06L1JZ1wgehknPJIS7hy+YpV9Z1Yd2Xk0WwevI9qip2zTIin2 vRWfV2jyuhzZpcDokBuP1uNegxzn4vRCvCUTT6oRw/bAqkxIafoV631JR89mpeDI/MdG Cn39aDSi7cKv5qDpZwpbgr2Pp4QDwHckuVuzetE4p4UWcSrUrdAf8oH69gH5fyYEvNS0 FMgQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a634a53000000b00473e4d2c9e4si9382258pgl.218.2022.11.14.04.09.39; Mon, 14 Nov 2022 04:09:50 -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 + 88 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 Content-Transfer-Encoding: 8bit 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 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; -- 2.38.1