Skip to contentSkip to conversation

perf: append endianness argument to ld when building for MIPS

PATCH New Vicente Olivert Riera 3 participants 3 messages Feb 22, 2016 – Feb 27, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf: append endianness argument to ld when building for MIPS

We need to pass an argument to ld for setting the endianness when building it for MIPS architecture, otherwise the default one will always be used (which is big endian) and the compilation for little endian will always fail showing an error like this one:

LD foo.o
mips-linux-gnu-ld: foo.o: compiled for a little endian system and target is big endian

---
Changes v1 -> v2:
- Simplify the logic of the ifeq block.

 linux/linux-tool-perf.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)
linux/linux-tool-perf.mk +13 -0
index 07c3514..1070a1c 100644
@@ -27,6 +27,19 @@ PERF_MAKE_FLAGS = \
 	WERROR=0 \
 	ASCIIDOC=
 
+# We need to pass an argument to ld for setting the endianness when
+# building it for MIPS architecture, otherwise the default one will
+# always be used (which is big endian) and the compilation for little
+# endian will always fail showing an error like this one:
+#  LD    foo.o
+# mips-linux-gnu-ld: foo.o: compiled for a little endian system and
+# target is big endian
+ifeq ($(BR2_mips)$(BR2_mips64),y)
+PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EB"
+else ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
+PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EL"
+endif
+
 # The call to backtrace() function fails for ARC, because for some
 # reason the unwinder from libgcc returns early. Thus the usage of
 # backtrace() should be disabled in perf explicitly: at build time
Signature · 1 line
2.4.10
#1 lore raw

PATCH v2 1/1 perf: append endianness argument to ld when building for MIPS

Quoted 10 lines · Vicente Olivert Riera

We need to pass an argument to ld for setting the endianness when building it for MIPS architecture, otherwise the default one will always be used (which is big endian) and the compilation for little endian will always fail showing an error like this one:

LD foo.o
mips-linux-gnu-ld: foo.o: compiled for a little endian system and target is big endian

Regards,
Arnout

Quoted 32 lines

---
Changes v1 -> v2:
- Simplify the logic of the ifeq block.

 linux/linux-tool-perf.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)
linux/linux-tool-perf.mk +13 -0
index 07c3514..1070a1c 100644
@@ -27,6 +27,19 @@ PERF_MAKE_FLAGS = \
 	WERROR=0 \
 	ASCIIDOC=
 
+# We need to pass an argument to ld for setting the endianness when
+# building it for MIPS architecture, otherwise the default one will
+# always be used (which is big endian) and the compilation for little
+# endian will always fail showing an error like this one:
+#  LD    foo.o
+# mips-linux-gnu-ld: foo.o: compiled for a little endian system and
+# target is big endian
+ifeq ($(BR2_mips)$(BR2_mips64),y)
+PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EB"
+else ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
+PERF_MAKE_FLAGS += LD="$(TARGET_LD) -EL"
+endif
+
 # The call to backtrace() function fails for ARC, because for some
 # reason the unwinder from libgcc returns early. Thus the usage of
 # backtrace() should be disabled in perf explicitly: at build time
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH v2 1/1 perf: append endianness argument to ld when building for MIPS

In reply to Vicente Olivert Riera
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Vicente" == Vicente Olivert Riera <[email protected]> writes:

We need to pass an argument to ld for setting the endianness when building it for MIPS architecture, otherwise the default one will always be used (which is big endian) and the compilation for little endian will always fail showing an error like this one:

Quoted 8 lines

LD foo.o
mips-linux-gnu-ld: foo.o: compiled for a little endian system and target is big endian

---
Changes v1 -> v2:
- Simplify the logic of the ifeq block.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard