toolchain/external: fix building the wrapper on MIPS
PATCH 1/1 toolchain/external: fix building the wrapper on MIPS
Some crazy folks use MIPS machines as build machines. ;-)
On MIPS, the only acceptable hash-style is 'sysv', because the MIPS ABI defines that the GOT ordering to be the same as the symbols ordering, while GNU hash requires symbols to be sorted by their hash.
Looking at binutils' code, it seems that only MIPS suffers from that limitation.
Currently, we force the toolchain wrapper to be linked with both hash styles, which breaks on MIPS.
So, fix that but singling out MIPS, and use sysv in that case, and both otherwise.
---
Absolutely untested on MIPS, as I do not have any MIPS machine powerfull enough to do a build. Vicente will have to test it, since he is that crazy one using MIPS build machines! ;-)
--- toolchain/toolchain-external/toolchain-external.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
toolchain/toolchain-external/toolchain-external.mk +11 -3
@@ -625,6 +625,15 @@ define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT endef endif +# We use --hash-style=both to increase the compatibility of +# the generated binary with older platforms, except for MIPS, +# where the only acceptable hash style is 'sysv' +ifeq ($(findstring mips,$(HOSTARCH)),mips) +TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = sysv +else +TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = both +endif + # Build toolchain wrapper for preprocessor, C and C++ compiler and setup # symlinks for everything else. Skip gdb symlink when we are building our # own gdb to prevent two gdb's in output/host/usr/bin.
@@ -647,9 +656,8 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER ;; \ esac; \ done ; - # We use --hash-style=both to increase the compatibility of - # the generated binary with older platforms - $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) -s -Wl,--hash-style=both \ + $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) \ + -s -Wl,--hash-style=$(TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE) \ toolchain/toolchain-external/ext-toolchain-wrapper.c \ -o $(HOST_DIR)/usr/bin/ext-toolchain-wrapper endef
Signature · 1 line
1.9.1
PATCH 1/1 toolchain/external: fix building the wrapper on MIPS
Dear Yann E. MORIN,
Quoted 49 lines · Yann E. MORIN
Some crazy folks use MIPS machines as build machines. ;-)
On MIPS, the only acceptable hash-style is 'sysv', because the MIPS ABI defines that the GOT ordering to be the same as the symbols ordering, while GNU hash requires symbols to be sorted by their hash.
Looking at binutils' code, it seems that only MIPS suffers from that limitation.
Currently, we force the toolchain wrapper to be linked with both hash styles, which breaks on MIPS.
So, fix that but singling out MIPS, and use sysv in that case, and both otherwise.
Reported-by Vicente Olivert Riera <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>---
Absolutely untested on MIPS, as I do not have any MIPS machine powerfull enough to do a build. Vicente will have to test it, since he is that crazy one using MIPS build machines! ;-)--- toolchain/toolchain-external/toolchain-external.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)toolchain/toolchain-external/toolchain-external.mk +9
-0@@ -625,6 +625,15 @@ define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT endef endif +# We use --hash-style=both to increase the compatibility of +# the generated binary with older platforms, except for MIPS, +# where the only acceptable hash style is 'sysv' +ifeq ($(findstring mips,$(HOSTARCH)),mips) +TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = sysv +else +TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE = both +endif + # Build toolchain wrapper for preprocessor, C and C++ compiler and setup # symlinks for everything else. Skip gdb symlink when we are building our # own gdb to prevent two gdb's in output/host/usr/bin.@@ -647,9 +656,8 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER ;; \
toolchain/toolchain-external/toolchain-external.mk define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER · line 663
Quoted 10 lines
toolchain/toolchain-external/toolchain-external.mk +2
-3esac; \ done ; - # We use --hash-style=both to increase the compatibility of - # the generated binary with older platforms - $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) -s -Wl,--hash-style=both \ + $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) \ + -s -Wl,--hash-style=$(TOOLCHAIN_EXTERNAL_WRAPPER_HASH_STYLE) \ toolchain/toolchain-external/ext-toolchain-wrapper.c \ -o $(HOST_DIR)/usr/bin/ext-toolchain-wrapper endef
I have tried your patch in a MIPS box and it works like a charm :-)
Cheers,
Signature · 5 lines
Vicente Olivert Riera Graduate Software Engineer, MIPS Platforms Imagination Technologies Limited t: +44 (0)113 2429814 www.imgtec.com
PATCH 1/1 toolchain/external: fix building the wrapper on MIPS
In reply to Yann E. MORINQuoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Some crazy folks use MIPS machines as build machines. ;-)
On MIPS, the only acceptable hash-style is 'sysv', because the MIPS ABI defines that the GOT ordering to be the same as the symbols ordering, while GNU hash requires symbols to be sorted by their hash.
Quoted 7 lines
Looking at binutils' code, it seems that only MIPS suffers from that limitation.
Currently, we force the toolchain wrapper to be linked with both hash styles, which breaks on MIPS.
So, fix that but singling out MIPS, and use sysv in that case, and both
s/but/by/
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard