From nobody Fri Dec 19 07:03:45 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC19117C8D for ; Sat, 7 Dec 2024 01:59:25 +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=1733536768; cv=none; b=Ole7qDhk+W/z6w6SPAdDr9qa9KTVKtKKCUanineJlEg37Pm+6rh7RZRZjPNyP4La/7UFK1eaaPwJ6lxsdy97ftcH+eAEMQeMHSe32q/uWxhtrfmrdGNckqWU5Akluv79kYj1oA3oS8XJT8f8ajmGfuHdL7QbXIHU2DgX56zzfVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733536768; c=relaxed/simple; bh=eeYgVDaOUpgFXQ4u/yte0mm/eHnqyND2grkL94d+lvw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KJeSvGKE5kK1e7XRC3bAe3UTxwxAXD5Pfc+2+UePSzWoIjwBDDV5kos98ZrhMN9d6cKbMs2j2RtkZOHqoP/r5MeNM8jpQmINzkM7SL81rsqkYfaYBSS01o26rmmQSmrDIaSgO+bZ/aY9Wn6j0+SBezTuYV9H21A16i7PO9zgQm8= 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 _____8BxIK_7q1NnHq1SAA--.5749S3; Sat, 07 Dec 2024 09:59:23 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowMBx_uD1q1Nn3Wd5AA--.42544S6; Sat, 07 Dec 2024 09:59:23 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Josh Poimboeuf , Peter Zijlstra Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 04/10] objtool: Handle unreachable entry of rodata Date: Sat, 7 Dec 2024 09:59:09 +0800 Message-ID: <20241207015915.1159-5-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241207015915.1159-1-yangtiezhu@loongson.cn> References: <20241207015915.1159-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: qMiowMBx_uD1q1Nn3Wd5AA--.42544S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj9xXoW7JFWfCFW8ZF15GF48Kw4DAwc_yoWDtwc_Aa 40grn7Jrs8XF4Iy3W0krs5WFy0ka1rWr4UXw17GF1Yg3W5J3yDuFZ2kFn0yFyF9rWSyFZx u3s3Ar1fCwnF9osvyTuYvTs0mTUanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUb38YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z280aVCY1x0267AKxVW8 JVW8Jr1ln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5 McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr4 1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_ JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17 CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0 I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I 8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73 UjIFyTuYvjxU4AhLUUUUU Content-Type: text/plain; charset="utf-8" When compiling with Clang on LoongArch, there exists unreachable entry of rodata which points to a position after the function return instruction, this is generated by compiler to fill the non-existent switch case, just skip the entry when parsing the relocation section of rodata. Signed-off-by: Tiezhu Yang --- tools/objtool/check.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 4a23aae40c03..b85fc33fdd67 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1994,9 +1994,10 @@ static int add_jump_table(struct objtool_file *file,= struct instruction *insn, if (!dest_insn) break; =20 - /* Make sure the destination is in the same function: */ - if (!insn_func(dest_insn) || insn_func(dest_insn)->pfunc !=3D pfunc) - break; + if (!insn_func(dest_insn) || insn_func(dest_insn)->pfunc !=3D pfunc) { + prev_offset =3D reloc_offset(reloc); + continue; + } =20 alt =3D malloc(sizeof(*alt)); if (!alt) { --=20 2.42.0