Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp879579pxb; Wed, 27 Oct 2021 14:20:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9G6PwO0q+xIG37feghd9oXEn93YQSBPUpEQkytMbwvizkfcB5EQlnTJH1cnwTQRI0ng5Z X-Received: by 2002:a50:e142:: with SMTP id i2mr402295edl.159.1635369643536; Wed, 27 Oct 2021 14:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369643; cv=none; d=google.com; s=arc-20160816; b=VJj5Got5QqcyZ4oOW//2BHDRLVe0a50PhcbXbrbAanG08dcBwUlYwIQ9OhMXm2he1y 6qku/tfYe1/N5tVk/KbHz92i8CKpv+DJ4clOnfSinaIrOiQQgiCz2s4hHobdodlI5JOL VbZTPplYSN3kPOlnXfgGFo/M6xum4MJF2JSREqH9T5FslRh9I4LOTu/BSCZCNOZOmpNj ggKkPmVPz/RFmu/psGp4ugH2+/Gie201GOmMS+8C23A/9Vavb6Mx7U0lHAMshsUs8RKt CL+WBIuqddBdZdVE5X2T7OTc9cn4YsNsMhQec26yL6CteUZrS5qU47mIpiH2G3Nf3nyw IpFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-filter; bh=6FRFyRTnv0YMoCT5eCHTBFTGoY6sOVRveIdmifjnKME=; b=luWrNVkh+UnnDvJFT5Ch+xJZ+ozOYZhFmrbrf0DZgjvmbwnJJ8xP4BTEy6WSH3cfUH ghBzYFanw2T4PfBbj1dZBtZKvRMcuOlC/8YVa91WrlRtaeRWdvyhh/JNY05/kPrBgguG A9hc97AeBUjZ5HyOQ5N/1U5jcLuR1iUn7IJsQYxelxCfl3ukZr+Zlq9u2s1KXezeDDEq cIy6qVoMyvmjtDLfKw2zLxUxFGHbGz7ml4LUC4jbSnaiNDfazrb18I+EjdI+xebQUheL yjNeyKEa1nuPAkBNmkJG6hLSVNFk8LAx4ss13NBaiMmvfa/2SBIeW9b5jN4eDGKc9EdQ 0pdA== 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 nc2si1459743ejc.725.2021.10.27.14.20.20; Wed, 27 Oct 2021 14:20:43 -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 S241125AbhJ0JBF (ORCPT + 97 others); Wed, 27 Oct 2021 05:01:05 -0400 Received: from mxout01.lancloud.ru ([45.84.86.81]:46980 "EHLO mxout01.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241123AbhJ0JBE (ORCPT ); Wed, 27 Oct 2021 05:01:04 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru B793F20DE16B Received: from LanCloud Received: from LanCloud Received: from LanCloud Message-ID: <95ac8344-ff8c-d66f-00c7-06c43a61fca3@omp.ru> Date: Wed, 27 Oct 2021 11:58:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [for-next][PATCH 10/12] ftrace/sh: Add arch_ftrace_ops_list_func stub to have compressed image still link Content-Language: en-US To: Steven Rostedt , CC: Ingo Molnar , Andrew Morton , Yoshinori Sato , Rich Felker , References: <20211026162315.297389528@goodmis.org> <20211026162349.204017174@goodmis.org> From: Sergey Shtylyov Organization: Open Mobile Platform In-Reply-To: <20211026162349.204017174@goodmis.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.10.2021 19:23, Steven Rostedt wrote: > From: "linux-sh@vger.kernel.org" Collective author, really? :-) > 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) [...] MBR, Sergey