Re: [PATCH] rust: enable fentry support
Paul Murphy <[email protected]>
| Newsgroups | dev.linux.lists.sashiko-reviews |
|---|---|
| Message-ID | <CALYDSrQhUbKDHsPnQqp0K4WMe2iZC-G1nGrLT6eQ9doCqdVXKQ@mail.gmail.com> |
On Fri, Jul 24, 2026 at 12:26 PM <[email protected]> wrote: > > diff --git a/Makefile b/Makefile > > index bfb47ad8cb9a7..bdfe93702a337 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1053,10 +1053,12 @@ ifdef CONFIG_HAVE_FENTRY > > CC_FLAGS_FTRACE += -mfentry > > CC_FLAGS_USING += -DCC_USING_FENTRY > > endif > > + RUSTFLAGS_FTRACE := $(if $(call rustc-min-version,109800),-Zinstrument-mcount=fentry,) > > [Severity: High] > Does this cause link errors or broken ftrace functionality on s390x? > > On s390x, the kernel does not use objtool for ftrace. Instead, the C compiler > uses -mnop-mcount and -mrecord-mcount to create the __mcount_loc section > natively. > > Passing only -Zinstrument-mcount=fentry to rustc without equivalent NOP and > section-recording instructions will cause LLVM to emit a standard call to > __fentry__ or _mcount and fail to generate the __mcount_loc table. > > > endif > > export CC_FLAGS_FTRACE > Hrm, s390x has more nuanced usage. It still uses -mrecord-mcount and -mnop-mcount. The x86 configurations I've looked at use the kernel's tooling to nop and record as needed. Is there any reason s390x cannot use those, or should rustc support those (for s390x only)?