perf: Tweak for mips n64

Message ID 20211210120524.670148-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 33828620872b80e1c745612e025215666ba755c8
Headers show
Series perf: Tweak for mips n64 | expand

Commit Message

Richard Purdie Dec. 10, 2021, 12:05 p.m. UTC
With the changes to binutils, perf's direct calls to ld break for mips n64.
We already have tweaks for n32 so match those with the ones for n64.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-kernel/perf/perf.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Khem Raj Dec. 10, 2021, 3:56 p.m. UTC | #1
On Fri, Dec 10, 2021 at 4:05 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> With the changes to binutils, perf's direct calls to ld break for mips n64.
> We already have tweaks for n32 so match those with the ones for n64.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/recipes-kernel/perf/perf.bb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/
> perf.bb
> index 7bbc1ad70c5..ec0c6efe15f 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -125,9 +125,11 @@ PERF_SRC ?= "Makefile \
>
>  PERF_EXTRA_LDFLAGS = ""
>
> -# MIPS N32
> +# MIPS N32/N64
>  PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32"
>  PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32"
> +PERF_EXTRA_LDFLAGS:mipsarchn64eb = "-m elf64btsmip"
> +PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
>

Hmm this tells me that the default is not really changed in binutils to use
n64 abi with out the patch to binutils configure

N32 patch above is perhaps fine because that’s not our default

Perhaps we need to check a bit more here as to what’s going on


>  do_compile() {
>         # Linux kernel build system is expected to do the right thing
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159507):
> https://lists.openembedded.org/g/openembedded-core/message/159507
> Mute This Topic: https://lists.openembedded.org/mt/87634357/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Richard Purdie Dec. 10, 2021, 4:02 p.m. UTC | #2
On Fri, 2021-12-10 at 07:56 -0800, Khem Raj wrote:
> 
> 
> On Fri, Dec 10, 2021 at 4:05 AM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > With the changes to binutils, perf's direct calls to ld break for mips n64.
> > We already have tweaks for n32 so match those with the ones for n64.
> > 
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> >  meta/recipes-kernel/perf/perf.bb | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-
> > kernel/perf/perf.bb
> > index 7bbc1ad70c5..ec0c6efe15f 100644
> > --- a/meta/recipes-kernel/perf/perf.bb
> > +++ b/meta/recipes-kernel/perf/perf.bb
> > @@ -125,9 +125,11 @@ PERF_SRC ?= "Makefile \
> > 
> >  PERF_EXTRA_LDFLAGS = ""
> > 
> > -# MIPS N32
> > +# MIPS N32/N64
> >  PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32"
> >  PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32"
> > +PERF_EXTRA_LDFLAGS:mipsarchn64eb = "-m elf64btsmip"
> > +PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
> > 
> 
> 
> Hmm this tells me that the default is not really changed in binutils to use
> n64 abi with out the patch to binutils configure 
> 
> N32 patch above is perhaps fine because that’s not our default 
> 
> Perhaps we need to check a bit more here as to what’s going on

In the x86 case, ld looks at the existing object files and sets it's emulation
mode accordingly if none were specified. It seems mips lacks this and there was
a binutils patch which changed the default which I have dropped in -next. The
N32 case is another example of it which we never patched. Unlike the gcc case,
there is no option to change the default when compiling binutils.

Most of the time we don't need that patch as programs use CC/CCLD for linking
and the correct flags are specified there through the gcc driver, perf is the
only one in core which seems to use ld directly like this.

We could start to try and fix the autodetection for mips in the compiler but for
an architecture which has minimal mindshare, I'm not sure it is worth the
effort. Using the same approach as we already have for N32 and dropping the
patch seemed like the reasonable course of action?

Cheers,

Richard

Patch

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 7bbc1ad70c5..ec0c6efe15f 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -125,9 +125,11 @@  PERF_SRC ?= "Makefile \
 
 PERF_EXTRA_LDFLAGS = ""
 
-# MIPS N32
+# MIPS N32/N64
 PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32"
 PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32"
+PERF_EXTRA_LDFLAGS:mipsarchn64eb = "-m elf64btsmip"
+PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
 
 do_compile() {
 	# Linux kernel build system is expected to do the right thing