From patchwork Mon Nov 14 11:43:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097509wru; Mon, 14 Nov 2022 03:47:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf73j1hwlC5+D72Hr2PjDs330JkWZdf2oBl0fGvmNUixF9xNXcLu7eu7ABDfjmRJVGu352os X-Received: by 2002:a17:906:29d6:b0:7ad:b284:1357 with SMTP id y22-20020a17090629d600b007adb2841357mr10242153eje.149.1668426438903; Mon, 14 Nov 2022 03:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426438; cv=none; d=google.com; s=arc-20160816; b=IaqJLAZX0lci2FJ0jRbnHO0JP1JCg08UQxCvOO9wPeGEMgG7FYJabJvwKa5w+MImcB PfhQjVSHXyfOa9XDQTMzHEjO8W0Tg/EwQP8EhHzvC/Jk4wPDBii6GFbLgSg65qXCVHFi Rsli6rlurnmb2fEdfYS487pV/VV0z3uh+f0dYQzLFJtIpHOAJIY4Av6V2CKzgM+OM5GL QDG6xBu1RZaS5ZqDee6BKCvadHtmW5OgpfvYGTPkmqPm7TRGwrRNjWo9iopX8tGUX725 OuqxlWlbbiBH/aEnL5aHenZhbGKC/IIxdcHsD2qkUBF337HvkO6kVo3IMoXQNqzBnhhY s2XQ== 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=l9itMAHWD+AmLhvdGvFlrmw7rsop1qK9OCe8z9z2xZQ=; b=wyfkmkb+IVrTFKbBU6qBOA46IjfpaiI4eSnj4Nb+KGviVS4ZS97VA19gnTLpt33KHY 89PbDwUeKNLoR9BU2qmmOh0VrliD/JzXlNT1JUibPePbNCD3Hu09Q3+If+ofEmOGCaFV l3yXp6NgkNh9R7ond11E+9t5/HuTVLawM/8xn+N9eXC3NzBrEU4OQifu3SF3H1nwEYFr YfMD6ZXUItGA8+P7c4GpmttKbt4cfYXOvLylGbQOQ1iWG7BYuRJnpzmalKZRFo4N2OVc iIOJKhSQRqP/SdxKvxIhqy08k6owhELmEWXVPCs+E98+wmMTiR2mkmZe7TfYMjUz8HGw ISMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NVMO3KRk; 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 m14-20020a056402430e00b004675aeea9c5si8091671edc.553.2022.11.14.03.46.55; Mon, 14 Nov 2022 03:47:18 -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=NVMO3KRk; 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 S236700AbiKNLoy (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbiKNLoZ (ORCPT ); Mon, 14 Nov 2022 06:44:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E87821807 for ; Mon, 14 Nov 2022 03:44:18 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 170CC6106D for ; Mon, 14 Nov 2022 11:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8743BC433D7; Mon, 14 Nov 2022 11:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426257; bh=rN/KT1Epf0fvqNeXEc1oWJfGIaRJw5s06AqXjEWOiHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVMO3KRkZoQJ0VQ15+L8MX3UIZgB6LL180PhW7aAbxYsAXZOM3YZXmueMCaXNu3FE +tC8/fnpZwvQGQxMGr2LWQHorJ2d8P5C79kfc2FIlVi0md18cXDAZSyLuSvXEyQxcZ OaFpogWZTE0C+CdZ9ef90IfWCESKNhhnYrbRlQuYrRYCy5v3ggm2jwQ0eoXJ0m0AbP d+rNs7VkLxZwEjOfDXy6mJrLBxvZWtnM1gyERvo387/zZK/OcLiTH5DikylrNCXtgg fKxZsBnUGs90tFM0PiNwCscaye2ymTpjnLRT690iTuiLZDm7lcAw2CPEY1kV5jKzR/ JMxzRXbASSaEw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Martin Liska , Jiri Slaby Subject: [PATCH 10/46] static_call, lto: Mark func_a() as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:08 +0100 Message-Id: <20221114114344.18650-11-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?1749471921699286335?= X-GMAIL-MSGID: =?utf-8?q?1749471921699286335?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark func_a() as __visible_on_lto as it was static. [js] use __visible_on_lto Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: Jason Baron Cc: Steven Rostedt Cc: Ard Biesheuvel Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/static_call_inline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/static_call_inline.c b/kernel/static_call_inline.c index dc5665b62814..6933b4437597 100644 --- a/kernel/static_call_inline.c +++ b/kernel/static_call_inline.c @@ -501,7 +501,7 @@ early_initcall(static_call_init); #ifdef CONFIG_STATIC_CALL_SELFTEST -static int func_a(int x) +__visible_on_lto int sc_func_a(int x) { return x+1; } @@ -511,7 +511,7 @@ static int func_b(int x) return x+2; } -DEFINE_STATIC_CALL(sc_selftest, func_a); +DEFINE_STATIC_CALL(sc_selftest, sc_func_a); static struct static_call_data { int (*func)(int); @@ -520,7 +520,7 @@ static struct static_call_data { } static_call_data [] __initdata = { { NULL, 2, 3 }, { func_b, 2, 4 }, - { func_a, 2, 3 } + { sc_func_a, 2, 3 } }; static int __init test_static_call_init(void)