[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 24/28] tools/objtool: Treat indirect ftrace calls as direct calls
- To: Ard Biesheuvel <ardb+git@xxxxxxxxxx>
- From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
- Date: Tue, 1 Oct 2024 00:18:41 -0700
- Cc: linux-kernel@xxxxxxxxxxxxxxx, Ard Biesheuvel <ardb@xxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Uros Bizjak <ubizjak@xxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Christoph Lameter <cl@xxxxxxxxx>, Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Masahiro Yamada <masahiroy@xxxxxxxxxx>, Kees Cook <kees@xxxxxxxxxx>, Nathan Chancellor <nathan@xxxxxxxxxx>, Keith Packard <keithp@xxxxxxxxxx>, Justin Stitt <justinstitt@xxxxxxxxxx>, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Ian Rogers <irogers@xxxxxxxxxx>, Adrian Hunter <adrian.hunter@xxxxxxxxx>, Kan Liang <kan.liang@xxxxxxxxxxxxxxx>, linux-doc@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-efi@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-sparse@xxxxxxxxxxxxxxx, linux-kbuild@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, rust-for-linux@xxxxxxxxxxxxxxx, llvm@xxxxxxxxxxxxxxx
- Delivery-date: Tue, 01 Oct 2024 07:18:54 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Sep 25, 2024 at 05:01:24PM +0200, Ard Biesheuvel wrote:
> + if (insn->type == INSN_CALL_DYNAMIC) {
> + if (!reloc)
> + continue;
> +
> + /*
> + * GCC 13 and older on x86 will always emit the call to
> + * __fentry__ using a relaxable GOT-based symbol
> + * reference when operating in PIC mode, i.e.,
> + *
> + * call *0x0(%rip)
> + * R_X86_64_GOTPCRELX __fentry__-0x4
> + *
> + * where it is left up to the linker to relax this into
> + *
> + * call __fentry__
> + * nop
> + *
> + * if __fentry__ turns out to be DSO local, which is
> + * always the case for vmlinux. Given that this
> + * relaxation is mandatory per the x86_64 psABI, these
> + * calls can simply be treated as direct calls.
> + */
> + if (arch_ftrace_match(reloc->sym->name)) {
> + insn->type = INSN_CALL;
> + add_call_dest(file, insn, reloc->sym, false);
> + }
Can the compiler also do this for non-fentry direct calls? If so would
it make sense to generalize this by converting all
INSN_CALL_DYNAMIC+reloc to INSN_CALL?
And maybe something similar for add_jump_destinations().
--
Josh
|