Skip to contentSkip to conversation

powerpc/spe: tweak glibc/eglibc/uclibc combinations

PATCH New Gustavo Zacarias 2 participants 4 messages Sep 11, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powerpc/spe: tweak glibc/eglibc/uclibc combinations

Since (e)glibc 2.19+ PowerPC SPE changed ABI conventions for sanity. In the good old days hard-float was used, it sounds good on paper until you account for the e500v1/v2 differences, with v1 being a fpu that does only single-precision math.

So the ABI changed to make it soft-float and the libc (or libm) handle that deficiency in software if required, making old precompiled binaries incompatible (of no concern for buildroot since we've got no precompiled binary blobs for SPE in packages).

For uClibc the support is for hard-float so disable it for soft since it doesn't do the fallback trickery.

So do what's appropiate for each combination:

H-F S-F

eglibc 2.18 x

eglibc 2.19           x
glibc 2.19            x
glibc 2.20            x

uclibc x

Eventually hard-float should just go away, i'm keeping it for compatibility purposes.

---
 package/glibc/Config.in                 | 4 ++--
 toolchain/toolchain-buildroot/Config.in | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
package/glibc/Config.in +2 -2
index 8c033f2..748ff44 100644
@@ -11,11 +11,11 @@ choice
 
 config BR2_EGLIBC_VERSION_2_18
 	bool "2.18-svnr23787"
+	depends on !BR2_POWERPC_SOFT_FLOAT
 
 config BR2_EGLIBC_VERSION_2_19
 	bool "2.19-svnr25243"
-	# Build breakage
-	depends on !BR2_powerpc_SPE
+	depends on !BR2_powerpc_SPE || (BR2_powerpc_SPE && BR2_POWERPC_SOFT_FLOAT)
 
 endchoice
 
toolchain/toolchain-buildroot/Config.in +2 -1
index 53d86dd..9a711c0 100644
@@ -33,6 +33,7 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 		   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
 		   BR2_powerpc || BR2_sh     || BR2_sparc  || BR2_xtensa   || \
 		   BR2_x86_64
+	depends on !BR2_powerpc_SPE || (BR2_powerpc_SPE && !BR2_POWERPC_SOFT_FLOAT)
 	help
 	  This option selects uClibc as the C library for the
 	  cross-compilation toolchain.
@@ -67,7 +68,7 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC
 		   BR2_microblaze
 	depends on BR2_USE_MMU
 	depends on !BR2_PREFER_STATIC_LIB
-	depends on !BR2_powerpc_SPE
+	depends on !BR2_powerpc_SPE || (BR2_powerpc_SPE && BR2_POWERPC_SOFT_FLOAT)
 	select BR2_TOOLCHAIN_USES_GLIBC
 	# our glibc.mk enables RPC support
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 2/2 arch/powerpc: default to soft-float for SPE ABI

It really is the way forward so switch the default.

---
 arch/Config.in.powerpc | 1 +
 1 file changed, 1 insertion(+)
arch/Config.in.powerpc +1 -0
index 239f5dc..4c21739 100644
@@ -141,6 +141,7 @@ endchoice
 
 config BR2_POWERPC_SOFT_FLOAT
 	bool "Use soft-float"
+	default y if BR2_powerpc_SPE
 	select BR2_SOFT_FLOAT
 	help
 	  If your target CPU does not have a Floating Point Unit (FPU)
Signature · 1 line
1.8.5.5
#2 lore raw

PATCH 1/2 powerpc/spe: tweak glibc/eglibc/uclibc combinations

In reply to Gustavo Zacarias

Dear Gustavo Zacarias,

Quoted 9 lines · Gustavo Zacarias

Since (e)glibc 2.19+ PowerPC SPE changed ABI conventions for sanity. In the good old days hard-float was used, it sounds good on paper until you account for the e500v1/v2 differences, with v1 being a fpu that does only single-precision math.

So the ABI changed to make it soft-float and the libc (or libm) handle that deficiency in software if required, making old precompiled binaries incompatible (of no concern for buildroot since we've got no precompiled binary blobs for SPE in packages).

I'm not sure to fully understand: is PowerPC really using *soft-float* as in all floating point operations are emulated in software? Or is it a difference similar to the difference between hardfp and softfp on ARM (both use the FPU and floating point instructions, it's only a different ABI, where hardfp passes floating point arguments in floating point registers, while softfp passes floating point arguments in integer registers).

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/2 powerpc/spe: tweak glibc/eglibc/uclibc combinations

Quoted 7 lines · Thomas Petazzoni

I'm not sure to fully understand: is PowerPC really using *soft-float* as in all floating point operations are emulated in software? Or is it a difference similar to the difference between hardfp and softfp on ARM (both use the FPU and floating point instructions, it's only a different ABI, where hardfp passes floating point arguments in floating point registers, while softfp passes floating point arguments in integer registers).

It's similar to the ARM scenario, yes.
In the SPE ABI there are no FPU registers at all, it's just an extension of GP-ones (say 32+32 bit for DP/E500v2).
In libc-land uclibc uses the 'old' ABI (direct hard float), and so did eglibc <= 2.18 (glibc i think never got that part officially). To avoid re-explaining: http://www.eglibc.org/archives/patches/msg01291.html
I hope it's clear enough :)
Regards.