Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1803489pxb; Tue, 26 Oct 2021 16:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweVTMRGDLXpJC3htyj0p40cZkh2V3IoJmD3VP6Ig7jN3HTOa+ldoDvj5s+GfQBydkv6I82 X-Received: by 2002:a17:902:6847:b0:141:56df:ad7e with SMTP id f7-20020a170902684700b0014156dfad7emr5379057pln.82.1635291259747; Tue, 26 Oct 2021 16:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635291259; cv=none; d=google.com; s=arc-20160816; b=I4Ai9w1Gh6bV8IMT+4u8DI+pd/a/UGvaG7rlwf3y4uZO8cotXlPEiU7wYt58iUwEbr DOZsOKxLG4YkcKs9hcnI1M0uXNOTpVtKCPiB7Zmzdl9AB2yJYASy4BW4t66Fxm1IADSv iXXBwUA/FckMAKkTIBte/pzF+gmhEeudmjBx+K65A85E+NUBzzW6hVQsPyq95THs8Sl9 dRK9blwSbswJBrKO+MSVqFj8kPRFFz/RTSn9/L3DQm9CHiw3n+Q1Zdcl/oe1Yujdyem4 OioZ8Uvva4fypMnNQAjybKUonkTn5RyxgOCNe9MeVwV4txNuAdvBvNYjAppQ5Y9y35lx 6CAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=rfabjF10BHh+YUicda3qEwSCyGOM19442lVngTa5dW8=; b=Qmuh/1k8s3+N0gCJH/ZSsA3YKuYHK2MbyICgxyRKQy7YQfymAH7Vn1S6wJi2xEMbsV M9MqagRlmPdznQAZya2sxo4Mu/TqXwjLDMc6/w07o26IHPZg/tJRZHiNN9+LaOqzv3XH yBXkMGI4g3PhqR8eRfOcg2duTI6X+iS5r48mkXBURs4IqzPGu5B/46mesFJ1B2wrIhn8 dpCbLdw+R3OXRLM77FzOze92ID1h6O7R3CKiv7Ncsuuw/1kmrhgT5f0prxx31sJAZEYq ehTfDgNDTBcddKwu2u7OLnN8rBz7KR9So0ZBSFtDidJoKMo61wMxNeBpUOysu63dP1P5 eNbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si7256083pgb.60.2021.10.26.16.33.55; Tue, 26 Oct 2021 16:34:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236322AbhJZQ0k (ORCPT + 99 others); Tue, 26 Oct 2021 12:26:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:42286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234647AbhJZQ0O (ORCPT ); Tue, 26 Oct 2021 12:26:14 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BC74610E6; Tue, 26 Oct 2021 16:23:50 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.95) (envelope-from ) id 1mfPEr-000qSt-By; Tue, 26 Oct 2021 12:23:49 -0400 Message-ID: <20211026162349.204017174@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 26 Oct 2021 12:23:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org Subject: [for-next][PATCH 10/12] ftrace/sh: Add arch_ftrace_ops_list_func stub to have compressed image still link References: <20211026162315.297389528@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "linux-sh@vger.kernel.org" Using the linker script to fix an issue where some archs call the function tracer with just the ip (instruction pointer) and pip (parent instruction pointer) where as more up to date archs also pass in the associated ftrace_ops and the ftrace_regs pointer, the generic code will be called either with two parameters or four. To avoid any C undefined behavior of calling two parameters to four or four to two parameter function, two functions are created, where a preprocessor macro uses the one that matches the architecture. As the function pointers for them may be different, a typecast is used. But this triggers issues with newer compilers that will fail due to -Werror. A linker trick is now used to map the generic function to the function that is used (note the generic function is only used to set the default function callback). The linker trick defines ftrace_ops_list_func (the generic function) to arch_ftrace_ops_list_func (the arch defined one). Link: https://lore.kernel.org/all/20200617165616.52241bde@oasis.local.home/ But this fails sh arch because their linker script is included in their compressed image that does not define arch_ftrace_ops_list_func at all sh4-linux-ld:arch/sh/boot/compressed/../../kernel/vmlinux.lds:32: undefined symbol `arch_ftrace_ops_list_func' referenced in expression Included a stub by that name in the misc.c to allow the code to compile and link, even though it's not used. This is similar to what was done for ftrace_stub: b83b43ffc6e4b ("fgraph: Fix function type mismatches of ftrace_graph_return using ftrace_stub") Link: https://lkml.kernel.org/r/20211021221627.5d7270de@rorschach.local.home Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Signed-off-by: Steven Rostedt (VMware) --- arch/sh/boot/compressed/misc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c index a03b6680a9d9..ca05c99a3d5b 100644 --- a/arch/sh/boot/compressed/misc.c +++ b/arch/sh/boot/compressed/misc.c @@ -115,6 +115,9 @@ void __stack_chk_fail(void) void ftrace_stub(void) { } +void arch_ftrace_ops_list_func(void) +{ +} #define stackalign 4 -- 2.33.0