From: Jinyang He <hejinyang@loongson.cn>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 02/10] objtool: Handle special cases of dead end insn
Date: Tue, 19 Nov 2024 18:47:19 +0800 [thread overview]
Message-ID: <bc6dd2e7-ac1d-bee2-3796-6fe43a3db90b@loongson.cn> (raw)
In-Reply-To: <20241119065655.21123-3-yangtiezhu@loongson.cn>
On 2024-11-19 14:56, Tiezhu Yang wrote:
> There are some "unreachable instruction" objtool warnings when compling
> with Clang on LoongArch, this is because the "break" instruction is set
> as dead end due to its type is INSN_BUG in decode_instructions() at the
> beginning, and it does not set insn->dead_end of the "break" instruction
> as false after checking ".rela.discard.reachable" in add_dead_ends(), so
> the next instruction of "break" is marked as unreachable.
>
> Actually, it can find the reachable instruction after parsing the section
> ".rela.discard.reachable", in some cases, the "break" instruction may not
> be the first previous instruction with scheduling by Machine Instruction
> Scheduler of LLVM, it should find more times and then set insn->dead_end
> of the "break" instruction as false.
>
> This is preparation for later patch on LoongArch, there is no effect for
> the other archs with this patch.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> tools/objtool/check.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 9601235e908d..6607cd56459b 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -711,6 +711,18 @@ static int add_dead_ends(struct objtool_file *file)
> }
>
> insn->dead_end = false;
> +
> + /* Handle the special cases compiled with Clang on LoongArch */
> + if (file->elf->ehdr.e_machine == EM_LOONGARCH &&
> + reloc->sym->type == STT_SECTION) {
> + while (insn && insn_func(insn)) {
> + insn = prev_insn_same_sym(file, insn);
> + if (insn && insn->dead_end) {
> + insn->dead_end = false;
> + break;
> + }
> + }
> + }
Does it cancel the previous instruction which has insn->dead_end?
Why the previous, and why just for LoongArch?
IMO if we annotate reachable, we should cancel all instructions which
are from the sym head to current insn, not only previous. Otherwise,
why it is previous but not the previous of previous.
> }
>
> return 0;
next prev parent reply other threads:[~2024-11-19 10:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 6:56 [PATCH v3 00/10] Add jump table support for objtool on LoongArch Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 01/10] objtool: Handle various symbol types of rodata Tiezhu Yang
2024-11-19 10:47 ` Jinyang He
2024-11-19 6:56 ` [PATCH v3 02/10] objtool: Handle special cases of dead end insn Tiezhu Yang
2024-11-19 10:47 ` Jinyang He [this message]
2024-11-19 6:56 ` [PATCH v3 03/10] objtool: Handle different entry size of rodata Tiezhu Yang
2024-11-19 10:47 ` Jinyang He
2024-11-21 21:33 ` kernel test robot
2024-11-22 1:24 ` kernel test robot
2024-11-19 6:56 ` [PATCH v3 04/10] objtool: Handle PC relative relocation type Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 05/10] objtool: Handle unreachable entry of rodata Tiezhu Yang
2024-11-19 10:47 ` Jinyang He
2024-11-21 12:56 ` Huacai Chen
2024-11-19 6:56 ` [PATCH v3 06/10] objtool: Handle unsorted table offset " Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 07/10] objtool/LoongArch: Get each table size " Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 08/10] objtool/LoongArch: Add support for switch table Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 09/10] objtool/LoongArch: Add support for goto table Tiezhu Yang
2024-11-19 6:56 ` [PATCH v3 10/10] LoongArch: Enable jump table for objtool Tiezhu Yang
2024-11-19 8:48 ` [PATCH v3 00/10] Add jump table support for objtool on LoongArch Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bc6dd2e7-ac1d-bee2-3796-6fe43a3db90b@loongson.cn \
--to=hejinyang@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®