Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3979501rdb; Wed, 30 Aug 2023 11:36:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEs4JUoX8zMHC+/SVgJYcocUNNAqWtsE40YMah5nW6p9bLH+IrV9JD87+WSr2EHULn763Xi X-Received: by 2002:a05:6a00:24cd:b0:68a:4261:ab7f with SMTP id d13-20020a056a0024cd00b0068a4261ab7fmr3605005pfv.31.1693420571031; Wed, 30 Aug 2023 11:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693420571; cv=none; d=google.com; s=arc-20160816; b=AsnK0Xu9VMs5vxAjfg16kg5ZYB06ds72ukFaCvrVEISJGxapnFIq+Ab8dKJYYkaBte UxKEkFxa6aGqL6tbdEqepqCkWQ4blloCCsFsKg1Nhb5XKxrNawVlLDGhX93asz15V2ty HY9J/hiEL+tW2CWB6uZuReYHUBKf/ZaEZUVITHc8tp0GENBUBgTZh88HF2wIy/nWT7Y2 bWJQaM6Bt6d61GeO8MQJ0sA60UJdzP9FnPwPHHJomoGAFDqf7nv8issLvynBMoKbxqN+ 4K1LjseJVvvS6IK0AlkrMjkZYaB6I4YyJDyIjPP7j8Y4n9rUxki+Mw25nzjBglzaLmpZ AQpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=6Hpr02zXMlLfHZiIRb/i0+0Uz0fssjZrTfmivpYTdZM=; fh=NSlpVmp9/EqeSZuKfEjg6u7FbKTTBBKQRa+lb1eLM7c=; b=g/n1xEGdCxl4UYYy3ZdNJXxlax5QGJ9gMkBh/FCMA3E3E8NbzatJDduf2bZkYOStgz KtwAcxEHxBai5xxvP4XMBSKMlLiG2WqwUoSPehkkk/NVmNOV7wEGyjExOQEUu1iJyz23 lxUX1JU2XtgRahOuB6LsUZU8peTs+EDWSeY72ZkkXJeHPdwIqj/N2pn03E/0GkcnV3lK BG38kpHGNsWj9QQV/dlWYajcgiO0lLMqJ0QBcc6tWGaOOWK/oguC2jS7EejTDB0wM3nb KJrv3s5H0s/0vmWA1mfLB2GngFI2LtGvIWjNvz5DoxkpVP8N9+l8M9dqgUlNxDizRiBp 6RXQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a056a001a8600b0068bf51ef9c4si13544101pfv.389.2023.08.30.11.35.57; Wed, 30 Aug 2023 11:36:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241778AbjH3Cr3 (ORCPT + 99 others); Tue, 29 Aug 2023 22:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239186AbjH3CrS (ORCPT ); Tue, 29 Aug 2023 22:47:18 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE6B2CC for ; Tue, 29 Aug 2023 19:47:14 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxlPCxre5kWPccAA--.59157S3; Wed, 30 Aug 2023 10:47:13 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx5sywre5kHOpmAA--.32250S2; Wed, 30 Aug 2023 10:47:13 +0800 (CST) From: Tiezhu Yang To: Huacai Chen Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] LoongArch: Define the symbol fault as a local label in fpu.S Date: Wed, 30 Aug 2023 10:47:07 +0800 Message-Id: <1693363627-10197-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Dx5sywre5kHOpmAA--.32250S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZF4ftF1fKw4rJw1UXFy7urX_yoW5Zw1rpF yUZrWvgr4rW3Z7Aanrtw4v9rW5Ga9rGF47u3WqyrWxCFWjv3WDta18tryDXF12qa15JF10 qF4FqrWYq3Wqy3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1WlkUUUUU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 The initial aim is to silence the following objtool warnings: arch/loongarch/kernel/fpu.o: warning: objtool: _save_fp_context() falls through to next function fault() arch/loongarch/kernel/fpu.o: warning: objtool: _restore_fp_context() falls through to next function fault() arch/loongarch/kernel/fpu.o: warning: objtool: _save_lsx_context() falls through to next function fault() arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lsx_context() falls through to next function fault() arch/loongarch/kernel/fpu.o: warning: objtool: _save_lasx_context() falls through to next function fault() arch/loongarch/kernel/fpu.o: warning: objtool: _restore_lasx_context() falls through to next function fault() Currently, SYM_FUNC_END() defines the symbol fault as SYM_T_FUNC which is STT_FUNC, the objtool warnings are generated through the following code: tools/objtool/include/objtool/check.h static inline struct symbol *insn_func(struct instruction *insn) { struct symbol *sym = insn->sym; if (sym && sym->type != STT_FUNC) sym = NULL; return sym; } tools/objtool/check.c static int validate_branch(struct objtool_file *file, struct symbol *func, struct instruction *insn, struct insn_state state) { ... if (func && insn_func(insn) && func != insn_func(insn)->pfunc) { ... WARN("%s() falls through to next function %s()", func->name, insn_func(insn)->name); return 1; } ... } We can see that the fixup can be a local label in the following code: arch/loongarch/include/asm/asm-extable.h .pushsection __ex_table, "a"; \ .balign 4; \ .long ((insn) - .); \ .long ((fixup) - .); \ .short (type); \ .short (data); \ .popsection; .macro _asm_extable, insn, fixup __ASM_EXTABLE_RAW(\insn, \fixup, EX_TYPE_FIXUP, 0) .endm Like arch/loongarch/lib/*.S, just define the symbol fault as a local label in fpu.S. Before: $ readelf -s arch/loongarch/kernel/fpu.o | awk -F: /fault/'{print $2}' 000000000000053c 8 FUNC GLOBAL DEFAULT 1 fault After: $ readelf -s arch/loongarch/kernel/fpu.o | awk -F: /fault/'{print $2}' 000000000000053c 0 NOTYPE LOCAL DEFAULT 1 .L_fixup_fpu_fault Co-developed-by: Youling Tang Signed-off-by: Youling Tang Signed-off-by: Tiezhu Yang --- There is a same issue in lbt.S, Huacai suggested to squash the changes in the original patch: "LoongArch: Add Loongson Binary Translation (LBT) extension support" arch/loongarch/kernel/fpu.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/loongarch/kernel/fpu.S b/arch/loongarch/kernel/fpu.S index b4032de..3177725 100644 --- a/arch/loongarch/kernel/fpu.S +++ b/arch/loongarch/kernel/fpu.S @@ -22,7 +22,7 @@ .macro EX insn, reg, src, offs .ex\@: \insn \reg, \src, \offs - _asm_extable .ex\@, fault + _asm_extable .ex\@, .L_fixup_fpu_fault .endm .macro sc_save_fp base @@ -521,7 +521,6 @@ SYM_FUNC_START(_restore_lasx_context) jr ra SYM_FUNC_END(_restore_lasx_context) -SYM_FUNC_START(fault) +.L_fixup_fpu_fault: li.w a0, -EFAULT # failure jr ra -SYM_FUNC_END(fault) -- 2.1.0