All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS
@ 2014-11-26 18:09 Yann E. MORIN
  2014-11-27 12:15 ` Vicente Olivert Riera
  2014-11-27 21:47 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2014-11-26 18:09 UTC (permalink / raw)
  To: buildroot

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 <Vincent.Riera@imgtec.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
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(-)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index da3718c..51e0af5 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS
  2014-11-26 18:09 [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS Yann E. MORIN
@ 2014-11-27 12:15 ` Vicente Olivert Riera
  2014-11-27 21:47 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Vicente Olivert Riera @ 2014-11-27 12:15 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On 11/26/2014 06:09 PM, Yann E. MORIN wrote:
> 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 <Vincent.Riera@imgtec.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> ---
> 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(-)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index da3718c..51e0af5 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -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
> 

I have tried your patch in a MIPS box and it works like a charm :-)

Reviewed-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Tested-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Cheers,
-- 
Vicente Olivert Riera
Graduate Software Engineer, MIPS Platforms
Imagination Technologies Limited
t: +44 (0)113 2429814
www.imgtec.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS
  2014-11-26 18:09 [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS Yann E. MORIN
  2014-11-27 12:15 ` Vicente Olivert Riera
@ 2014-11-27 21:47 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2014-11-27 21:47 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> 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.

 > 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.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-27 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 18:09 [Buildroot] [PATCH] toolchain/external: fix building the wrapper on MIPS Yann E. MORIN
2014-11-27 12:15 ` Vicente Olivert Riera
2014-11-27 21:47 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.