Skip to contentSkip to conversation

perf: Tweak for mips n64

PATCH In review Richard Purdie 2 participants 3 messages Dec 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Tweak for mips n64

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.

---
 meta/recipes-kernel/perf/perf.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-kernel/perf/perf.bb +3 -1
index 7bbc1ad70c5..ec0c6efe15f 100644
@@ -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
Signature · 1 line
2.32.0
#1 lore raw
Quoted 14 lines · Richard Purdie

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.

---
 meta/recipes-kernel/perf/perf.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-kernel/perf/ renamed from meta/recipes-kernel/perf/perf.bb +0 -0

perf.bb
index 7bbc1ad70c5..ec0c6efe15f 100644

meta/recipes-kernel/perf/perf.bb PERF_SRC ?= "Makefile \ · line 133

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +3 -1
@@ -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

Quoted 17 lines
meta/recipes-kernel/perf/perf.bb +0 -1
 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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 33 lines · Khem Raj
Quoted 22 lines · Richard Purdie

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.

---
 meta/recipes-kernel/perf/perf.bb | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-kernel/perf/perf.bb +0 -0

kernel/perf/perf.bb
index 7bbc1ad70c5..ec0c6efe15f 100644

meta/recipes-kernel/perf/perf.bb +0 -0
@@ -125,9 +125,11 @@ PERF_SRC ?= "Makefile \
 

 PERF_EXTRA_LDFLAGS = ""

meta/recipes-kernel/perf/perf.bb +1 -1
-# MIPS N32
+# MIPS N32/N64

 PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32" PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32"

meta/recipes-kernel/perf/perf.bb PERF_SRC ?= "Makefile \ · line 132

Quoted 2 lines
meta/recipes-kernel/perf/perf.bb +2 -0
+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

Quoted 3 lines

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