Skip to contentSkip to conversation

arm: config: Introduce CONFIG_SYS_ARM_ARCH

PATCH New Marek Vasut 5 participants 39 messages May 26, 2016 – Jun 6, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/12 arm: config: Introduce CONFIG_SYS_ARM_ARCH

Introduce new helper Kconfig option, which is automatically set to the version of ARM architecture for which the U-Boot is built. This is useful when selecting tuning options in the libgcc imported from Linux kernel.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/Kconfig | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/Kconfig +14 -0
index 729b181..b71c2bb 100644
@@ -64,6 +64,20 @@ config SYS_CPU
         default "sa1100" if CPU_SA1100
 	default "armv8" if ARM64
 
+config SYS_ARM_ARCH
+	int
+	default 4 if CPU_ARM720T
+	default 4 if CPU_ARM920T
+	default 5 if CPU_ARM926EJS
+	default 5 if CPU_ARM946ES
+	default 6 if CPU_ARM1136
+	default 6 if CPU_ARM1176
+	default 7 if CPU_V7
+	default 7 if CPU_V7M
+	default 5 if CPU_PXA
+	default 4 if CPU_SA1100
+	default 8 if ARM64
+
 config SEMIHOSTING
 	bool "support boot from semihosting"
 	help
Signature · 1 line
2.7.0
#1 lore raw

PATCH 2/12 arm: include: Import unified.h from Linux kernel

Import unified.h from Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . This header file contains macros used in libgcc functions in Linux kernel on ARM and will be needed for the libgcc sync.

Since unified.h defines the W(instr) macro, we must drop this from the macro from memcpy.S , otherwise this triggers a warning about symbol redefinition. In order to keep the changes to unified.h to the minimum, tweak arch/arm/lib/Makefile such that it defines the CONFIG_ARM_ASM_UNIFIED macro, which places .syntax unified into all of the assembler files. This is mandatory.

Moreover, for Thumb2 build, define CONFIG_THUMB2_KERNEL macro if and only if Thumb2 build is enabled. This macro is checked by unified.h and toggles between ARM and Thumb2 variant of the instructions in the assembler source files.

Finally, this patch defines __LINUX_ARM_ARCH__=N macro based on the new CONFIG_SYS_ARM_ARCH Kconfig option. This macro selects between more optimal and more dense codepaths which work on armv5 and newer and less optimal codepaths which work on armv4 and possible armv3m. Tegra2 needs the same special handling as it does in arch/arm/Makefile to cater for the arm720t boot core.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/include/asm/assembler.h |   1 +
 arch/arm/include/asm/unified.h   | 129 +++++++++++++++++++++++++++++++++++++++
 arch/arm/lib/Makefile            |   9 ++-
 arch/arm/lib/memcpy.S            |   6 --
 4 files changed, 138 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/asm/unified.h
arch/arm/include/asm/assembler.h +1 -0
index 11b80fb..ae1e42f 100644
@@ -15,6 +15,7 @@
  */
 
 #include <config.h>
+#include <asm/unified.h>
 
 /*
  * Endian independent macros for shifting bytes within registers.
arch/arm/include/asm/unified.h new file +129 -0

129 lines not on this page · raw message

arch/arm/lib/Makefile +8 -1
index 7a0fb58..1112b9e 100644
@@ -62,9 +62,17 @@ ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 extra-y	+= eabi_compat.o
 endif
 
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TEGRA),yy)
+asflags-y += -D__LINUX_ARM_ARCH__=4
+else
+asflags-y += -D__LINUX_ARM_ARCH__=$(CONFIG_SYS_ARM_ARCH)
+endif
+
 # some files can only build in ARM or THUMB2, not THUMB1
 
 ifdef CONFIG_SYS_THUMB_BUILD
+asflags-$(CONFIG_HAS_THUMB2) += -DCONFIG_THUMB2_KERNEL
 ifndef CONFIG_HAS_THUMB2
 
 # for C files, just apend -marm, which will override previous -mthumb*
@@ -82,6 +90,5 @@ AFLAGS_REMOVE_memset.o := -mthumb -mthumb-interwork
 AFLAGS_REMOVE_memcpy.o := -mthumb -mthumb-interwork
 AFLAGS_memset.o := -DMEMSET_NO_THUMB_BUILD
 AFLAGS_memcpy.o := -DMEMCPY_NO_THUMB_BUILD
-
 endif
 endif
arch/arm/lib/memcpy.S +0 -6
index 7d9fc0f..00602e9 100644
@@ -13,12 +13,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-#if defined(CONFIG_SYS_THUMB_BUILD) && !defined(MEMCPY_NO_THUMB_BUILD)
-#define W(instr)	instr.w
-#else
-#define W(instr)	instr
-#endif
-
 #define LDR1W_SHIFT	0
 #define STR1W_SHIFT	0
 
Signature · 1 line
2.7.0
#2 lore raw

PATCH 2/12 arm: include: Import unified.h from Linux kernel

Quoted 24 lines · Marek Vasut

Import unified.h from Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . This header file contains macros used in libgcc functions in Linux kernel on ARM and will be needed for the libgcc sync.

Since unified.h defines the W(instr) macro, we must drop this from the macro from memcpy.S , otherwise this triggers a warning about symbol redefinition. In order to keep the changes to unified.h to the minimum, tweak arch/arm/lib/Makefile such that it defines the CONFIG_ARM_ASM_UNIFIED macro, which places .syntax unified into all of the assembler files. This is mandatory.

Moreover, for Thumb2 build, define CONFIG_THUMB2_KERNEL macro if and only if Thumb2 build is enabled. This macro is checked by unified.h and toggles between ARM and Thumb2 variant of the instructions in the assembler source files.

Finally, this patch defines __LINUX_ARM_ARCH__=N macro based on the new CONFIG_SYS_ARM_ARCH Kconfig option. This macro selects between more optimal and more dense codepaths which work on armv5 and newer and less optimal codepaths which work on armv4 and possible armv3m. Tegra2 needs the same special handling as it does in arch/arm/Makefile to cater for the arm720t boot core.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/924b6adf/attachment.sig>
#3 lore raw

PATCH 2/12 arm: include: Import unified.h from Linux kernel

In reply to Marek Vasut
Quoted 24 lines · Marek Vasut

Import unified.h from Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . This header file contains macros used in libgcc functions in Linux kernel on ARM and will be needed for the libgcc sync.

Since unified.h defines the W(instr) macro, we must drop this from the macro from memcpy.S , otherwise this triggers a warning about symbol redefinition. In order to keep the changes to unified.h to the minimum, tweak arch/arm/lib/Makefile such that it defines the CONFIG_ARM_ASM_UNIFIED macro, which places .syntax unified into all of the assembler files. This is mandatory.

Moreover, for Thumb2 build, define CONFIG_THUMB2_KERNEL macro if and only if Thumb2 build is enabled. This macro is checked by unified.h and toggles between ARM and Thumb2 variant of the instructions in the assembler source files.

Finally, this patch defines __LINUX_ARM_ARCH__=N macro based on the new CONFIG_SYS_ARM_ARCH Kconfig option. This macro selects between more optimal and more dense codepaths which work on armv5 and newer and less optimal codepaths which work on armv4 and possible armv3m. Tegra2 needs the same special handling as it does in arch/arm/Makefile to cater for the arm720t boot core.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/2c02fd2c/attachment.sig>
#4 lore raw

PATCH 3/12 arm: lib: Drop underscore from private libgcc filenames

In reply to Marek Vasut

Drop the underscore from the filenames of files implementing libgcc routines. There is no functional change. This change is done to make sync with Linux kernel easier.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/Makefile                    | 6 +++---
 arch/arm/lib/{_ashldi3.S => ashldi3.S}   | 0
 arch/arm/lib/{_ashrdi3.S => ashrdi3.S}   | 0
 arch/arm/lib/{_divsi3.S => divsi3.S}     | 0
 arch/arm/lib/{_lshrdi3.S => lshrdi3.S}   | 0
 arch/arm/lib/{_modsi3.S => modsi3.S}     | 0
 arch/arm/lib/{_udivsi3.S => udivsi3.S}   | 0
 arch/arm/lib/{_uldivmod.S => uldivmod.S} | 0
 arch/arm/lib/{_umodsi3.S => umodsi3.S}   | 0
 9 files changed, 3 insertions(+), 3 deletions(-)
 rename arch/arm/lib/{_ashldi3.S => ashldi3.S} (100%)
 rename arch/arm/lib/{_ashrdi3.S => ashrdi3.S} (100%)
 rename arch/arm/lib/{_divsi3.S => divsi3.S} (100%)
 rename arch/arm/lib/{_lshrdi3.S => lshrdi3.S} (100%)
 rename arch/arm/lib/{_modsi3.S => modsi3.S} (100%)
 rename arch/arm/lib/{_udivsi3.S => udivsi3.S} (100%)
 rename arch/arm/lib/{_uldivmod.S => uldivmod.S} (100%)
 rename arch/arm/lib/{_umodsi3.S => umodsi3.S} (100%)
arch/arm/lib/Makefile +3 -3
index 1112b9e..cafd94d 100644
@@ -5,9 +5,9 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _divsi3.o \
-			_lshrdi3.o _modsi3.o _udivsi3.o _umodsi3.o div0.o \
-			_uldivmod.o
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o divsi3.o \
+			lshrdi3.o modsi3.o udivsi3.o umodsi3.o div0.o \
+			uldivmod.o
 
 ifdef CONFIG_CPU_V7M
 obj-y	+= vectors_m.o crt0.o
arch/arm/lib/ashldi3.S renamed from arch/arm/lib/_ashldi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_ashldi3.S
rename to arch/arm/lib/ashldi3.S
arch/arm/lib/ashrdi3.S renamed from arch/arm/lib/_ashrdi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_ashrdi3.S
rename to arch/arm/lib/ashrdi3.S
arch/arm/lib/divsi3.S renamed from arch/arm/lib/_divsi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_divsi3.S
rename to arch/arm/lib/divsi3.S
arch/arm/lib/lshrdi3.S renamed from arch/arm/lib/_lshrdi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_lshrdi3.S
rename to arch/arm/lib/lshrdi3.S
arch/arm/lib/modsi3.S renamed from arch/arm/lib/_modsi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_modsi3.S
rename to arch/arm/lib/modsi3.S
arch/arm/lib/udivsi3.S renamed from arch/arm/lib/_udivsi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_udivsi3.S
rename to arch/arm/lib/udivsi3.S
arch/arm/lib/uldivmod.S renamed from arch/arm/lib/_uldivmod.S +0 -0
similarity index 100%
rename from arch/arm/lib/_uldivmod.S
rename to arch/arm/lib/uldivmod.S
arch/arm/lib/umodsi3.S renamed from arch/arm/lib/_umodsi3.S +0 -0
similarity index 100%
rename from arch/arm/lib/_umodsi3.S
rename to arch/arm/lib/umodsi3.S
Signature · 1 line
2.7.0
#5 lore raw

PATCH 3/12 arm: lib: Drop underscore from private libgcc filenames

Quoted 9 lines · Marek Vasut

Drop the underscore from the filenames of files implementing libgcc routines. There is no functional change. This change is done to make sync with Linux kernel easier.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/93afa5d6/attachment.sig>
#6 lore raw

PATCH 3/12 arm: lib: Drop underscore from private libgcc filenames

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Drop the underscore from the filenames of files implementing libgcc routines. There is no functional change. This change is done to make sync with Linux kernel easier.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/64af4291/attachment.sig>
#7 lore raw

PATCH 4/12 arm: lib: Sync libgcc shift operations

In reply to Marek Vasut

Sync the libgcc shift operations with Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . Syncing these three files is easy, as there is almost no change in them, except the addition of Thumb support.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/ashldi3.S | 12 ++++++++----
 arch/arm/lib/ashrdi3.S | 12 ++++++++----
 arch/arm/lib/lshrdi3.S | 12 ++++++++----
 3 files changed, 24 insertions(+), 12 deletions(-)
arch/arm/lib/ashldi3.S +8 -4
index 9c34c21..a4f5ebb 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #ifdef __ARMEB__
 #define al r1
@@ -14,15 +15,18 @@
 #define ah r1
 #endif
 
-.globl __ashldi3
-__ashldi3:
+ENTRY(__ashldi3)
 ENTRY(__aeabi_llsl)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
 	movmi	ah, ah, lsl r2
 	movpl	ah, al, lsl r3
-	orrmi	ah, ah, al, lsr ip
+ ARM(	orrmi	ah, ah, al, lsr ip	)
+ THUMB(	lsrmi	r3, al, ip		)
+ THUMB(	orrmi	ah, ah, r3		)
 	mov	al, al, lsl r2
-	mov	pc, lr
+	ret	lr
+
+ENDPROC(__ashldi3)
 ENDPROC(__aeabi_llsl)
arch/arm/lib/ashrdi3.S +8 -4
index c74fd64..c6e1ed3 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #ifdef __ARMEB__
 #define al r1
@@ -14,15 +15,18 @@
 #define ah r1
 #endif
 
-.globl __ashrdi3
-__ashrdi3:
+ENTRY(__ashrdi3)
 ENTRY(__aeabi_lasr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
 	movmi	al, al, lsr r2
 	movpl	al, ah, asr r3
-	orrmi	al, al, ah, lsl ip
+ ARM(	orrmi	al, al, ah, lsl ip	)
+ THUMB(	lslmi	r3, ah, ip		)
+ THUMB(	orrmi	al, al, r3		)
 	mov	ah, ah, asr r2
-	mov	pc, lr
+	ret	lr
+
+ENDPROC(__ashrdi3)
 ENDPROC(__aeabi_lasr)
arch/arm/lib/lshrdi3.S +8 -4
index 1f9b916..9c51141 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #ifdef __ARMEB__
 #define al r1
@@ -14,15 +15,18 @@
 #define ah r1
 #endif
 
-.globl __lshrdi3
-__lshrdi3:
+ENTRY(__lshrdi3)
 ENTRY(__aeabi_llsr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
 	movmi	al, al, lsr r2
 	movpl	al, ah, lsr r3
-	orrmi	al, al, ah, lsl ip
+ ARM(	orrmi	al, al, ah, lsl ip	)
+ THUMB(	lslmi	r3, ah, ip		)
+ THUMB(	orrmi	al, al, r3		)
 	mov	ah, ah, lsr r2
-	mov	pc, lr
+	ret	lr
+
+ENDPROC(__lshrdi3)
 ENDPROC(__aeabi_llsr)
Signature · 1 line
2.7.0
#8 lore raw

PATCH 4/12 arm: lib: Sync libgcc shift operations

Quoted 9 lines · Marek Vasut

Sync the libgcc shift operations with Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . Syncing these three files is easy, as there is almost no change in them, except the addition of Thumb support.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/e9a48b20/attachment.sig>
#9 lore raw

PATCH 4/12 arm: lib: Sync libgcc shift operations

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

Sync the libgcc shift operations with Linux kernel 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . Syncing these three files is easy, as there is almost no change in them, except the addition of Thumb support.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/40d743c9/attachment.sig>
#10 lore raw

PATCH 5/12 arm: lib: Sync libgcc 32b division/modulo operations

In reply to Marek Vasut

Sync the libgcc 32bit division and modulo operations with Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . The functions in these four files are present in lib1funcs.S in Linux, so replace these files with lib1funcs.S from Linux.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro in lib1funcs.S . Moreover, to make all of the functions available, define CONFIG_AEABI , which is safe, because U-Boot is always compiled with ARM EABI.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/Makefile    |   5 +-
 arch/arm/lib/divsi3.S    | 143 -------------------
 arch/arm/lib/lib1funcs.S | 351 +++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/lib/modsi3.S    |  99 -------------
 arch/arm/lib/udivsi3.S   |  95 -------------
 arch/arm/lib/umodsi3.S   |  90 ------------
 6 files changed, 353 insertions(+), 430 deletions(-)
 delete mode 100644 arch/arm/lib/divsi3.S
 create mode 100644 arch/arm/lib/lib1funcs.S
 delete mode 100644 arch/arm/lib/modsi3.S
 delete mode 100644 arch/arm/lib/udivsi3.S
 delete mode 100644 arch/arm/lib/umodsi3.S
arch/arm/lib/Makefile +2 -3
index cafd94d..0b0dbcb 100644
@@ -5,9 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o divsi3.o \
-			lshrdi3.o modsi3.o udivsi3.o umodsi3.o div0.o \
-			uldivmod.o
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o \
+				    lib1funcs.o uldivmod.o div0.o
 
 ifdef CONFIG_CPU_V7M
 obj-y	+= vectors_m.o crt0.o
arch/arm/lib/divsi3.S deleted +0 -143

143 lines not on this page · raw message

arch/arm/lib/lib1funcs.S new file +351 -0

351 lines not on this page · raw message

arch/arm/lib/modsi3.S deleted +0 -99

99 lines not on this page · raw message

arch/arm/lib/udivsi3.S deleted +0 -95

95 lines not on this page · raw message

arch/arm/lib/umodsi3.S deleted +0 -90

90 lines not on this page · raw message

Signature · 1 line
2.7.0
#11 lore raw

PATCH 5/12 arm: lib: Sync libgcc 32b division/modulo operations

Quoted 15 lines · Marek Vasut

Sync the libgcc 32bit division and modulo operations with Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . The functions in these four files are present in lib1funcs.S in Linux, so replace these files with lib1funcs.S from Linux.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro in lib1funcs.S . Moreover, to make all of the functions available, define CONFIG_AEABI , which is safe, because U-Boot is always compiled with ARM EABI.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/60d017fa/attachment.sig>
#12 lore raw

PATCH 5/12 arm: lib: Sync libgcc 32b division/modulo operations

In reply to Marek Vasut
Quoted 15 lines · Marek Vasut

Sync the libgcc 32bit division and modulo operations with Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 . The functions in these four files are present in lib1funcs.S in Linux, so replace these files with lib1funcs.S from Linux.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro in lib1funcs.S . Moreover, to make all of the functions available, define CONFIG_AEABI , which is safe, because U-Boot is always compiled with ARM EABI.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/84f49e00/attachment.sig>
#13 lore raw

PATCH 6/12 arm: lib: Fix uldivmod.S build on Thumb2

In reply to Marek Vasut

This assembler source won't build in Thumb2 mode, so fix it adding the necessary Thumb2 conditional macros from unified.h .

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/uldivmod.S | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/lib/uldivmod.S +3 -5
index 426c2f2..2efcd73 100644
@@ -9,10 +9,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-/* We don't use Thumb instructions for now */
-#define ARM(x...)	x
-#define THUMB(x...)
-
 /*
  * A, Q = r0 + (r1 << 32)
  * B, R = r2 + (r3 << 32)
@@ -226,7 +222,9 @@ THUMB(	orrpl	A_0, A_0, TMP		)
 	@ Shift A to the right by the appropriate amount.
 	rsb	D_1, D_0, #32
 	mov	Q_0, A_0, lsr D_0
-	orr	Q_0, A_1, lsl D_1
+ ARM(   orr     Q_0, Q_0, A_1, lsl D_1	)
+ THUMB(	lsl	A_1, D_1		)
+ THUMB(	orr	Q_0, A_1		)
 	mov	Q_1, A_1, lsr D_0
 	@ Move C to R
 	mov	R_0, C_0
Signature · 1 line
2.7.0
#14 lore raw

PATCH 6/12 arm: lib: Fix uldivmod.S build on Thumb2

Quoted 7 lines · Marek Vasut

This assembler source won't build in Thumb2 mode, so fix it adding the necessary Thumb2 conditional macros from unified.h .

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/2bfbdd12/attachment.sig>
#15 lore raw

PATCH 6/12 arm: lib: Fix uldivmod.S build on Thumb2

In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

This assembler source won't build in Thumb2 mode, so fix it adding the necessary Thumb2 conditional macros from unified.h .

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/19c5f467/attachment.sig>
#16 lore raw

PATCH 7/12 arm: lib: Import __do_div64 from Linux

In reply to Marek Vasut

Import __do_div64 from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This function is for some toolchains, which generate _udivmoddi4() for 64 bit division.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/Makefile |   2 +-
 arch/arm/lib/div64.S  | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/lib/div64.S
arch/arm/lib/Makefile +1 -1
index 0b0dbcb..8945915 100644
@@ -6,7 +6,7 @@
 #
 
 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o \
-				    lib1funcs.o uldivmod.o div0.o
+				    lib1funcs.o uldivmod.o div0.o div64.o
 
 ifdef CONFIG_CPU_V7M
 obj-y	+= vectors_m.o crt0.o
arch/arm/lib/div64.S new file +212 -0

212 lines not on this page · raw message

Signature · 1 line
2.7.0
#17 lore raw

PATCH 7/12 arm: lib: Import __do_div64 from Linux

Quoted 11 lines · Marek Vasut

Import __do_div64 from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This function is for some toolchains, which generate _udivmoddi4() for 64 bit division.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/01172fa4/attachment.sig>
#18 lore raw

PATCH 7/12 arm: lib: Import __do_div64 from Linux

In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Import __do_div64 from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This function is for some toolchains, which generate _udivmoddi4() for 64 bit division.

Since we do not support stack unwinding, instead of importing the whole asm/unwind.h and all the baggage, this patch defines empty UNWIND() macro.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/db00f39b/attachment.sig>
#19 lore raw

PATCH 8/12 arm: lib: Repair Warning: conditional infixes are deprecated in unified syntax

In reply to Marek Vasut

Fix the following warning when building for thumb2 target by tweaking the instruction syntax:

Warning: conditional infixes are deprecated in unified syntax

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/div64.S     | 4 ++--
 arch/arm/lib/lib1funcs.S | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/lib/div64.S +2 -2
index 03986c2..a42a0f0 100644
@@ -88,8 +88,8 @@ UNWIND(.fnstart)
  	@ Break out early if dividend reaches 0.
 2:	cmp	xh, yl
 	orrcs	yh, yh, ip
-	subcss	xh, xh, yl
-	movnes	ip, ip, lsr #1
+	subscs	xh, xh, yl
+	movsne	ip, ip, lsr #1
 	mov	yl, yl, lsr #1
 	bne	2b
 
arch/arm/lib/lib1funcs.S +2 -2
index 5871dbe..c343ea9 100644
@@ -84,7 +84,7 @@
 	subhs	\dividend, \dividend, \divisor, lsr #3
 	orrhs	\result,   \result,   \curbit,  lsr #3
 	cmp	\dividend, #0			@ Early termination?
-	movnes	\curbit,   \curbit,  lsr #4	@ No, any more bits to do?
+	movsne	\curbit,   \curbit,  lsr #4	@ No, any more bits to do?
 	movne	\divisor,  \divisor, lsr #4
 	bne	1b
 
@@ -170,7 +170,7 @@
 	subhs	\dividend, \dividend, \divisor, lsr #3
 	cmp	\dividend, #1
 	mov	\divisor, \divisor, lsr #4
-	subges	\order, \order, #4
+	subsge	\order, \order, #4
 	bge	1b
 
 	tst	\order, #3
Signature · 1 line
2.7.0
#20 lore raw

PATCH 8/12 arm: lib: Repair Warning: conditional infixes are deprecated in unified syntax

Quoted 10 lines · Marek Vasut

Fix the following warning when building for thumb2 target by tweaking the instruction syntax:

Warning: conditional infixes are deprecated in unified syntax

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/e54ada62/attachment.sig>
#21 lore raw

PATCH 8/12 arm: lib: Repair Warning: conditional infixes are deprecated in unified syntax

In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Fix the following warning when building for thumb2 target by tweaking the instruction syntax:

Warning: conditional infixes are deprecated in unified syntax

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/838f2eba/attachment.sig>
#22 lore raw

PATCH 9/12 arm: lib: import muldi3.S from Linux

In reply to Marek Vasut

Import muldi3.S from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This file implements __aeabi_lmul and it's alias __muldi3, which is needed when doing Thumb1 builds.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/Makefile |  3 ++-
 arch/arm/lib/muldi3.S | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/lib/muldi3.S
arch/arm/lib/Makefile +2 -1
index 8945915..86489fd 100644
@@ -6,7 +6,8 @@
 #
 
 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o \
-				    lib1funcs.o uldivmod.o div0.o div64.o
+				    lib1funcs.o uldivmod.o div0.o \
+				    div64.o muldi3.o
 
 ifdef CONFIG_CPU_V7M
 obj-y	+= vectors_m.o crt0.o
arch/arm/lib/muldi3.S new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.7.0
#23 lore raw

PATCH 9/12 arm: lib: import muldi3.S from Linux

Quoted 8 lines · Marek Vasut

Import muldi3.S from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This file implements __aeabi_lmul and it's alias __muldi3, which is needed when doing Thumb1 builds.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/b5187b33/attachment.sig>
#24 lore raw

PATCH 9/12 arm: lib: import muldi3.S from Linux

In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

Import muldi3.S from Linux 4.4.6 , commit 0d1912303e54ed1b2a371be0bba51c384dd57326 on arm32. This file implements __aeabi_lmul and it's alias __muldi3, which is needed when doing Thumb1 builds.

This patch also defines CONFIG_THUMB2_KERNEL and CONFIG_ARM_ASM_UNIFIED which is necessary for correct build of these files both in ARM and Thumb mode, just like Linux does.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/020e658b/attachment.sig>
#25 lore raw

PATCH 10/12 arm: lib: Import Thumb1 functions

In reply to Marek Vasut

Import functions into lib1funcs.S which are required for Thumb1 build. These functions come from gcc 5.3.1 release.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/lib1funcs.S | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
arch/arm/lib/lib1funcs.S +53 -0
index c343ea9..408839b 100644
@@ -349,3 +349,56 @@ UNWIND(.save {lr})
 	ldr	pc, [sp], #8
 UNWIND(.fnend)
 ENDPROC(Ldiv0)
+
+/* Thumb-1 specialities */
+#if defined(CONFIG_SYS_THUMB_BUILD) && !defined(CONFIG_HAS_THUMB2)
+ENTRY(__gnu_thumb1_case_sqi)
+	push	{r1}
+	mov	r1, lr
+	lsrs	r1, r1, #1
+	lsls	r1, r1, #1
+	ldrsb	r1, [r1, r0]
+	lsls	r1, r1, #1
+	add	lr, lr, r1
+	pop	{r1}
+	bx	lr
+ENDPROC(__gnu_thumb1_case_sqi)
+
+ENTRY(__gnu_thumb1_case_uqi)
+	push	{r1}
+	mov	r1, lr
+	lsrs	r1, r1, #1
+	lsls	r1, r1, #1
+	ldrb	r1, [r1, r0]
+	lsls	r1, r1, #1
+	add	lr, lr, r1
+	pop	{r1}
+	bx	lr
+ENDPROC(__gnu_thumb1_case_uqi)
+
+ENTRY(__gnu_thumb1_case_shi)
+	push	{r0, r1}
+	mov	r1, lr
+	lsrs	r1, r1, #1
+	lsls	r0, r0, #1
+	lsls	r1, r1, #1
+	ldrsh	r1, [r1, r0]
+	lsls	r1, r1, #1
+	add	lr, lr, r1
+	pop	{r0, r1}
+	bx	lr
+ENDPROC(__gnu_thumb1_case_shi)
+
+ENTRY(__gnu_thumb1_case_uhi)
+	push	{r0, r1}
+	mov	r1, lr
+	lsrs	r1, r1, #1
+	lsls	r0, r0, #1
+	lsls	r1, r1, #1
+	ldrh	r1, [r1, r0]
+	lsls	r1, r1, #1
+	add	lr, lr, r1
+	pop	{r0, r1}
+	bx	lr
+ENDPROC(__gnu_thumb1_case_uhi)
+#endif
Signature · 1 line
2.7.0
#26 lore raw

PATCH 10/12 arm: lib: Import Thumb1 functions

Quoted 8 lines · Marek Vasut

Import functions into lib1funcs.S which are required for Thumb1 build. These functions come from gcc 5.3.1 release.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/d57a3f0d/attachment.sig>
#27 lore raw

PATCH 10/12 arm: lib: Import Thumb1 functions

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

Import functions into lib1funcs.S which are required for Thumb1 build. These functions come from gcc 5.3.1 release.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/1ba4a299/attachment.sig>
#28 lore raw

PATCH 11/12 arm: lib: Split asm symbols into different .text subsections

In reply to Marek Vasut

Split each symbol in lib1funcs into different .text.foo section instead of placing all of them into plain .text . This allows the linker to collect and discard unused assembler symbols.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/lib/ashldi3.S   |  2 ++
 arch/arm/lib/ashrdi3.S   |  2 ++
 arch/arm/lib/div64.S     |  2 ++
 arch/arm/lib/lib1funcs.S | 25 +++++++++++++++++++++++++
 arch/arm/lib/lshrdi3.S   |  2 ++
 arch/arm/lib/muldi3.S    |  2 ++
 arch/arm/lib/uldivmod.S  |  3 +++
 7 files changed, 38 insertions(+)
arch/arm/lib/ashldi3.S +2 -0
index a4f5ebb..6c9ae91 100644
@@ -17,6 +17,7 @@
 
 ENTRY(__ashldi3)
 ENTRY(__aeabi_llsl)
+.pushsection .text.__ashldi3, "ax"
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -28,5 +29,6 @@ ENTRY(__aeabi_llsl)
 	mov	al, al, lsl r2
 	ret	lr
 
+.popsection
 ENDPROC(__ashldi3)
 ENDPROC(__aeabi_llsl)
arch/arm/lib/ashrdi3.S +2 -0
index c6e1ed3..3eb59ec 100644
@@ -17,6 +17,7 @@
 
 ENTRY(__ashrdi3)
 ENTRY(__aeabi_lasr)
+.pushsection .text.__ashrdi3, "ax"
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -28,5 +29,6 @@ ENTRY(__aeabi_lasr)
 	mov	ah, ah, asr r2
 	ret	lr
 
+.popsection
 ENDPROC(__ashrdi3)
 ENDPROC(__aeabi_lasr)
arch/arm/lib/div64.S +2 -0
index a42a0f0..5bfb41d 100644
@@ -47,6 +47,7 @@
 
 ENTRY(__do_div64)
 UNWIND(.fnstart)
+.pushsection .text.__do_div64, "ax"
 
 	@ Test for easy paths first.
 	subs	ip, r4, #1
@@ -192,6 +193,7 @@ UNWIND(.fnstart)
 	moveq	yh, xh
 	moveq	xh, #0
 	reteq	lr
+.popsection
 UNWIND(.fnend)
 
 UNWIND(.fnstart)
arch/arm/lib/lib1funcs.S +25 -0
index 408839b..f1becda 100644
@@ -196,6 +196,7 @@
 ENTRY(__udivsi3)
 ENTRY(__aeabi_uidiv)
 UNWIND(.fnstart)
+.pushsection .text.__udivsi3, "ax"
 
 	subs	r2, r1, #1
 	reteq	lr
@@ -219,12 +220,14 @@ UNWIND(.fnstart)
 	mov	r0, r0, lsr r2
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__udivsi3)
 ENDPROC(__aeabi_uidiv)
 
 ENTRY(__umodsi3)
 UNWIND(.fnstart)
+.pushsection .text.__umodsi3, "ax"
 
 	subs	r2, r1, #1			@ compare divisor with 1
 	bcc	Ldiv0
@@ -238,12 +241,14 @@ UNWIND(.fnstart)
 
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__umodsi3)
 
 ENTRY(__divsi3)
 ENTRY(__aeabi_idiv)
 UNWIND(.fnstart)
+.pushsection .text.__divsi3, "ax"
 
 	cmp	r1, #0
 	eor	ip, r0, r1			@ save the sign of the result.
@@ -280,12 +285,14 @@ UNWIND(.fnstart)
 	rsbmi	r0, r0, #0
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__divsi3)
 ENDPROC(__aeabi_idiv)
 
 ENTRY(__modsi3)
 UNWIND(.fnstart)
+.pushsection .text.__modsi3, "ax"
 
 	cmp	r1, #0
 	beq	Ldiv0
@@ -305,6 +312,7 @@ UNWIND(.fnstart)
 	rsbmi	r0, r0, #0
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__modsi3)
 
@@ -313,6 +321,7 @@ ENDPROC(__modsi3)
 ENTRY(__aeabi_uidivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
+.pushsection .text.__aeabi_uidivmod, "ax"
 
 	stmfd	sp!, {r0, r1, ip, lr}
 	bl	__aeabi_uidiv
@@ -321,12 +330,15 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	sub	r1, r1, r3
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__aeabi_uidivmod)
 
 ENTRY(__aeabi_idivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
+.pushsection .text.__aeabi_uidivmod, "ax"
+
 	stmfd	sp!, {r0, r1, ip, lr}
 	bl	__aeabi_idiv
 	ldmfd	sp!, {r1, r2, ip, lr}
@@ -334,6 +346,7 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	sub	r1, r1, r3
 	ret	lr
 
+.popsection
 UNWIND(.fnend)
 ENDPROC(__aeabi_idivmod)
 
@@ -343,16 +356,21 @@ Ldiv0:
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
+.pushsection .text.Ldiv0, "ax"
+
 	str	lr, [sp, #-8]!
 	bl	__div0
 	mov	r0, #0			@ About as wrong as it could be.
 	ldr	pc, [sp], #8
+
+.popsection
 UNWIND(.fnend)
 ENDPROC(Ldiv0)
 
 /* Thumb-1 specialities */
 #if defined(CONFIG_SYS_THUMB_BUILD) && !defined(CONFIG_HAS_THUMB2)
 ENTRY(__gnu_thumb1_case_sqi)
+.pushsection .text.__gnu_thumb1_case_sqi, "ax"
 	push	{r1}
 	mov	r1, lr
 	lsrs	r1, r1, #1
@@ -362,9 +380,11 @@ ENTRY(__gnu_thumb1_case_sqi)
 	add	lr, lr, r1
 	pop	{r1}
 	bx	lr
+.popsection
 ENDPROC(__gnu_thumb1_case_sqi)
 
 ENTRY(__gnu_thumb1_case_uqi)
+.pushsection .text.__gnu_thumb1_case_uqi, "ax"
 	push	{r1}
 	mov	r1, lr
 	lsrs	r1, r1, #1
@@ -374,9 +394,11 @@ ENTRY(__gnu_thumb1_case_uqi)
 	add	lr, lr, r1
 	pop	{r1}
 	bx	lr
+.popsection
 ENDPROC(__gnu_thumb1_case_uqi)
 
 ENTRY(__gnu_thumb1_case_shi)
+.pushsection .text.__gnu_thumb1_case_shi, "ax"
 	push	{r0, r1}
 	mov	r1, lr
 	lsrs	r1, r1, #1
@@ -387,9 +409,11 @@ ENTRY(__gnu_thumb1_case_shi)
 	add	lr, lr, r1
 	pop	{r0, r1}
 	bx	lr
+.popsection
 ENDPROC(__gnu_thumb1_case_shi)
 
 ENTRY(__gnu_thumb1_case_uhi)
+.pushsection .text.__gnu_thumb1_case_uhi, "ax"
 	push	{r0, r1}
 	mov	r1, lr
 	lsrs	r1, r1, #1
@@ -400,5 +424,6 @@ ENTRY(__gnu_thumb1_case_uhi)
 	add	lr, lr, r1
 	pop	{r0, r1}
 	bx	lr
+.popsection
 ENDPROC(__gnu_thumb1_case_uhi)
 #endif
arch/arm/lib/lshrdi3.S +2 -0
index 9c51141..f710ccb 100644
@@ -17,6 +17,7 @@
 
 ENTRY(__lshrdi3)
 ENTRY(__aeabi_llsr)
+.pushsection .text.__lshldi3, "ax"
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -28,5 +29,6 @@ ENTRY(__aeabi_llsr)
 	mov	ah, ah, lsr r2
 	ret	lr
 
+.popsection
 ENDPROC(__lshrdi3)
 ENDPROC(__aeabi_llsr)
arch/arm/lib/muldi3.S +2 -0
index daa5704..bc255c5 100644
@@ -25,6 +25,7 @@
 
 ENTRY(__muldi3)
 ENTRY(__aeabi_lmul)
+.pushsection .text.__muldi3, "ax"
 
 	mul	xh, yl, xh
 	mla	xh, xl, yh, xh
@@ -42,5 +43,6 @@ ENTRY(__aeabi_lmul)
 	adc	xh, xh, ip, lsr #16
 	ret	lr
 
+.popsection
 ENDPROC(__muldi3)
 ENDPROC(__aeabi_lmul)
arch/arm/lib/uldivmod.S +3 -0
index 2efcd73..bbc44c6 100644
@@ -34,6 +34,8 @@ TMP	.req	r8
 )
 
 ENTRY(__aeabi_uldivmod)
+.pushsection .text.__aeabi_uldivmod, "ax"
+
 	stmfd	sp!, {r4, r5, r6, r7, THUMB(TMP,) lr}
 	@ Test if B == 0
 	orrs	ip, B_0, B_1		@ Z set -> B == 0
@@ -240,4 +242,5 @@ L_div_by_0:
 	mov	R_0, #0
 	mov	R_1, #0
 	ldmfd	sp!, {r4, r5, r6, r7, THUMB(TMP,) pc}
+.popsection
 ENDPROC(__aeabi_uldivmod)
Signature · 1 line
2.7.0
#29 lore raw

PATCH 11/12 arm: lib: Split asm symbols into different .text subsections

Quoted 9 lines · Marek Vasut

Split each symbol in lib1funcs into different .text.foo section instead of placing all of them into plain .text . This allows the linker to collect and discard unused assembler symbols.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/13ef4dc6/attachment.sig>
#30 lore raw

PATCH 11/12 arm: lib: Split asm symbols into different .text subsections

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Split each symbol in lib1funcs into different .text.foo section instead of placing all of them into plain .text . This allows the linker to collect and discard unused assembler symbols.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/2e2ed6ea/attachment.sig>
#31 lore raw

PATCH 11/12 arm: lib: Split asm symbols into different .text subsections

In reply to Marek Vasut
Quoted 3 lines · Marek Vasut

Split each symbol in lib1funcs into different .text.foo section instead of placing all of them into plain .text . This allows the linker to collect and discard unused assembler symbols.

This patch causes Tegra-boards-that-use-SPL (i.e. all ARMv7 boards but not ARMv8) to fail to boot with zero output. Taking u-boot.git master branch and reverting this one patch is enough to make U-Boot work again.

I haven't investigated how to solve this yet. Likely relevant background:

32-bit Tegra SPL runs on an ARM1176 CPU whereas main U-Boot runs on an ARMv7 CPU. We need to use PRIVATE_LIBGCC (at least for SPL) since the libgcc in the toolchains we use is compiled for ARMv7, and hence picking it up in SPL breaks boot. I wonder if these section name changes are causing the linker to pull in the toolchain's libgcc rather than using U-Boot's copy compiled for ARM1176?

#32 lore raw

PATCH 12/12 lib: Enable private libgcc by default

In reply to Marek Vasut

This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain.

This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

---
V2: Enable the private libgcc only for ARM<=7 and MIPS

---
 lib/Kconfig | 1 +
 1 file changed, 1 insertion(+)
lib/Kconfig +1 -0
index 2b97c2b..02ca405 100644
@@ -14,6 +14,7 @@ config HAVE_PRIVATE_LIBGCC
 config USE_PRIVATE_LIBGCC
 	bool "Use private libgcc"
 	depends on HAVE_PRIVATE_LIBGCC
+	default y if HAVE_PRIVATE_LIBGCC && ((ARM && !ARM64) || MIPS)
 	help
 	  This option allows you to use the built-in libgcc implementation
 	  of U-Boot instead of the one provided by the compiler.
Signature · 1 line
2.7.0
#33 lore raw

PATCH 12/12 lib: Enable private libgcc by default

Quoted 16 lines · Marek Vasut

This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain.

This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways.

Quoted 5 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/50abc5f5/attachment.sig>
#34 lore raw

PATCH 12/12 lib: Enable private libgcc by default

In reply to Marek Vasut
Quoted 16 lines · Marek Vasut

This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain.

This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

And since this change was contentious when previously proposed, I'm going to explain why I'm taking this now. There are a number of correctly configured toolchains out there today that fail to build U-Boot on some platforms. This is because we're giving the compiler conflicting requests (build soft-float! use whatever libgcc you have!). The era of multilib toolchains being prevalent (at least for 32bit ARM) is long over. The right thing to have done, always, would be to provide the required functions ourselves so that we are in control. So, thanks again Marek for following up on the series as I had asked you to, this fixes build failures for me on about a dozen platforms.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/fd3ac1fa/attachment.sig>
#35 lore raw

PATCH 12/12 lib: Enable private libgcc by default

Quoted 27 lines · Tom Rini
Quoted 16 lines · Marek Vasut

This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain.

This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Quoted 10 lines

And since this change was contentious when previously proposed, I'm going to explain why I'm taking this now. There are a number of correctly configured toolchains out there today that fail to build U-Boot on some platforms. This is because we're giving the compiler conflicting requests (build soft-float! use whatever libgcc you have!). The era of multilib toolchains being prevalent (at least for 32bit ARM) is long over. The right thing to have done, always, would be to provide the required functions ourselves so that we are in control. So, thanks again Marek for following up on the series as I had asked you to, this fixes build failures for me on about a dozen platforms.

Thank you Marek!

- Simon

#36 lore raw

PATCH 12/12 lib: Enable private libgcc by default

Quoted 5 lines

The toolchain can usually
generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot.

I agree with this change but is this even true? my toolchain(linaro) has 28 different versions of libgcc.a

Thanks
Michael

Quoted 47 lines · Simon Glass
Quoted 27 lines · Tom Rini
Quoted 16 lines · Marek Vasut

This patch decouples U-Boot binary from the toolchain on systems where private libgcc is available. Instead of pulling in functions provided by the libgcc from the toolchain, U-Boot will use it's own set of libgcc functions. These functions are usually imported from Linux kernel, which also uses it's own libgcc functions instead of the ones provided by the toolchain.

This patch solves a rather common problem. The toolchain can usually generate code for many variants of target architecture and often even different endianness. The libgcc on the other hand is usually compiled for one particular configuration and the functions provided by it may or may not be suited for use in U-Boot. This can manifest in two ways, either the U-Boot fails to compile altogether and linker will complain or, in the much worse case, the resulting U-Boot will build, but will misbehave in very subtle and hard to debug ways.

Quoted 6 lines
Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Quoted 10 lines

And since this change was contentious when previously proposed, I'm going to explain why I'm taking this now. There are a number of correctly configured toolchains out there today that fail to build U-Boot on some platforms. This is because we're giving the compiler conflicting requests (build soft-float! use whatever libgcc you have!). The era of multilib toolchains being prevalent (at least for 32bit ARM) is long over. The right thing to have done, always, would be to provide the required functions ourselves so that we are in control. So, thanks again Marek for following up on the series as I had asked you to, this fixes build failures for me on about a dozen platforms.

Thank you Marek!

- Simon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#37 lore raw

PATCH 1/12 arm: config: Introduce CONFIG_SYS_ARM_ARCH

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Introduce new helper Kconfig option, which is automatically set to the version of ARM architecture for which the U-Boot is built. This is useful when selecting tuning options in the libgcc imported from Linux kernel.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160602/8c98e9ee/attachment.sig>
#38 lore raw

PATCH 1/12 arm: config: Introduce CONFIG_SYS_ARM_ARCH

In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

Introduce new helper Kconfig option, which is automatically set to the version of ARM architecture for which the U-Boot is built. This is useful when selecting tuning options in the libgcc imported from Linux kernel.

Cc Albert Aribaud <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160603/72313ed5/attachment.sig>