From patchwork Fri Oct 28 14:33:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathvika Vasireddy X-Patchwork-Id: 12361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp870677wru; Fri, 28 Oct 2022 07:44:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WK5KYPKJ4fFj7YK06xg4y/i139FB5bpe60SWlBWYA5kf4OHDPX/4hbcSq5CKMEVB9MDHS X-Received: by 2002:aa7:d458:0:b0:45b:ddbf:39fa with SMTP id q24-20020aa7d458000000b0045bddbf39famr51858705edr.335.1666968240403; Fri, 28 Oct 2022 07:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666968240; cv=none; d=google.com; s=arc-20160816; b=Tq8Kh6k9J9riIzNJQF5oFZyNaYjbJcHtR++/mEfY5rD/0ymbvDSia+BEb4/4UPll4x sO1+awLY1zghQsxWlcg1KySA13sUkD0r7epFGwAmS7nPZzA869IMQ8MIkLHCeQ2zmYkX hYX7f/lJH00rkI0nUdcI63iiCUZjZEoEMTRmxgez0pWdpdnQgQJIwMJre9uvuAC7+DDN 4gpFV3a48mDnZydJnt+O91xmmB+BLWokhZ+nd2FZJ/ekCrzqMJC+SR3ztZJlskKCfnN0 bvmGVeBTcNckTmb9l3e+i615H4N3IKyThSI8iEXFRRjE1gJb35mk1UEKBobphcrsYx/B WKMw== 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=nDWq7QQBOjmjtNDRoBo0bB4ENp6TlGvH17dZAulBXEs=; b=dHy40LHN+U8aJX05F1GRhOrPcQxmM3t5107t0J+7wHFlqYkKgDz47gNKp0RiGqLAZV 7ky5jif7J8opqZb15kffcdpbiYaWl1EkwDkS3aNas9N6P5MJrYwuxYPK8uBpMgK9WQ5o IDyU5CXGVN9jaWWMAHwb6HoyuxFR7LA3lRV62Ttye+UX8sCwt4UofuwzTxb9AcxlME3l iFYUIOQmOMXrQjJGEnsd6fXoZ5Cs7uFEhFqYh9N1peUKMrfIOkqMEg7nfqYE63fpB08e 7yKaR4k7Kx71NMuJNHhXAB80fh8pOAdHs7I+2rTp2ljbsfBsP02kTyM8gvof9h48zxU8 Jhvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=O6RNuug3; 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=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa15-20020a170907868f00b007826e727aeasi4960719ejc.44.2022.10.28.07.43.36; Fri, 28 Oct 2022 07:44:00 -0700 (PDT) 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=@ibm.com header.s=pp1 header.b=O6RNuug3; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbiJ1Ogc (ORCPT + 99 others); Fri, 28 Oct 2022 10:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiJ1OgD (ORCPT ); Fri, 28 Oct 2022 10:36:03 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 769A01A652C for ; Fri, 28 Oct 2022 07:35:41 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29SEXave028867; Fri, 28 Oct 2022 14:35:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=nDWq7QQBOjmjtNDRoBo0bB4ENp6TlGvH17dZAulBXEs=; b=O6RNuug3U18UddF5ILD+TQ5eGHM1oWAOw+3o9xJWOfkuwHE4JDmySAvtVUs95tF5y6Re kY44vmqnln8SwCKEPVA5vPtmWZe6aChnFjDQF5QmrWF5Nk6es+H9UsG+PNC6iyNHR4iR 4lN6oXUFnJGMGCyWzhTMqjF71qubRau+MFewuHPA9CbpK557ParjdG/IxYtCcd6WfyDm ZpEAI7888nRzlec0J+b4IHxxOhGg4RZTbYD2BJNapNXA5dNBHSxGs4p21AIUDvcpSnI7 ZpExcKAFUWHP0TkP6sUjTrXOE8G1eNNj3RmJj6EiUZirBK+pesoSgn9m22DNj0WYw6AJ BQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgfhnu8f7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 14:35:26 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29SEBprc004822; Fri, 28 Oct 2022 14:35:25 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgfhnu8bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 14:35:25 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29SEKj2e019352; Fri, 28 Oct 2022 14:35:23 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma02fra.de.ibm.com with ESMTP id 3kfahmjqg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 14:35:22 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29SEU1GR45679070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Oct 2022 14:30:01 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83AC6A4040; Fri, 28 Oct 2022 14:35:20 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24CD3A404D; Fri, 28 Oct 2022 14:35:16 +0000 (GMT) Received: from li-c3569c4c-1ef8-11b2-a85c-ee139cda3133.ibm.com.com (unknown [9.43.124.163]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 28 Oct 2022 14:35:15 +0000 (GMT) From: Sathvika Vasireddy To: linuxppc-dev@lists.ozlabs.org Cc: jpoimboe@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, aik@ozlabs.ru, mpe@ellerman.id.au, mingo@redhat.com, christophe.leroy@csgroup.eu, rostedt@goodmis.org, mbenes@suse.cz, npiggin@gmail.com, chenzhongjin@huawei.com, naveen.n.rao@linux.vnet.ibm.com, sv@linux.ibm.com Subject: [PATCH v5 14/16] objtool: Add arch specific function arch_ftrace_match() Date: Fri, 28 Oct 2022 20:03:44 +0530 Message-Id: <20221028143346.183569-15-sv@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221028143346.183569-1-sv@linux.ibm.com> References: <20221028143346.183569-1-sv@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: OsP0QYMPOHDEYOQk1x_o7X6plWKyUhzP X-Proofpoint-ORIG-GUID: LZPfi1tO8ZWsmddfLIShKzPThJ4Kc3jr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-28_07,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210280090 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,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?1747942889533043680?= X-GMAIL-MSGID: =?utf-8?q?1747942889533043680?= Add architecture specific function to look for relocation records pointing to architecture specific symbols. Suggested-by: Christophe Leroy Tested-by: Naveen N. Rao Reviewed-by: Naveen N. Rao Reviewed-by: Christophe Leroy Acked-by: Josh Poimboeuf Signed-off-by: Sathvika Vasireddy --- tools/objtool/arch/x86/decode.c | 5 +++++ tools/objtool/check.c | 2 +- tools/objtool/include/objtool/arch.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index 1c253b4b7ce0..af7ad09c926c 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -23,6 +23,11 @@ #include #include +int arch_ftrace_match(char *name) +{ + return !strcmp(name, "__fentry__"); +} + static int is_x86_64(const struct elf *elf) { switch (elf->ehdr.e_machine) { diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2d7153b5d5d1..7580c66ca5c8 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2316,7 +2316,7 @@ static int classify_symbols(struct objtool_file *file) if (arch_is_rethunk(func)) func->return_thunk = true; - if (!strcmp(func->name, "__fentry__")) + if (arch_ftrace_match(func->name)) func->fentry = true; if (is_profiling_func(func->name)) diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h index beb2f3aa94ff..5149330f400f 100644 --- a/tools/objtool/include/objtool/arch.h +++ b/tools/objtool/include/objtool/arch.h @@ -69,6 +69,8 @@ struct stack_op { struct instruction; +int arch_ftrace_match(char *name); + void arch_initial_func_cfi_state(struct cfi_init_state *state); int arch_decode_instruction(struct objtool_file *file, const struct section *sec,