[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <82c913b9-4403-cde9-0542-5bd6e04415f5@loongson.cn>
Date: Mon, 1 Sep 2025 16:39:29 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Huacai Chen <chenhuacai@...nel.org>, Josh Poimboeuf
<jpoimboe@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/3] objtool/LoongArch: Fix unreachable instruction
warnings about EFISTUB
On 2025/9/1 下午4:19, Peter Zijlstra wrote:
> On Mon, Sep 01, 2025 at 03:21:55PM +0800, Tiezhu Yang wrote:
>> When compiling with LLVM and CONFIG_LTO_CLANG is set, there exist the
>> following objtool warnings:
>>
>> vmlinux.o: warning: objtool: .head.text+0x0: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x18: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x38: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x3c: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x40: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x44: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x54: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x58: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x6c: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x84: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x94: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x9c: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0xc4: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0xf8: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0xfc: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x104: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x10c: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x11c: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x120: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x124: unreachable instruction
>> vmlinux.o: warning: objtool: .head.text+0x144: unreachable instruction
>>
>> The instructions in the .head.text section are related with EFISTUB,
>> they are image header and can be ignored by objtool, so just check the
>> section name in ignore_unreachable_insn() to ignore it.
>
> I am confused; why do the efi/libstub functions generate this error?
>
> Is this zboot-header.S perhaps? Why can't we properly annotate that
> file?
This is arch/loongarch/kernel/head.S.
There is "OBJECT_FILES_NON_STANDARD_head.o := y" in Makefile
to skip objtool checking for head.o, but OBJECT_FILES_NON_STANDARD
does not work for link time validation of vmlinux.o.
At the beginning, give UNWIND_HINT_UNDEFINED for these instructions,
but there is an argument in the previous RFC [1]:
"The efi header is completely not code, the annotations are very strange."
Josh suggested to do something to put these instructions in the data
section, but as said in the previous reply, it needs to modify the link
process and seems too complicated and expensive for this warning to some
extent.
So I did this change for objtool.
[1]
https://lore.kernel.org/loongarch/CAAhV-H7NNtH-oaqMsN5=2c+EdF0-dy5mxcsO=_KFGWqb-FZj_w@mail.gmail.com/
[2]
https://lore.kernel.org/loongarch/l7l2ik5b2inhwbxmlae7ozrlxi7hbdjbrhjsrykjgotlhflah6@jebephhvtxki/
Thanks,
Tiezhu
Powered by blists - more mailing lists