Skip to content

Commit d8af7c9

Browse files
rnavSasha Levin
authored and
Sasha Levin
committed
powerpc64/ftrace: Fix ftrace for clang builds
commit cb928ac upstream. Clang doesn't support -mprofile-kernel ABI, so guard the checks against CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version. Fixes: 23b44fc ("powerpc/ftrace: Make __ftrace_make_{nop/call}() common to PPC32 and PPC64") Cc: [email protected] # v5.19+ Reported-by: Nick Desaulniers <[email protected]> Reported-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Naveen N. Rao <[email protected]> Tested-by: Ondrej Mosnacek <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: llvm/llvm-project#57031 Link: ClangBuiltLinux#1682 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1f1a739 commit d8af7c9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,11 @@ int ftrace_make_nop(struct module *mod,
392392
*/
393393
static bool expected_nop_sequence(void *ip, ppc_inst_t op0, ppc_inst_t op1)
394394
{
395-
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1))
395+
if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS))
396+
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
397+
else
396398
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_BRANCH(8))) &&
397399
ppc_inst_equal(op1, ppc_inst(PPC_INST_LD_TOC));
398-
else
399-
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
400400
}
401401

402402
static int
@@ -411,7 +411,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
411411
if (copy_inst_from_kernel_nofault(op, ip))
412412
return -EFAULT;
413413

414-
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) &&
414+
if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) &&
415415
copy_inst_from_kernel_nofault(op + 1, ip + 4))
416416
return -EFAULT;
417417

0 commit comments

Comments
 (0)