[U-Boot] printf("%d") breaks u-boot 2015.01+

Pavel Machek
2015-04-13T12:45:24Z

Hi!

> > I'll fire up ELDK 5.4 + Pandaboard later today (which uses thumb) but I
> > think you need to bisect down to when exactly things break since my gut
> > is telling me it's not toolchain / thumb but something else that broke
> > things.
>
> Panda + ELDK 5.4, which sets CONFIG_SYS_THUMB_BUILD for both SPL and
> U-Boot boots up fine on top of tree, cold boot tested even.

Can you try with

CONFIG_USE_PRIVATE_LIBGCC=y

? Because it works for me, as long as I keep
CONFIG_USE_PRIVATE_LIBGCC unset.

Unfortunately, I need CONFIG_USE_PRIVATE_LIBGCC for my development
machine, otherwise I get compile failure.

It seems to me our private "library" would need special version for
thumb mode, in similar way memcpy.S needs it, no?

I think fix needs to be something along these lines, but this does not
work for me.

Pavel

diff --git a/arch/arm/lib/_ashldi3.S b/arch/arm/lib/_ashldi3.S
index 2c26f84..0b537b0 100644
--- a/arch/arm/lib/_ashldi3.S
+++ b/arch/arm/lib/_ashldi3.S
@@ -12,6 +12,11 @@
#define ah r1
#endif

+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif
+
.globl __ashldi3
.globl __aeabi_llsl
__ashldi3:
diff --git a/arch/arm/lib/_ashrdi3.S b/arch/arm/lib/_ashrdi3.S
index 4d93c8a..e1c1371 100644
--- a/arch/arm/lib/_ashrdi3.S
+++ b/arch/arm/lib/_ashrdi3.S
@@ -12,6 +12,11 @@
#define ah r1
#endif

+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif
+
.globl __ashrdi3
.globl __aeabi_lasr
__ashrdi3:
diff --git a/arch/arm/lib/_divsi3.S b/arch/arm/lib/_divsi3.S
index 6015493..e073399 100644
--- a/arch/arm/lib/_divsi3.S
+++ b/arch/arm/lib/_divsi3.S
@@ -1,5 +1,9 @@
.macro ARM_DIV_BODY dividend, divisor, result, curbit

+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif
#if __LINUX_ARM_ARCH__ >= 5

clz \curbit, \divisor
diff --git a/arch/arm/lib/_lshrdi3.S b/arch/arm/lib/_lshrdi3.S
index 33296a0..b9efd4f 100644
--- a/arch/arm/lib/_lshrdi3.S
+++ b/arch/arm/lib/_lshrdi3.S
@@ -12,6 +12,11 @@
#define ah r1
#endif

+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif
+
.globl __lshrdi3
.globl __aeabi_llsr
__lshrdi3:
diff --git a/arch/arm/lib/_modsi3.S b/arch/arm/lib/_modsi3.S
index 3d31a55..d5c13f90 100644
--- a/arch/arm/lib/_modsi3.S
+++ b/arch/arm/lib/_modsi3.S
@@ -1,4 +1,8 @@
.macro ARM_MOD_BODY dividend, divisor, order, spare
+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif

#if __LINUX_ARM_ARCH__ >= 5

diff --git a/arch/arm/lib/_umodsi3.S b/arch/arm/lib/_umodsi3.S
index 8465ef0..64385ad 100644
--- a/arch/arm/lib/_umodsi3.S
+++ b/arch/arm/lib/_umodsi3.S
@@ -1,6 +1,10 @@
/* # 1 "libgcc1.S" */
@ libgcc1 routines for ARM cpu.
@ Division routines, written by Richard Earnshaw, (rearnsha at armltd.co.uk)
+#ifdef CONFIG_SYS_THUMB_BUILD
+ .thumb
+ .thumb_func
+#endif
/* # 145 "libgcc1.S" */
dividend .req r0
divisor .req r1
diff --git a/mkit b/mkit
index 4b783ab..b956c4f 100755
--- a/mkit
+++ b/mkit
@@ -12,3 +12,4 @@ nice make -j 3 u-boot.img u-boot-dtb.bin && \

# git diff 742de9076e8a8f44b77794b43e6175d86b897996 -- arch board common drivers include > ../wagabuibui.patch
# scp ../wagabuibui.patch pavel at pollux.denx.de:~/wagabuibui/eldk/meta-eldk/recipes-bsp/uboot/u-boot/wagabuibui.patch
+# scp pavel at pollux.denx.de:~/wagabuibui/u-boot/u-boot-dtb.bin /srv/tftp/wagabuibui/u-boot.bin

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html