From nobody Sat Nov 23 17:40:15 2024 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 987C8155A5D for ; Tue, 19 Nov 2024 06:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731999435; cv=none; b=ed7auQyhzHRqgRA/9AM5y5pbwkNqkMvDx8fa1neYOR/gXoC4YiNQyfT88zMstpjf4KdRhhnVnSYeiLixMWzr3b3tDzVG+1M5GNwLTeRVkBXDmcD8vPFfj1WhCbvQuHcc2U7RwaSijgAjfC2fHisaWPgACJgstYnNmjKm7dCgSIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731999435; c=relaxed/simple; bh=hpEJE6452kJP+gGj5WwMyHNX5Dc1z8fXf0Rr7Lf363M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eqFzObHtKg1lX51Qoqn+tG2wtN8lY0Kmp+1t43r9z+xHxWHbP9xm3R4d8kqiIG4kfLivmsOOgPTc/uE2bkmGNDfmwTz2JVslYDbCb7w5nf0BZi+rPUwMZfijm7oBgqALgPuJM2/Dwz3gjC42fcNKcSbXnzMF8fRBBsS4+mG3Juc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxyuHHNjxnkjZCAA--.860S3; Tue, 19 Nov 2024 14:57:11 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowMCxDuG4NjxnB_5cAA--.5437S12; Tue, 19 Nov 2024 14:57:06 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Josh Poimboeuf , Peter Zijlstra Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 10/10] LoongArch: Enable jump table for objtool Date: Tue, 19 Nov 2024 14:56:55 +0800 Message-ID: <20241119065655.21123-11-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241119065655.21123-1-yangtiezhu@loongson.cn> References: <20241119065655.21123-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowMCxDuG4NjxnB_5cAA--.5437S12 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7uFWDuryUCw13Ww1kuryUJwc_yoW8Wr45pw s7Zr4kKw4kXF4vqrZrJrWSgrZ8trnrKr43WF429a4kArW7Z345Zr48ta9rW3WUCws5JrWI qFWfGa4avFWUJ3XCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9ab4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAF wI0_Gr1j6F4UJwAaw2AFwI0_Jrv_JF1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2 xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_ Wrv_ZF1lYx0Ex4A2jsIE14v26F4j6r4UJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2 Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAF wI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zV AF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Ar0_tr1l IxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF 4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsG vfC2KfnxnUUI43ZEXa7IU0zwZ7UUUUU== Content-Type: text/plain; charset="utf-8" For now, it is time to remove -fno-jump-tables to enable jump table for objtool if the compiler has -mannotate-tablejump, otherwise it is better to remain -fno-jump-tables to keep compatibility with the older compilers. Signed-off-by: Tiezhu Yang --- arch/loongarch/Kconfig | 3 +++ arch/loongarch/Makefile | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index bb35c34f86d2..500ee9b2cd88 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -284,6 +284,9 @@ config AS_HAS_LBT_EXTENSION config AS_HAS_LVZ_EXTENSION def_bool $(as-instr,hvcl 0) =20 +config CC_HAS_ANNOTATE_TABLEJUMP + def_bool $(cc-option,-mannotate-tablejump) + menu "Kernel type and options" =20 source "kernel/Kconfig.hz" diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index ae3f80622f4c..6b84e633b8ce 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -101,8 +101,12 @@ KBUILD_AFLAGS +=3D $(call cc-option,-mthin-add-sub) = $(call cc-option,-Wa$(comma) KBUILD_CFLAGS +=3D $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa= $(comma)-mthin-add-sub) =20 ifdef CONFIG_OBJTOOL +ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP +KBUILD_CFLAGS +=3D $(call cc-option,-mannotate-tablejump) +else KBUILD_CFLAGS +=3D -fno-jump-tables endif +endif =20 KBUILD_RUSTFLAGS +=3D --target=3Dloongarch64-unknown-none-softfloat KBUILD_RUSTFLAGS_KERNEL +=3D -Zdirect-access-external-data=3Dyes --=20 2.42.0