From nobody Thu Dec 18 00:27:12 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32A1722EE4 for ; Tue, 17 Dec 2024 01:09: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=1734397756; cv=none; b=A9Ef9AoB7qwyI8t+4ddHp6Uz7vN404vugAySQ1P/rI22fvKQdDoG6pJFuMgpHfUtMuBTUKxqCkVkp1wVXczdGDdVU2oQ2+cIeTn37tN7va1TxNvWF8I3begND4CLswHtqidufVDdoPTIlUF/AT4gq7Eh1kwDNIOAa7fc/xRNKm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734397756; c=relaxed/simple; bh=qmFXzkmiOcive4vzwGchnxkxJY85d6lRYkqb01roVRg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YuaIqA4jfwXqYoRnjF6NW2TUTWtzIkcOuyrzAtSkFhZOpcOX0zodPGsfzc2Sfjjm3yiq8wznK6V1T8Agdsnoi2Kn6bv2fgIdb+iTYr15QYKdId/ZFaV6LyQNCckTJiCGTsL44cyhec/4NqLbkLnB/5VMX6wuAbzUmmGLHyzO6bI= 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 _____8DxG+I4z2BnJpdXAA--.39668S3; Tue, 17 Dec 2024 09:09:12 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowMDxPEcyz2BnXNeFAA--.16436S6; Tue, 17 Dec 2024 09:09:11 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Josh Poimboeuf , Peter Zijlstra Cc: loongarch@lists.linux.dev, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/9] objtool: Handle unreachable entry of rodata Date: Tue, 17 Dec 2024 09:09:00 +0800 Message-ID: <20241217010905.13054-5-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241217010905.13054-1-yangtiezhu@loongson.cn> References: <20241217010905.13054-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: qMiowMDxPEcyz2BnXNeFAA--.16436S6 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj9xXoW7JFWfCFW8ZF15GF48Kw4DAwc_yoWDtwc_Aa 40grn7Jrs8XF4Iy3W0krs5WFy0kan5Wr47Xw17GF1Yga43J3yDuF92kFnIyF9Y9rWSyFsx u3s3Ar1fCwnF9osvyTuYvTs0mTUanT9S1TB71UUUUjUqnTZGkaVYY2UrUUUUj1kv1TuYvT s0mT0YCTnIWjqI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUI cSsGvfJTRUUUbfkYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20x vaj40_Wr0E3s1l1IIY67AEw4v_JF0_JFyl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z280aVCY1x0267AKxVW8 JVW8Jr1ln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5 McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr4 1lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_ Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Xr0_Ar1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI 8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v2 6r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU4ApnDUUUU 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 cff7416b207e..654cffcf9512 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1986,9 +1986,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