[RFC PATCH] objtool: Skip unannotated intra-function call warning for bl+mflr pattern
Christophe Leroy
christophe.leroy at csgroup.eu
Tue Feb 25 04:54:44 AEDT 2025
Le 24/02/2025 à 17:25, Peter Zijlstra a écrit :
> On Fri, Feb 21, 2025 at 02:20:41PM +0530, Sathvika Vasireddy wrote:
>
>>>> @@ -1625,6 +1626,11 @@ static int add_call_destinations(struct objtool_file *file)
>>>> reloc = insn_reloc(file, insn);
>>>> if (!reloc) {
>>>> dest_off = arch_jump_destination(insn);
>>>> +
>>>> + next_insn = next_insn_same_func(file, insn);
>>>> + if (next_insn && dest_off == next_insn->offset)
>>>> + continue;
>>>> +
>>> This won't work on x86, where an intra-function call is converted to a
>>> stack-modifying JUMP. So this should probably be checked in an
>>> arch-specific function.
>>
>> Thanks for letting me know, I'll introduce arch_skip_call_warning() to
>> handle architecture specific cases in the next patch I send.
>
> Can't you detect this pattern in decode and simpy not emit the call
> instruction?
>
Yes we can, simply do:
diff --git a/tools/objtool/arch/powerpc/decode.c
b/tools/objtool/arch/powerpc/decode.c
index 53b55690f320..4f9b1715caf1 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -55,7 +55,7 @@ int arch_decode_instruction(struct objtool_file *file,
const struct section *sec
switch (opcode) {
case 18: /* b[l][a] */
- if ((ins & 3) == 1) /* bl */
+ if ((ins & 3) == 1 && ins != 0x48000005) /* bl but not bl .+4*/
typ = INSN_CALL;
imm = ins & 0x3fffffc;
More information about the Linuxppc-dev
mailing list