Skip to contentSkip to conversation

Makefile: Set default emulation for MIPS64/MIPS64el n64

PATCH New Markos Chandras 2 participants 3 messages May 17, 2013 – May 18, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Set default emulation for MIPS64/MIPS64el n64

From: Markos Chandras <[email protected]>

binutils set the default emulation for MIPS64/MIPS64el to elf32btsmipn32 and elf32ltsmipn3 respectively. This breaks linking for programs calling the linker directly without passing the appropriate emulation parameter (-m). Unfortunately, binutils do not provide a way to set the default emulation when building the linker therefore we export the LDEMULATION variable to set the preferred emulation ourselves. This fixes

http://autobuild.buildroot.net/results/0f2a760b94069ac915d856cd1ae1998e5483807a/

and possibly other build failures as well.

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 5d2a7ae..d80d12d 100644
@@ -354,6 +354,10 @@ ifeq ($(BR2_ECLIPSE_REGISTER),y)
 TARGETS+=toolchain-eclipse-register
 endif
 
+ifeq ($(BR2_MIPS_NABI64),y)
+export LDEMULATION=elf64btsmip
+endif
+
 include fs/common.mk
 
 TARGETS+=target-post-image
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/1 Makefile: Set default emulation for MIPS64/MIPS64el n64

Dear Markos Chandras,

Quoted 10 lines · Markos Chandras

From: Markos Chandras <[email protected]>

binutils set the default emulation for MIPS64/MIPS64el to elf32btsmipn32 and elf32ltsmipn3 respectively. This breaks linking for programs calling the linker directly without passing the appropriate emulation parameter (-m). Unfortunately, binutils do not provide a way to set the default emulation when building the linker therefore we export the LDEMULATION variable to set the preferred emulation ourselves. This fixes

Quoted 3 lines

http://autobuild.buildroot.net/results/0f2a760b94069ac915d856cd1ae1998e5483807a/

and possibly other build failures as well.

I am not sure this is the right fix for the problem. I believe the problem is that the external toolchain wrapper should also wrap "ld" in order to pass the right arguments to select the correct emulation, just like we have a wrapper for "gcc" to select the correct architecture, ABI and so on.

No?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 Makefile: Set default emulation for MIPS64/MIPS64el n64

Quoted 23 lines · Thomas Petazzoni

Dear Markos Chandras,

Quoted 10 lines · Markos Chandras

From: Markos Chandras <[email protected]>

binutils set the default emulation for MIPS64/MIPS64el to elf32btsmipn32 and elf32ltsmipn3 respectively. This breaks linking for programs calling the linker directly without passing the appropriate emulation parameter (-m). Unfortunately, binutils do not provide a way to set the default emulation when building the linker therefore we export the LDEMULATION variable to set the preferred emulation ourselves. This fixes

Quoted 3 lines

http://autobuild.buildroot.net/results/0f2a760b94069ac915d856cd1ae1998e5483807a/

and possibly other build failures as well.

I am not sure this is the right fix for the problem. I believe the problem is that the external toolchain wrapper should also wrap "ld" in order to pass the right arguments to select the correct emulation, just like we have a wrapper for "gcc" to select the correct architecture, ABI and so on.

Quoted 4 lines

No?

Thomas

Hi Thomas,

I am not sure what you mean by "external toolchain" here since this is a problem with the buildroot toolchain as well. I probably don't understand the solution you propose. This is a "quick and dirty" fix. The ideal solution to this problem would be to fix the build systems to use "gcc" instead of "ld" for linking.

Signature · 2 lines
Regards,
Markos Chandras