public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
@ 2009-06-20  9:33 Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20  9:33 ` [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20  9:33 UTC (permalink / raw)
  To: u-boot

This patch moves the libgcc Makefile inclusion from the toplevel Makefile to
the arch_config.mk files. This is in preparation for the ARM architecture to
move away from including libgcc function and only using self-contained U-Boot
functions as done in Linux.

Currently in the next branch all the ARM boards that use the nand are broken due
to the adding of the 64 Bit device size support. In the past we have seen
problems with different toolchains due to EABI, FPU as example.
With this patch and the following one we move away from all these problems and
we will be able to have full control to have a functions embedded into u-boot.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
Rebased against current HEAD

Best Regards,
J.
 Makefile                 |    2 +-
 api_examples/Makefile    |    4 +---
 arm_config.mk            |    2 ++
 avr32_config.mk          |    2 ++
 blackfin_config.mk       |    2 ++
 board/netstar/Makefile   |    4 +---
 board/sl8245/config.mk   |    1 -
 board/trab/Makefile      |    2 --
 board/voiceblue/Makefile |    4 +---
 examples/Makefile        |    2 +-
 i386_config.mk           |    2 ++
 m68k_config.mk           |    2 ++
 microblaze_config.mk     |    2 ++
 mips_config.mk           |    2 ++
 nios2_config.mk          |    2 ++
 nios_config.mk           |    2 ++
 ppc_config.mk            |    2 ++
 sh_config.mk             |    2 ++
 sparc_config.mk          |    2 ++
 19 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 6a2dd9f..8035831 100644
--- a/Makefile
+++ b/Makefile
@@ -288,7 +288,7 @@ LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
 # Add GCC lib
-PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 
 ifeq ($(CONFIG_NAND_U_BOOT),y)
 NAND_SPL = nand_spl
diff --git a/api_examples/Makefile b/api_examples/Makefile
index 4c01437..4bfa7e6 100644
--- a/api_examples/Makefile
+++ b/api_examples/Makefile
@@ -56,8 +56,6 @@ OBJS	:= $(addprefix $(obj),$(COBJS))
 ELF	:= $(addprefix $(obj),$(ELF))
 BIN	:= $(addprefix $(obj),$(BIN))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
 CPPFLAGS += -I..
 
 all:	$(obj).depend $(OBJS) $(LIB) $(ELF) $(BIN)
@@ -70,7 +68,7 @@ $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \
 			-o $@ $< $(LIB) \
-			-L$(gcclibdir) -lgcc
+			$(PLATFORM_LIBGCC)
 
 $(BIN):
 $(obj)%.bin:	$(obj)%
diff --git a/arm_config.mk b/arm_config.mk
index c4cf99d..b88a3f2 100644
--- a/arm_config.mk
+++ b/arm_config.mk
@@ -24,3 +24,5 @@
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 LDSCRIPT := $(SRCTREE)/cpu/$(CPU)/u-boot.lds
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/avr32_config.mk b/avr32_config.mk
index 441caa4..8569d5f 100644
--- a/avr32_config.mk
+++ b/avr32_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_LDFLAGS	+= --relax
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/blackfin_config.mk b/blackfin_config.mk
index 989e976..1534c0d 100644
--- a/blackfin_config.mk
+++ b/blackfin_config.mk
@@ -60,3 +60,5 @@ LDR_FLAGS += $(LDR_FLAGS-y)
 ifeq ($(wildcard $(TOPDIR)/board/$(BOARD)/u-boot.lds*),)
 LDSCRIPT = $(obj)lib_$(ARCH)/u-boot.lds
 endif
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/board/netstar/Makefile b/board/netstar/Makefile
index 91bac38..1cc2722 100644
--- a/board/netstar/Makefile
+++ b/board/netstar/Makefile
@@ -36,8 +36,6 @@ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \
 OBJS	:= $(addprefix $(obj),$(COBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
 LOAD_ADDR = 0x10400000
 LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
 lnk = $(if $(obj),$(obj),.)
@@ -55,7 +53,7 @@ $(obj)eeprom.srec:	$(obj)eeprom.o $(obj)eeprom_start.o
 		-o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
 		-L$(obj)../../examples -lstubs \
 		-L$(obj)../../lib_generic -lgeneric \
-		-L$(gcclibdir) -lgcc
+		$(PLATFROM_LIBGCC)
 	$(OBJCOPY) -O srec $(<:.o=) $@
 
 $(obj)eeprom.bin:	$(obj)eeprom.srec
diff --git a/board/sl8245/config.mk b/board/sl8245/config.mk
index 022512b..299fc6c 100644
--- a/board/sl8245/config.mk
+++ b/board/sl8245/config.mk
@@ -28,4 +28,3 @@
 TEXT_BASE = 0xFFF00000
 
 PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
-PLATFORM_LIBS += $(shell $(CC) -print-libgcc-file-name)
diff --git a/board/trab/Makefile b/board/trab/Makefile
index 30e5fbb..a3661c4 100644
--- a/board/trab/Makefile
+++ b/board/trab/Makefile
@@ -36,8 +36,6 @@ SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
 OBJS_FKT := $(addprefix $(obj),$(COBJS_FKT))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
 LOAD_ADDR = 0xc100000
 
 #########################################################################
diff --git a/board/voiceblue/Makefile b/board/voiceblue/Makefile
index e7c1cbb..0d1e079 100644
--- a/board/voiceblue/Makefile
+++ b/board/voiceblue/Makefile
@@ -33,8 +33,6 @@ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c eeprom_start.S
 OBJS	:= $(addprefix $(obj),$(COBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
 LOAD_ADDR = 0x10400000
 LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
 lnk = $(if $(obj),$(obj),.)
@@ -49,7 +47,7 @@ $(obj)eeprom.srec:	$(obj)eeprom.o $(obj)eeprom_start.o
 		-o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
 		-L$(obj)../../examples -lstubs \
 		-L$(obj)../../lib_generic -lgeneric \
-		-L$(gcclibdir) -lgcc
+		$(PLATFROM_LIBGCC)
 	$(OBJCOPY) -O srec $(<:.o=) $@
 
 $(obj)eeprom.bin:	$(obj)eeprom.srec
diff --git a/examples/Makefile b/examples/Makefile
index dbcfa92..5bd13f1 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -178,7 +178,7 @@ $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-			-L$(gcclibdir) -lgcc
+			$(PLATFORM_LIBGCC)
 
 $(SREC):
 $(obj)%.srec:	$(obj)%
diff --git a/i386_config.mk b/i386_config.mk
index 9e6d37d..03b2538 100644
--- a/i386_config.mk
+++ b/i386_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/m68k_config.mk b/m68k_config.mk
index 12bd27c..f0c963b 100644
--- a/m68k_config.mk
+++ b/m68k_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/microblaze_config.mk b/microblaze_config.mk
index e44c79e..5f78c5c 100644
--- a/microblaze_config.mk
+++ b/microblaze_config.mk
@@ -25,3 +25,5 @@
 #
 
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/mips_config.mk b/mips_config.mk
index 05eb05d..3ae6c19 100644
--- a/mips_config.mk
+++ b/mips_config.mk
@@ -23,6 +23,8 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
+PLATFORM_LIBGCC  += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+
 #
 # From Linux arch/mips/Makefile
 #
diff --git a/nios2_config.mk b/nios2_config.mk
index 3f23b56..1bf4992 100644
--- a/nios2_config.mk
+++ b/nios2_config.mk
@@ -24,3 +24,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/nios_config.mk b/nios_config.mk
index 1cf0f32..d72db7d 100644
--- a/nios_config.mk
+++ b/nios_config.mk
@@ -23,3 +23,5 @@
 #
 
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/ppc_config.mk b/ppc_config.mk
index c95b3b1..74a4f11 100644
--- a/ppc_config.mk
+++ b/ppc_config.mk
@@ -24,6 +24,8 @@
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+
 #
 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
 # will pick up a va_list declaration that is incompatible with the
diff --git a/sh_config.mk b/sh_config.mk
index 49d50f7..311699a 100644
--- a/sh_config.mk
+++ b/sh_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/sparc_config.mk b/sparc_config.mk
index 87f745f..15d2f5b 100644
--- a/sparc_config.mk
+++ b/sparc_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
-- 
1.6.3.1

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

* [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore
  2009-06-20  9:33 [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20  9:33 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-21 12:25   ` Dirk Behme
  2009-06-20 10:18 ` [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Mike Frysinger
  2009-07-04 21:52 ` Wolfgang Denk
  2 siblings, 1 reply; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20  9:33 UTC (permalink / raw)
  To: u-boot

This patch removes the inclusion of libgcc functions into U-Boot on the ARM
architecture. Only the really needed functions are provided in the lib_arm
directory. Those implementations are copied from Linux where they are well
proven related to reliably, performance.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
Rebased against current HEAD

Best Regards,
J.
 Makefile                          |   11 +-
 arm_config.mk                     |    2 +-
 board/trab/u-boot.lds             |    2 +-
 include/asm-arm/assembler.h       |  112 ++++++++++++
 include/asm-arm/linkage.h         |   11 ++
 include/linux/linkage.h           |   95 ++++++++++
 lib_arm/Makefile                  |   10 +-
 lib_arm/_divsi3.S                 |  140 ---------------
 lib_arm/_modsi3.S                 |   99 -----------
 lib_arm/_udivsi3.S                |   77 --------
 lib_arm/_umodsi3.S                |   88 ----------
 lib_arm/{_ashldi3.S => ashldi3.S} |    9 +-
 lib_arm/{_ashrdi3.S => ashrdi3.S} |    9 +-
 lib_arm/lib1funcs.S               |  348 +++++++++++++++++++++++++++++++++++++
 lib_arm/{_ashrdi3.S => lshrdi3.S} |   13 +-
 15 files changed, 603 insertions(+), 423 deletions(-)
 create mode 100644 include/asm-arm/assembler.h
 create mode 100644 include/asm-arm/linkage.h
 create mode 100644 include/linux/linkage.h
 delete mode 100644 lib_arm/_divsi3.S
 delete mode 100644 lib_arm/_modsi3.S
 delete mode 100644 lib_arm/_udivsi3.S
 delete mode 100644 lib_arm/_umodsi3.S
 rename lib_arm/{_ashldi3.S => ashldi3.S} (93%)
 copy lib_arm/{_ashrdi3.S => ashrdi3.S} (93%)
 create mode 100644 lib_arm/lib1funcs.S
 rename lib_arm/{_ashrdi3.S => lshrdi3.S} (90%)

diff --git a/Makefile b/Makefile
index 8035831..4cc2be7 100644
--- a/Makefile
+++ b/Makefile
@@ -228,7 +228,6 @@ endif
 ifeq ($(CPU),ixp)
 LIBS += cpu/ixp/npe/libnpe.a
 endif
-LIBS += lib_$(ARCH)/lib$(ARCH).a
 LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
 	fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a \
 	fs/ubifs/libubifs.a
@@ -287,6 +286,9 @@ LIBS := $(addprefix $(obj),$(LIBS))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+LIBARCH = lib_$(ARCH)/lib$(ARCH).a
+LIBARCH := $(addprefix $(obj),$(LIBARCH))
+
 # Add GCC lib
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 
@@ -301,7 +303,7 @@ U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
 endif
 
 __OBJS := $(subst $(obj),,$(OBJS))
-__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
+__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD)) $(subst $(obj),,$(LIBARCH))
 
 #########################################################################
 #########################################################################
@@ -362,13 +364,16 @@ endif
 $(OBJS):	depend
 		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
+$(LIBARCH):	depend
+		$(MAKE) -C $(dir $(subst $(obj),,$@))
+
 $(LIBS):	depend $(SUBDIRS)
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
 $(LIBBOARD):	depend $(LIBS)
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-$(SUBDIRS):	depend
+$(SUBDIRS):	depend $(LIBARCH)
 		$(MAKE) -C $@ all
 
 $(LDSCRIPT):	depend
diff --git a/arm_config.mk b/arm_config.mk
index b88a3f2..0d6cd24 100644
--- a/arm_config.mk
+++ b/arm_config.mk
@@ -25,4 +25,4 @@ PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 LDSCRIPT := $(SRCTREE)/cpu/$(CPU)/u-boot.lds
 
-PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+PLATFORM_LIBGCC += -L$(OBJTREE)/lib_arm -larm
diff --git a/board/trab/u-boot.lds b/board/trab/u-boot.lds
index d8bcfa4..a83853e 100644
--- a/board/trab/u-boot.lds
+++ b/board/trab/u-boot.lds
@@ -33,7 +33,7 @@ SECTIONS
 	.text      :
 	{
 	  cpu/arm920t/start.o	(.text)
-	  lib_arm/_umodsi3.o	(.text)
+	  lib_arm/lib1funcs.o	(.text)
 	  lib_generic/zlib.o	(.text)
 	  lib_generic/crc32.o	(.text)
 	  lib_generic/string.o	(.text)
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
new file mode 100644
index 0000000..c7916d1
--- /dev/null
+++ b/include/asm-arm/assembler.h
@@ -0,0 +1,112 @@
+/*
+ *  arch/arm/include/asm/assembler.h
+ *
+ *  Copyright (C) 1996-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *  This file contains arm architecture specific defines
+ *  for the different processors.
+ *
+ *  Do not include any C declarations in this file - it is included by
+ *  assembler source.
+ */
+#include <asm/ptrace.h>
+
+/*
+ * Endian independent macros for shifting bytes within registers.
+ */
+#ifndef __ARMEB__
+#define pull            lsr
+#define push            lsl
+#define get_byte_0      lsl #0
+#define get_byte_1	lsr #8
+#define get_byte_2	lsr #16
+#define get_byte_3	lsr #24
+#define put_byte_0      lsl #0
+#define put_byte_1	lsl #8
+#define put_byte_2	lsl #16
+#define put_byte_3	lsl #24
+#else
+#define pull            lsl
+#define push            lsr
+#define get_byte_0	lsr #24
+#define get_byte_1	lsr #16
+#define get_byte_2	lsr #8
+#define get_byte_3      lsl #0
+#define put_byte_0	lsl #24
+#define put_byte_1	lsl #16
+#define put_byte_2	lsl #8
+#define put_byte_3      lsl #0
+#endif
+
+/*
+ * Data preload for architectures that support it
+ */
+#if __LINUX_ARM_ARCH__ >= 5
+#define PLD(code...)	code
+#else
+#define PLD(code...)
+#endif
+
+/*
+ * This can be used to enable code to cacheline align the destination
+ * pointer when bulk writing to memory.  Experiments on StrongARM and
+ * XScale didn't show this a worthwhile thing to do when the cache is not
+ * set to write-allocate (this would need further testing on XScale when WA
+ * is used).
+ *
+ * On Feroceon there is much to gain however, regardless of cache mode.
+ */
+#ifdef CONFIG_CPU_FEROCEON
+#define CALGN(code...) code
+#else
+#define CALGN(code...)
+#endif
+
+/*
+ * Enable and disable interrupts
+ */
+#if __LINUX_ARM_ARCH__ >= 6
+	.macro	disable_irq
+	cpsid	i
+	.endm
+
+	.macro	enable_irq
+	cpsie	i
+	.endm
+#else
+	.macro	disable_irq
+	msr	cpsr_c, #PSR_I_BIT | SVC_MODE
+	.endm
+
+	.macro	enable_irq
+	msr	cpsr_c, #SVC_MODE
+	.endm
+#endif
+
+/*
+ * Save the current IRQ state and disable IRQs.  Note that this macro
+ * assumes FIQs are enabled, and that the processor is in SVC mode.
+ */
+	.macro	save_and_disable_irqs, oldcpsr
+	mrs	\oldcpsr, cpsr
+	disable_irq
+	.endm
+
+/*
+ * Restore interrupt state previously stored in a register.  We don't
+ * guarantee that this will preserve the flags.
+ */
+	.macro	restore_irqs, oldcpsr
+	msr	cpsr_c, \oldcpsr
+	.endm
+
+#define USER(x...)				\
+9999:	x;					\
+	.section __ex_table,"a";		\
+	.align	3;				\
+	.long	9999b,9001f;			\
+	.previous
diff --git a/include/asm-arm/linkage.h b/include/asm-arm/linkage.h
new file mode 100644
index 0000000..5a25632
--- /dev/null
+++ b/include/asm-arm/linkage.h
@@ -0,0 +1,11 @@
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+#define __ALIGN .align 0
+#define __ALIGN_STR ".align 0"
+
+#define ENDPROC(name) \
+  .type name, %function; \
+  END(name)
+
+#endif
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
new file mode 100644
index 0000000..b25624e
--- /dev/null
+++ b/include/linux/linkage.h
@@ -0,0 +1,95 @@
+#ifndef _LINUX_LINKAGE_H
+#define _LINUX_LINKAGE_H
+
+#include <asm/linkage.h>
+
+#ifdef __cplusplus
+#define CPP_ASMLINKAGE extern "C"
+#else
+#define CPP_ASMLINKAGE
+#endif
+
+#ifndef asmlinkage
+#define asmlinkage CPP_ASMLINKAGE
+#endif
+
+#ifndef asmregparm
+# define asmregparm
+#endif
+
+#define __page_aligned_data	__section(.data.page_aligned) __aligned(PAGE_SIZE)
+#define __page_aligned_bss	__section(.bss.page_aligned) __aligned(PAGE_SIZE)
+
+/*
+ * This is used by architectures to keep arguments on the stack
+ * untouched by the compiler by keeping them live until the end.
+ * The argument stack may be owned by the assembly-language
+ * caller, not the callee, and gcc doesn't always understand
+ * that.
+ *
+ * We have the return value, and a maximum of six arguments.
+ *
+ * This should always be followed by a "return ret" for the
+ * protection to work (ie no more work that the compiler might
+ * end up needing stack temporaries for).
+ */
+/* Assembly files may be compiled with -traditional .. */
+#ifndef __ASSEMBLY__
+#ifndef asmlinkage_protect
+# define asmlinkage_protect(n, ret, args...)	do { } while (0)
+#endif
+#endif
+
+#ifndef __ALIGN
+#define __ALIGN		.align 4,0x90
+#define __ALIGN_STR	".align 4,0x90"
+#endif
+
+#ifdef __ASSEMBLY__
+
+#define ALIGN __ALIGN
+#define ALIGN_STR __ALIGN_STR
+
+#ifndef ENTRY
+#define ENTRY(name) \
+  .globl name; \
+  ALIGN; \
+  name:
+#endif
+
+#ifndef WEAK
+#define WEAK(name)	   \
+	.weak name;	   \
+	name:
+#endif
+
+#define KPROBE_ENTRY(name) \
+  .pushsection .kprobes.text, "ax"; \
+  ENTRY(name)
+
+#define KPROBE_END(name) \
+  END(name);		 \
+  .popsection
+
+#ifndef END
+#define END(name) \
+  .size name, .-name
+#endif
+
+/* If symbol 'name' is treated as a subroutine (gets called, and returns)
+ * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
+ * static analysis tools such as stack depth analyzer.
+ */
+#ifndef ENDPROC
+#define ENDPROC(name) \
+  .type name, @function; \
+  END(name)
+#endif
+
+#endif
+
+#define NORET_TYPE    /**/
+#define ATTRIB_NORET  __attribute__((noreturn))
+#define NORET_AND     noreturn,
+
+#endif
diff --git a/lib_arm/Makefile b/lib_arm/Makefile
index 4469361..756643f 100644
--- a/lib_arm/Makefile
+++ b/lib_arm/Makefile
@@ -25,12 +25,10 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).a
 
-SOBJS-y	+= _ashldi3.o
-SOBJS-y	+= _ashrdi3.o
-SOBJS-y	+= _divsi3.o
-SOBJS-y	+= _modsi3.o
-SOBJS-y	+= _udivsi3.o
-SOBJS-y	+= _umodsi3.o
+SOBJS-y	+= lib1funcs.o
+SOBJS-y	+= ashldi3.o
+SOBJS-y	+= ashrdi3.o
+SOBJS-y += lshrdi3.o
 
 COBJS-y	+= board.o
 COBJS-y	+= bootm.o
diff --git a/lib_arm/_divsi3.S b/lib_arm/_divsi3.S
deleted file mode 100644
index 9dc15f6..0000000
--- a/lib_arm/_divsi3.S
+++ /dev/null
@@ -1,140 +0,0 @@
-
-.macro ARM_DIV_BODY dividend, divisor, result, curbit
-
-#if __LINUX_ARM_ARCH__ >= 5
-
-	clz	\curbit, \divisor
-	clz	\result, \dividend
-	sub	\result, \curbit, \result
-	mov	\curbit, #1
-	mov	\divisor, \divisor, lsl \result
-	mov	\curbit, \curbit, lsl \result
-	mov	\result, #0
-
-#else
-
-	@ Initially shift the divisor left 3 bits if possible,
-	@ set curbit accordingly.  This allows for curbit to be located
-	@ at the left end of each 4 bit nibbles in the division loop
-	@ to save one loop in most cases.
-	tst	\divisor, #0xe0000000
-	moveq	\divisor, \divisor, lsl #3
-	moveq	\curbit, #8
-	movne	\curbit, #1
-
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is
-	@ larger than the dividend.
-1:	cmp	\divisor, #0x10000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #4
-	movlo	\curbit, \curbit, lsl #4
-	blo	1b
-
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-1:	cmp	\divisor, #0x80000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #1
-	movlo	\curbit, \curbit, lsl #1
-	blo	1b
-
-	mov	\result, #0
-
-#endif
-
-	@ Division loop
-1:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	orrhs	\result,   \result,   \curbit
-	cmp	\dividend, \divisor,  lsr #1
-	subhs	\dividend, \dividend, \divisor, lsr #1
-	orrhs	\result,   \result,   \curbit,  lsr #1
-	cmp	\dividend, \divisor,  lsr #2
-	subhs	\dividend, \dividend, \divisor, lsr #2
-	orrhs	\result,   \result,   \curbit,  lsr #2
-	cmp	\dividend, \divisor,  lsr #3
-	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?
-	movne	\divisor,  \divisor, lsr #4
-	bne	1b
-
-.endm
-
-.macro ARM_DIV2_ORDER divisor, order
-
-#if __LINUX_ARM_ARCH__ >= 5
-
-	clz	\order, \divisor
-	rsb	\order, \order, #31
-
-#else
-
-	cmp	\divisor, #(1 << 16)
-	movhs	\divisor, \divisor, lsr #16
-	movhs	\order, #16
-	movlo	\order, #0
-
-	cmp	\divisor, #(1 << 8)
-	movhs	\divisor, \divisor, lsr #8
-	addhs	\order, \order, #8
-
-	cmp	\divisor, #(1 << 4)
-	movhs	\divisor, \divisor, lsr #4
-	addhs	\order, \order, #4
-
-	cmp	\divisor, #(1 << 2)
-	addhi	\order, \order, #3
-	addls	\order, \order, \divisor, lsr #1
-
-#endif
-
-.endm
-
-	.align	5
-.globl __divsi3
-__divsi3:
-	cmp	r1, #0
-	eor	ip, r0, r1			@ save the sign of the result.
-	beq	Ldiv0
-	rsbmi	r1, r1, #0			@ loops below use unsigned.
-	subs	r2, r1, #1			@ division by 1 or -1 ?
-	beq	10f
-	movs	r3, r0
-	rsbmi	r3, r0, #0			@ positive dividend value
-	cmp	r3, r1
-	bls	11f
-	tst	r1, r2				@ divisor is power of 2 ?
-	beq	12f
-
-	ARM_DIV_BODY r3, r1, r0, r2
-
-	cmp	ip, #0
-	rsbmi	r0, r0, #0
-	mov	pc, lr
-
-10:	teq	ip, r0				@ same sign ?
-	rsbmi	r0, r0, #0
-	mov	pc, lr
-
-11:	movlo	r0, #0
-	moveq	r0, ip, asr #31
-	orreq	r0, r0, #1
-	mov	pc, lr
-
-12:	ARM_DIV2_ORDER r1, r2
-
-	cmp	ip, #0
-	mov	r0, r3, lsr r2
-	rsbmi	r0, r0, #0
-	mov	pc, lr
-
-Ldiv0:
-
-	str	lr, [sp, #-4]!
-	bl	__div0
-	mov	r0, #0			@ About as wrong as it could be.
-	ldr	pc, [sp], #4
diff --git a/lib_arm/_modsi3.S b/lib_arm/_modsi3.S
deleted file mode 100644
index 539c584..0000000
--- a/lib_arm/_modsi3.S
+++ /dev/null
@@ -1,99 +0,0 @@
-
-.macro ARM_MOD_BODY dividend, divisor, order, spare
-
-#if __LINUX_ARM_ARCH__ >= 5
-
-	clz	\order, \divisor
-	clz	\spare, \dividend
-	sub	\order, \order, \spare
-	mov	\divisor, \divisor, lsl \order
-
-#else
-
-	mov	\order, #0
-
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is
-	@ larger than the dividend.
-1:	cmp	\divisor, #0x10000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #4
-	addlo	\order, \order, #4
-	blo	1b
-
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-1:	cmp	\divisor, #0x80000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #1
-	addlo	\order, \order, #1
-	blo	1b
-
-#endif
-
-	@ Perform all needed substractions to keep only the reminder.
-	@ Do comparisons in batch of 4 first.
-	subs	\order, \order, #3		@ yes, 3 is intended here
-	blt	2f
-
-1:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	cmp	\dividend, \divisor,  lsr #1
-	subhs	\dividend, \dividend, \divisor, lsr #1
-	cmp	\dividend, \divisor,  lsr #2
-	subhs	\dividend, \dividend, \divisor, lsr #2
-	cmp	\dividend, \divisor,  lsr #3
-	subhs	\dividend, \dividend, \divisor, lsr #3
-	cmp	\dividend, #1
-	mov	\divisor, \divisor, lsr #4
-	subges	\order, \order, #4
-	bge	1b
-
-	tst	\order, #3
-	teqne	\dividend, #0
-	beq	5f
-
-	@ Either 1, 2 or 3 comparison/substractions are left.
-2:	cmn	\order, #2
-	blt	4f
-	beq	3f
-	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	mov	\divisor,  \divisor,  lsr #1
-3:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	mov	\divisor,  \divisor,  lsr #1
-4:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-5:
-.endm
-
-	.align	5
-.globl __modsi3
-__modsi3:
-	cmp	r1, #0
-	beq	Ldiv0
-	rsbmi	r1, r1, #0			@ loops below use unsigned.
-	movs	ip, r0				@ preserve sign of dividend
-	rsbmi	r0, r0, #0			@ if negative make positive
-	subs	r2, r1, #1			@ compare divisor with 1
-	cmpne	r0, r1				@ compare dividend with divisor
-	moveq	r0, #0
-	tsthi	r1, r2				@ see if divisor is power of 2
-	andeq	r0, r0, r2
-	bls	10f
-
-	ARM_MOD_BODY r0, r1, r2, r3
-
-10:	cmp	ip, #0
-	rsbmi	r0, r0, #0
-	mov	pc, lr
-
-
-Ldiv0:
-
-	str	lr, [sp, #-4]!
-	bl	__div0
-	mov	r0, #0			@ About as wrong as it could be.
-	ldr	pc, [sp], #4
diff --git a/lib_arm/_udivsi3.S b/lib_arm/_udivsi3.S
deleted file mode 100644
index a3f9b59..0000000
--- a/lib_arm/_udivsi3.S
+++ /dev/null
@@ -1,77 +0,0 @@
-/* # 1 "libgcc1.S" */
-@ libgcc1 routines for ARM cpu.
-@ Division routines, written by Richard Earnshaw, (rearnsha at armltd.co.uk)
-dividend	.req	r0
-divisor		.req	r1
-result		.req	r2
-curbit		.req	r3
-/* ip		.req	r12	*/
-/* sp		.req	r13	*/
-/* lr		.req	r14	*/
-/* pc		.req	r15	*/
-	.text
-	.globl	 __udivsi3
-	.type  __udivsi3       ,function
-	.align	0
- __udivsi3      :
-	cmp	divisor, #0
-	beq	Ldiv0
-	mov	curbit, #1
-	mov	result, #0
-	cmp	dividend, divisor
-	bcc	Lgot_result
-Loop1:
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is
-	@ larger than the dividend.
-	cmp	divisor, #0x10000000
-	cmpcc	divisor, dividend
-	movcc	divisor, divisor, lsl #4
-	movcc	curbit, curbit, lsl #4
-	bcc	Loop1
-Lbignum:
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-	cmp	divisor, #0x80000000
-	cmpcc	divisor, dividend
-	movcc	divisor, divisor, lsl #1
-	movcc	curbit, curbit, lsl #1
-	bcc	Lbignum
-Loop3:
-	@ Test for possible subtractions, and note which bits
-	@ are done in the result.  On the final pass, this may subtract
-	@ too much from the dividend, but the result will be ok, since the
-	@ "bit" will have been shifted out at the bottom.
-	cmp	dividend, divisor
-	subcs	dividend, dividend, divisor
-	orrcs	result, result, curbit
-	cmp	dividend, divisor, lsr #1
-	subcs	dividend, dividend, divisor, lsr #1
-	orrcs	result, result, curbit, lsr #1
-	cmp	dividend, divisor, lsr #2
-	subcs	dividend, dividend, divisor, lsr #2
-	orrcs	result, result, curbit, lsr #2
-	cmp	dividend, divisor, lsr #3
-	subcs	dividend, dividend, divisor, lsr #3
-	orrcs	result, result, curbit, lsr #3
-	cmp	dividend, #0			@ Early termination?
-	movnes	curbit, curbit, lsr #4		@ No, any more bits to do?
-	movne	divisor, divisor, lsr #4
-	bne	Loop3
-Lgot_result:
-	mov	r0, result
-	mov	pc, lr
-Ldiv0:
-	str	lr, [sp, #-4]!
-	bl	 __div0       (PLT)
-	mov	r0, #0			@ about as wrong as it could be
-	ldmia	sp!, {pc}
-	.size  __udivsi3       , . -  __udivsi3
-/* # 235 "libgcc1.S" */
-/* # 320 "libgcc1.S" */
-/* # 421 "libgcc1.S" */
-/* # 433 "libgcc1.S" */
-/* # 456 "libgcc1.S" */
-/* # 500 "libgcc1.S" */
-/* # 580 "libgcc1.S" */
diff --git a/lib_arm/_umodsi3.S b/lib_arm/_umodsi3.S
deleted file mode 100644
index 8465ef0..0000000
--- a/lib_arm/_umodsi3.S
+++ /dev/null
@@ -1,88 +0,0 @@
-/* # 1 "libgcc1.S" */
-@ libgcc1 routines for ARM cpu.
-@ Division routines, written by Richard Earnshaw, (rearnsha at armltd.co.uk)
-/* # 145 "libgcc1.S" */
-dividend	.req	r0
-divisor		.req	r1
-overdone	.req	r2
-curbit		.req	r3
-/* ip		.req	r12	*/
-/* sp		.req	r13	*/
-/* lr		.req	r14	*/
-/* pc		.req	r15	*/
-	.text
-	.globl	 __umodsi3
-	.type  __umodsi3       ,function
-	.align 0
- __umodsi3      :
-	cmp	divisor, #0
-	beq	Ldiv0
-	mov	curbit, #1
-	cmp	dividend, divisor
-	movcc	pc, lr
-Loop1:
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is
-	@ larger than the dividend.
-	cmp	divisor, #0x10000000
-	cmpcc	divisor, dividend
-	movcc	divisor, divisor, lsl #4
-	movcc	curbit, curbit, lsl #4
-	bcc	Loop1
-Lbignum:
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-	cmp	divisor, #0x80000000
-	cmpcc	divisor, dividend
-	movcc	divisor, divisor, lsl #1
-	movcc	curbit, curbit, lsl #1
-	bcc	Lbignum
-Loop3:
-	@ Test for possible subtractions.  On the final pass, this may
-	@ subtract too much from the dividend, so keep track of which
-	@ subtractions are done, we can fix them up afterwards...
-	mov	overdone, #0
-	cmp	dividend, divisor
-	subcs	dividend, dividend, divisor
-	cmp	dividend, divisor, lsr #1
-	subcs	dividend, dividend, divisor, lsr #1
-	orrcs	overdone, overdone, curbit, ror #1
-	cmp	dividend, divisor, lsr #2
-	subcs	dividend, dividend, divisor, lsr #2
-	orrcs	overdone, overdone, curbit, ror #2
-	cmp	dividend, divisor, lsr #3
-	subcs	dividend, dividend, divisor, lsr #3
-	orrcs	overdone, overdone, curbit, ror #3
-	mov	ip, curbit
-	cmp	dividend, #0			@ Early termination?
-	movnes	curbit, curbit, lsr #4		@ No, any more bits to do?
-	movne	divisor, divisor, lsr #4
-	bne	Loop3
-	@ Any subtractions that we should not have done will be recorded in
-	@ the top three bits of "overdone".  Exactly which were not needed
-	@ are governed by the position of the bit, stored in ip.
-	@ If we terminated early, because dividend became zero,
-	@ then none of the below will match, since the bit in ip will not be
-	@ in the bottom nibble.
-	ands	overdone, overdone, #0xe0000000
-	moveq	pc, lr				@ No fixups needed
-	tst	overdone, ip, ror #3
-	addne	dividend, dividend, divisor, lsr #3
-	tst	overdone, ip, ror #2
-	addne	dividend, dividend, divisor, lsr #2
-	tst	overdone, ip, ror #1
-	addne	dividend, dividend, divisor, lsr #1
-	mov	pc, lr
-Ldiv0:
-	str	lr, [sp, #-4]!
-	bl	 __div0       (PLT)
-	mov	r0, #0			@ about as wrong as it could be
-	ldmia	sp!, {pc}
-	.size  __umodsi3       , . -  __umodsi3
-/* # 320 "libgcc1.S" */
-/* # 421 "libgcc1.S" */
-/* # 433 "libgcc1.S" */
-/* # 456 "libgcc1.S" */
-/* # 500 "libgcc1.S" */
-/* # 580 "libgcc1.S" */
diff --git a/lib_arm/_ashldi3.S b/lib_arm/ashldi3.S
similarity index 93%
rename from lib_arm/_ashldi3.S
rename to lib_arm/ashldi3.S
index de4403d..1154d92 100644
--- a/lib_arm/_ashldi3.S
+++ b/lib_arm/ashldi3.S
@@ -26,6 +26,8 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 
+#include <linux/linkage.h>
+
 #ifdef __ARMEB__
 #define al r1
 #define ah r0
@@ -34,8 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #define ah r1
 #endif
 
-.globl __ashldi3
-__ashldi3:
+ENTRY(__ashldi3)
+ENTRY(__aeabi_llsl)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -44,3 +46,6 @@ __ashldi3:
 	orrmi	ah, ah, al, lsr ip
 	mov	al, al, lsl r2
 	mov	pc, lr
+
+ENDPROC(__ashldi3)
+ENDPROC(__aeabi_llsl)
diff --git a/lib_arm/_ashrdi3.S b/lib_arm/ashrdi3.S
similarity index 93%
copy from lib_arm/_ashrdi3.S
copy to lib_arm/ashrdi3.S
index 5edbcb3..9f8b355 100644
--- a/lib_arm/_ashrdi3.S
+++ b/lib_arm/ashrdi3.S
@@ -26,6 +26,8 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 
+#include <linux/linkage.h>
+
 #ifdef __ARMEB__
 #define al r1
 #define ah r0
@@ -34,8 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #define ah r1
 #endif
 
-.globl __ashrdi3
-__ashrdi3:
+ENTRY(__ashrdi3)
+ENTRY(__aeabi_lasr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -44,3 +46,6 @@ __ashrdi3:
 	orrmi	al, al, ah, lsl ip
 	mov	ah, ah, asr r2
 	mov	pc, lr
+
+ENDPROC(__ashrdi3)
+ENDPROC(__aeabi_lasr)
diff --git a/lib_arm/lib1funcs.S b/lib_arm/lib1funcs.S
new file mode 100644
index 0000000..67964bc
--- /dev/null
+++ b/lib_arm/lib1funcs.S
@@ -0,0 +1,348 @@
+/*
+ * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines
+ *
+ * Author: Nicolas Pitre <nico@cam.org>
+ *   - contributed to gcc-3.4 on Sep 30, 2003
+ *   - adapted for the Linux kernel on Oct 2, 2003
+ */
+
+/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+
+.macro ARM_DIV_BODY dividend, divisor, result, curbit
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+	clz	\curbit, \divisor
+	clz	\result, \dividend
+	sub	\result, \curbit, \result
+	mov	\curbit, #1
+	mov	\divisor, \divisor, lsl \result
+	mov	\curbit, \curbit, lsl \result
+	mov	\result, #0
+	
+#else
+
+	@ Initially shift the divisor left 3 bits if possible,
+	@ set curbit accordingly.  This allows for curbit to be located
+	@ at the left end of each 4 bit nibbles in the division loop
+	@ to save one loop in most cases.
+	tst	\divisor, #0xe0000000
+	moveq	\divisor, \divisor, lsl #3
+	moveq	\curbit, #8
+	movne	\curbit, #1
+
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	movlo	\curbit, \curbit, lsl #4
+	blo	1b
+
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	movlo	\curbit, \curbit, lsl #1
+	blo	1b
+
+	mov	\result, #0
+
+#endif
+
+	@ Division loop
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	orrhs	\result,   \result,   \curbit
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	orrhs	\result,   \result,   \curbit,  lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	orrhs	\result,   \result,   \curbit,  lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	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?
+	movne	\divisor,  \divisor, lsr #4
+	bne	1b
+
+.endm
+
+
+.macro ARM_DIV2_ORDER divisor, order
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+	clz	\order, \divisor
+	rsb	\order, \order, #31
+
+#else
+
+	cmp	\divisor, #(1 << 16)
+	movhs	\divisor, \divisor, lsr #16
+	movhs	\order, #16
+	movlo	\order, #0
+
+	cmp	\divisor, #(1 << 8)
+	movhs	\divisor, \divisor, lsr #8
+	addhs	\order, \order, #8
+
+	cmp	\divisor, #(1 << 4)
+	movhs	\divisor, \divisor, lsr #4
+	addhs	\order, \order, #4
+
+	cmp	\divisor, #(1 << 2)
+	addhi	\order, \order, #3
+	addls	\order, \order, \divisor, lsr #1
+
+#endif
+
+.endm
+
+
+.macro ARM_MOD_BODY dividend, divisor, order, spare
+
+#if __LINUX_ARM_ARCH__ >= 5
+
+	clz	\order, \divisor
+	clz	\spare, \dividend
+	sub	\order, \order, \spare
+	mov	\divisor, \divisor, lsl \order
+
+#else
+
+	mov	\order, #0
+
+	@ Unless the divisor is very big, shift it up in multiples of
+	@ four bits, since this is the amount of unwinding in the main
+	@ division loop.  Continue shifting until the divisor is 
+	@ larger than the dividend.
+1:	cmp	\divisor, #0x10000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #4
+	addlo	\order, \order, #4
+	blo	1b
+
+	@ For very big divisors, we must shift it a bit at a time, or
+	@ we will be in danger of overflowing.
+1:	cmp	\divisor, #0x80000000
+	cmplo	\divisor, \dividend
+	movlo	\divisor, \divisor, lsl #1
+	addlo	\order, \order, #1
+	blo	1b
+
+#endif
+
+	@ Perform all needed substractions to keep only the reminder.
+	@ Do comparisons in batch of 4 first.
+	subs	\order, \order, #3		@ yes, 3 is intended here
+	blt	2f
+
+1:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	cmp	\dividend, \divisor,  lsr #1
+	subhs	\dividend, \dividend, \divisor, lsr #1
+	cmp	\dividend, \divisor,  lsr #2
+	subhs	\dividend, \dividend, \divisor, lsr #2
+	cmp	\dividend, \divisor,  lsr #3
+	subhs	\dividend, \dividend, \divisor, lsr #3
+	cmp	\dividend, #1
+	mov	\divisor, \divisor, lsr #4
+	subges	\order, \order, #4
+	bge	1b
+
+	tst	\order, #3
+	teqne	\dividend, #0
+	beq	5f
+
+	@ Either 1, 2 or 3 comparison/substractions are left.
+2:	cmn	\order, #2
+	blt	4f
+	beq	3f
+	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+3:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+	mov	\divisor,  \divisor,  lsr #1
+4:	cmp	\dividend, \divisor
+	subhs	\dividend, \dividend, \divisor
+5:
+.endm
+
+
+ENTRY(__udivsi3)
+ENTRY(__aeabi_uidiv)
+
+	subs	r2, r1, #1
+	moveq	pc, lr
+	bcc	Ldiv0
+	cmp	r0, r1
+	bls	11f
+	tst	r1, r2
+	beq	12f
+
+	ARM_DIV_BODY r0, r1, r2, r3
+
+	mov	r0, r2
+	mov	pc, lr
+
+11:	moveq	r0, #1
+	movne	r0, #0
+	mov	pc, lr
+
+12:	ARM_DIV2_ORDER r1, r2
+
+	mov	r0, r0, lsr r2
+	mov	pc, lr
+
+ENDPROC(__udivsi3)
+ENDPROC(__aeabi_uidiv)
+
+ENTRY(__umodsi3)
+
+	subs	r2, r1, #1			@ compare divisor with 1
+	bcc	Ldiv0
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq   r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	movls	pc, lr
+
+	ARM_MOD_BODY r0, r1, r2, r3
+
+	mov	pc, lr
+
+ENDPROC(__umodsi3)
+
+ENTRY(__divsi3)
+ENTRY(__aeabi_idiv)
+
+	cmp	r1, #0
+	eor	ip, r0, r1			@ save the sign of the result.
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	subs	r2, r1, #1			@ division by 1 or -1 ?
+	beq	10f
+	movs	r3, r0
+	rsbmi	r3, r0, #0			@ positive dividend value
+	cmp	r3, r1
+	bls	11f
+	tst	r1, r2				@ divisor is power of 2 ?
+	beq	12f
+
+	ARM_DIV_BODY r3, r1, r0, r2
+
+	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
+
+10:	teq	ip, r0				@ same sign ?
+	rsbmi	r0, r0, #0
+	mov	pc, lr
+
+11:	movlo	r0, #0
+	moveq	r0, ip, asr #31
+	orreq	r0, r0, #1
+	mov	pc, lr
+
+12:	ARM_DIV2_ORDER r1, r2
+
+	cmp	ip, #0
+	mov	r0, r3, lsr r2
+	rsbmi	r0, r0, #0
+	mov	pc, lr
+
+ENDPROC(__divsi3)
+ENDPROC(__aeabi_idiv)
+
+ENTRY(__modsi3)
+
+	cmp	r1, #0
+	beq	Ldiv0
+	rsbmi	r1, r1, #0			@ loops below use unsigned.
+	movs	ip, r0				@ preserve sign of dividend
+	rsbmi	r0, r0, #0			@ if negative make positive
+	subs	r2, r1, #1			@ compare divisor with 1
+	cmpne	r0, r1				@ compare dividend with divisor
+	moveq	r0, #0
+	tsthi	r1, r2				@ see if divisor is power of 2
+	andeq	r0, r0, r2
+	bls	10f
+
+	ARM_MOD_BODY r0, r1, r2, r3
+
+10:	cmp	ip, #0
+	rsbmi	r0, r0, #0
+	mov	pc, lr
+
+ENDPROC(__modsi3)
+
+#ifdef CONFIG_AEABI
+
+ENTRY(__aeabi_uidivmod)
+
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_uidiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
+
+ENDPROC(__aeabi_uidivmod)
+
+ENTRY(__aeabi_idivmod)
+
+	stmfd	sp!, {r0, r1, ip, lr}
+	bl	__aeabi_idiv
+	ldmfd	sp!, {r1, r2, ip, lr}
+	mul	r3, r0, r2
+	sub	r1, r1, r3
+	mov	pc, lr
+
+ENDPROC(__aeabi_idivmod)
+
+#endif
+
+Ldiv0:
+
+	str	lr, [sp, #-8]!
+	bl	__div0
+	mov	r0, #0			@ About as wrong as it could be.
+	ldr	pc, [sp], #8
+
+
diff --git a/lib_arm/_ashrdi3.S b/lib_arm/lshrdi3.S
similarity index 90%
rename from lib_arm/_ashrdi3.S
rename to lib_arm/lshrdi3.S
index 5edbcb3..99ea338 100644
--- a/lib_arm/_ashrdi3.S
+++ b/lib_arm/lshrdi3.S
@@ -26,6 +26,8 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 
+#include <linux/linkage.h>
+
 #ifdef __ARMEB__
 #define al r1
 #define ah r0
@@ -34,13 +36,16 @@ Boston, MA 02110-1301, USA.  */
 #define ah r1
 #endif
 
-.globl __ashrdi3
-__ashrdi3:
+ENTRY(__lshrdi3)
+ENTRY(__aeabi_llsr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
 	movmi	al, al, lsr r2
-	movpl	al, ah, asr r3
+	movpl	al, ah, lsr r3
 	orrmi	al, al, ah, lsl ip
-	mov	ah, ah, asr r2
+	mov	ah, ah, lsr r2
 	mov	pc, lr
+
+ENDPROC(__lshrdi3)
+ENDPROC(__aeabi_llsr)
-- 
1.6.3.1

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20  9:33 [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20  9:33 ` [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20 10:18 ` Mike Frysinger
  2009-06-20 10:40   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-07-04 21:52 ` Wolfgang Denk
  2 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-06-20 10:18 UTC (permalink / raw)
  To: u-boot

On Saturday 20 June 2009 05:33:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> This patch moves the libgcc Makefile inclusion from the toplevel Makefile
> to the arch_config.mk files. This is in preparation for the ARM
> architecture to move away from including libgcc function and only using
> self-contained U-Boot functions as done in Linux.

why not change the top level Makefile to read:
PLATFORM_LIBGCC ?= ...

then any board/arch that doesnt want it can simply do:
PLATFORM_LIBGCC = # dont want it
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090620/0661677e/attachment.pgp 

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 10:18 ` [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Mike Frysinger
@ 2009-06-20 10:40   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 11:08     ` Mike Frysinger
  0 siblings, 1 reply; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20 10:40 UTC (permalink / raw)
  To: u-boot

On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> On Saturday 20 June 2009 05:33:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > This patch moves the libgcc Makefile inclusion from the toplevel Makefile
> > to the arch_config.mk files. This is in preparation for the ARM
> > architecture to move away from including libgcc function and only using
> > self-contained U-Boot functions as done in Linux.
> 
> why not change the top level Makefile to read:
> PLATFORM_LIBGCC ?= ...
> 
> then any board/arch that doesnt want it can simply do:
> PLATFORM_LIBGCC = # dont want it
because you need to provide the equivalent functions for standalone
application and api and U-Boot ofcourse

so as as for arm we will provide self-contained functions

Best Regards,
J.

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 10:40   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20 11:08     ` Mike Frysinger
  2009-06-20 11:30       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-06-20 11:08 UTC (permalink / raw)
  To: u-boot

On Saturday 20 June 2009 06:40:07 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > On Saturday 20 June 2009 05:33:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > This patch moves the libgcc Makefile inclusion from the toplevel
> > > Makefile to the arch_config.mk files. This is in preparation for the
> > > ARM architecture to move away from including libgcc function and only
> > > using self-contained U-Boot functions as done in Linux.
> >
> > why not change the top level Makefile to read:
> > PLATFORM_LIBGCC ?= ...
> >
> > then any board/arch that doesnt want it can simply do:
> > PLATFORM_LIBGCC = # dont want it
>
> because you need to provide the equivalent functions for standalone
> application and api and U-Boot ofcourse

so move it to config.mk.  this doesnt change the important point: leave 
PLATFORM_LIBGCC default in the toplevel common files.  what i proposed doesnt 
limit what you want to do with arm in any way.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090620/bb659992/attachment.pgp 

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 11:08     ` Mike Frysinger
@ 2009-06-20 11:30       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 12:57         ` Mike Frysinger
  0 siblings, 1 reply; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20 11:30 UTC (permalink / raw)
  To: u-boot

On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> On Saturday 20 June 2009 06:40:07 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > On Saturday 20 June 2009 05:33:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > This patch moves the libgcc Makefile inclusion from the toplevel
> > > > Makefile to the arch_config.mk files. This is in preparation for the
> > > > ARM architecture to move away from including libgcc function and only
> > > > using self-contained U-Boot functions as done in Linux.
> > >
> > > why not change the top level Makefile to read:
> > > PLATFORM_LIBGCC ?= ...
> > >
> > > then any board/arch that doesnt want it can simply do:
> > > PLATFORM_LIBGCC = # dont want it
> >
> > because you need to provide the equivalent functions for standalone
> > application and api and U-Boot ofcourse
> 
> so move it to config.mk.  this doesnt change the important point: leave 
> PLATFORM_LIBGCC default in the toplevel common files.  what i proposed doesnt 
> limit what you want to do with arm in any way.
I think it's better to let it at arch level and force any new arch adding to
manage it instead provide a default one

Best Regards,
J.

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 11:30       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20 12:57         ` Mike Frysinger
  2009-06-20 13:01           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-06-20 12:57 UTC (permalink / raw)
  To: u-boot

On Saturday 20 June 2009 07:30:41 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> > On Saturday 20 June 2009 06:40:07 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > > On Saturday 20 June 2009 05:33:26 Jean-Christophe wrote:
> > > > > This patch moves the libgcc Makefile inclusion from the toplevel
> > > > > Makefile to the arch_config.mk files. This is in preparation for
> > > > > the ARM architecture to move away from including libgcc function
> > > > > and only using self-contained U-Boot functions as done in Linux.
> > > >
> > > > why not change the top level Makefile to read:
> > > > PLATFORM_LIBGCC ?= ...
> > > >
> > > > then any board/arch that doesnt want it can simply do:
> > > > PLATFORM_LIBGCC = # dont want it
> > >
> > > because you need to provide the equivalent functions for standalone
> > > application and api and U-Boot ofcourse
> >
> > so move it to config.mk.  this doesnt change the important point: leave
> > PLATFORM_LIBGCC default in the toplevel common files.  what i proposed
> > doesnt limit what you want to do with arm in any way.
>
> I think it's better to let it at arch level and force any new arch adding
> to manage it instead provide a default one

considering most arches want this code, i dont think so.  you're proposing we 
duplicate the same common code in all arches to support one deviating arch -- 
arm.  the defaults should reflect the common state while the deviating ones 
change the behavior as they like.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090620/89cd12ea/attachment.pgp 

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 12:57         ` Mike Frysinger
@ 2009-06-20 13:01           ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 13:33             ` Mike Frysinger
  0 siblings, 1 reply; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20 13:01 UTC (permalink / raw)
  To: u-boot

On 08:57 Sat 20 Jun     , Mike Frysinger wrote:
> On Saturday 20 June 2009 07:30:41 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> > > On Saturday 20 June 2009 06:40:07 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > On Saturday 20 June 2009 05:33:26 Jean-Christophe wrote:
> > > > > > This patch moves the libgcc Makefile inclusion from the toplevel
> > > > > > Makefile to the arch_config.mk files. This is in preparation for
> > > > > > the ARM architecture to move away from including libgcc function
> > > > > > and only using self-contained U-Boot functions as done in Linux.
> > > > >
> > > > > why not change the top level Makefile to read:
> > > > > PLATFORM_LIBGCC ?= ...
> > > > >
> > > > > then any board/arch that doesnt want it can simply do:
> > > > > PLATFORM_LIBGCC = # dont want it
> > > >
> > > > because you need to provide the equivalent functions for standalone
> > > > application and api and U-Boot ofcourse
> > >
> > > so move it to config.mk.  this doesnt change the important point: leave
> > > PLATFORM_LIBGCC default in the toplevel common files.  what i proposed
> > > doesnt limit what you want to do with arm in any way.
> >
> > I think it's better to let it at arch level and force any new arch adding
> > to manage it instead provide a default one
> 
> considering most arches want this code, i dont think so.  you're proposing we 
> duplicate the same common code in all arches to support one deviating arch -- 
> arm.  the defaults should reflect the common state while the deviating ones 
> change the behavior as they like.
This is where I disagree other arch as mips and other will also need to move away
from the needs to include libgcc to be really toolchain independant

I do think it's really important for U-Boot be able to have full control to
have a functions embedded into.

So stop to have libgcc include by default will really reflect it

Best Regards,
J.

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 13:01           ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20 13:33             ` Mike Frysinger
  2009-06-20 13:57               ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-06-20 13:33 UTC (permalink / raw)
  To: u-boot

On Saturday 20 June 2009 09:01:36 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 08:57 Sat 20 Jun     , Mike Frysinger wrote:
> > On Saturday 20 June 2009 07:30:41 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> > > > On Saturday 20 June 2009 06:40:07 Jean-Christophe wrote:
> > > > > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > > On Saturday 20 June 2009 05:33:26 Jean-Christophe wrote:
> > > > > > > This patch moves the libgcc Makefile inclusion from the
> > > > > > > toplevel Makefile to the arch_config.mk files. This is in
> > > > > > > preparation for the ARM architecture to move away from
> > > > > > > including libgcc function and only using self-contained U-Boot
> > > > > > > functions as done in Linux.
> > > > > >
> > > > > > why not change the top level Makefile to read:
> > > > > > PLATFORM_LIBGCC ?= ...
> > > > > >
> > > > > > then any board/arch that doesnt want it can simply do:
> > > > > > PLATFORM_LIBGCC = # dont want it
> > > > >
> > > > > because you need to provide the equivalent functions for standalone
> > > > > application and api and U-Boot ofcourse
> > > >
> > > > so move it to config.mk.  this doesnt change the important point:
> > > > leave PLATFORM_LIBGCC default in the toplevel common files.  what i
> > > > proposed doesnt limit what you want to do with arm in any way.
> > >
> > > I think it's better to let it at arch level and force any new arch
> > > adding to manage it instead provide a default one
> >
> > considering most arches want this code, i dont think so.  you're
> > proposing we duplicate the same common code in all arches to support one
> > deviating arch -- arm.  the defaults should reflect the common state
> > while the deviating ones change the behavior as they like.
>
> This is where I disagree other arch as mips and other will also need to
> move away from the needs to include libgcc to be really toolchain
> independant
>
> I do think it's really important for U-Boot be able to have full control to
> have a functions embedded into.
>
> So stop to have libgcc include by default will really reflect it

so you have two arches (mips/arm) that you dont want to use libgcc.  that is 
still vastly the minority.  if we ever do get most ports not using libgcc, 
then pushing it to the arch configs makes sense.  but we havent and we arent 
even close.

how you want to manage libgcc dependency is your prerogative ... it doesnt 
mean you should be forcing other people to follow suit.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090620/690c779d/attachment.pgp 

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 13:33             ` Mike Frysinger
@ 2009-06-20 13:57               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 15:59                 ` Mike Frysinger
  2009-06-22 18:55                 ` Scott Wood
  0 siblings, 2 replies; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20 13:57 UTC (permalink / raw)
  To: u-boot

On 09:33 Sat 20 Jun     , Mike Frysinger wrote:
> On Saturday 20 June 2009 09:01:36 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 08:57 Sat 20 Jun     , Mike Frysinger wrote:
> > > On Saturday 20 June 2009 07:30:41 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > On Saturday 20 June 2009 06:40:07 Jean-Christophe wrote:
> > > > > > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > > > On Saturday 20 June 2009 05:33:26 Jean-Christophe wrote:
> > > > > > > > This patch moves the libgcc Makefile inclusion from the
> > > > > > > > toplevel Makefile to the arch_config.mk files. This is in
> > > > > > > > preparation for the ARM architecture to move away from
> > > > > > > > including libgcc function and only using self-contained U-Boot
> > > > > > > > functions as done in Linux.
> > > > > > >
> > > > > > > why not change the top level Makefile to read:
> > > > > > > PLATFORM_LIBGCC ?= ...
> > > > > > >
> > > > > > > then any board/arch that doesnt want it can simply do:
> > > > > > > PLATFORM_LIBGCC = # dont want it
> > > > > >
> > > > > > because you need to provide the equivalent functions for standalone
> > > > > > application and api and U-Boot ofcourse
> > > > >
> > > > > so move it to config.mk.  this doesnt change the important point:
> > > > > leave PLATFORM_LIBGCC default in the toplevel common files.  what i
> > > > > proposed doesnt limit what you want to do with arm in any way.
> > > >
> > > > I think it's better to let it at arch level and force any new arch
> > > > adding to manage it instead provide a default one
> > >
> > > considering most arches want this code, i dont think so.  you're
> > > proposing we duplicate the same common code in all arches to support one
> > > deviating arch -- arm.  the defaults should reflect the common state
> > > while the deviating ones change the behavior as they like.
> >
> > This is where I disagree other arch as mips and other will also need to
> > move away from the needs to include libgcc to be really toolchain
> > independant
> >
> > I do think it's really important for U-Boot be able to have full control to
> > have a functions embedded into.
> >
> > So stop to have libgcc include by default will really reflect it
> 
> so you have two arches (mips/arm) that you dont want to use libgcc.  that is 
> still vastly the minority.  if we ever do get most ports not using libgcc, 
> then pushing it to the arch configs makes sense.  but we havent and we arent 
> even close.
which minoroty?
I just give you example but you will see arm, mips, sh, powerpc etc...
toolchains problem just because we use the libgcc

I've patch in qualification for mips and sh so it will not be so long
maybe 2 or 3 weeks
> 
> how you want to manage libgcc dependency is your prerogative ... it doesnt 
> mean you should be forcing other people to follow suit.
you can do your own choice but I steel think it's a good improvement

Best Regards,
J.

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 13:57               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-20 15:59                 ` Mike Frysinger
  2009-06-20 17:15                   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-22 18:55                 ` Scott Wood
  1 sibling, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-06-20 15:59 UTC (permalink / raw)
  To: u-boot

On Saturday 20 June 2009 09:57:51 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:33 Sat 20 Jun     , Mike Frysinger wrote:
> > On Saturday 20 June 2009 09:01:36 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 08:57 Sat 20 Jun     , Mike Frysinger wrote:
> > > > On Saturday 20 June 2009 07:30:41 Jean-Christophe wrote:
> > > > > On 07:08 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > > On Saturday 20 June 2009 06:40:07 Jean-Christophe wrote:
> > > > > > > On 06:18 Sat 20 Jun     , Mike Frysinger wrote:
> > > > > > > > On Saturday 20 June 2009 05:33:26 Jean-Christophe wrote:
> > > > > > > > > This patch moves the libgcc Makefile inclusion from the
> > > > > > > > > toplevel Makefile to the arch_config.mk files. This is in
> > > > > > > > > preparation for the ARM architecture to move away from
> > > > > > > > > including libgcc function and only using self-contained
> > > > > > > > > U-Boot functions as done in Linux.
> > > > > > > >
> > > > > > > > why not change the top level Makefile to read:
> > > > > > > > PLATFORM_LIBGCC ?= ...
> > > > > > > >
> > > > > > > > then any board/arch that doesnt want it can simply do:
> > > > > > > > PLATFORM_LIBGCC = # dont want it
> > > > > > >
> > > > > > > because you need to provide the equivalent functions for
> > > > > > > standalone application and api and U-Boot ofcourse
> > > > > >
> > > > > > so move it to config.mk.  this doesnt change the important point:
> > > > > > leave PLATFORM_LIBGCC default in the toplevel common files.  what
> > > > > > i proposed doesnt limit what you want to do with arm in any way.
> > > > >
> > > > > I think it's better to let it at arch level and force any new arch
> > > > > adding to manage it instead provide a default one
> > > >
> > > > considering most arches want this code, i dont think so.  you're
> > > > proposing we duplicate the same common code in all arches to support
> > > > one deviating arch -- arm.  the defaults should reflect the common
> > > > state while the deviating ones change the behavior as they like.
> > >
> > > This is where I disagree other arch as mips and other will also need to
> > > move away from the needs to include libgcc to be really toolchain
> > > independant
> > >
> > > I do think it's really important for U-Boot be able to have full
> > > control to have a functions embedded into.
> > >
> > > So stop to have libgcc include by default will really reflect it
> >
> > so you have two arches (mips/arm) that you dont want to use libgcc.  that
> > is still vastly the minority.  if we ever do get most ports not using
> > libgcc, then pushing it to the arch configs makes sense.  but we havent
> > and we arent even close.
>
> which minoroty?

the majority use libgcc

> I just give you example but you will see arm, mips, sh, powerpc etc...
> toolchains problem just because we use the libgcc

4 is still the minority, but this is Woflgang's call

> I've patch in qualification for mips and sh so it will not be so long
> maybe 2 or 3 weeks

considering my proposed change is much simpler, and would allow for trivial 
migration as you converted things, it still makes more sense.

> > how you want to manage libgcc dependency is your prerogative ... it
> > doesnt mean you should be forcing other people to follow suit.
>
> you can do your own choice but I steel think it's a good improvement

it depends on the arch.  for ones doing stupid things (like arm), thats one 
thing.  but for others, it's simply a waste of time and unnecessary overhead.  
i'm not about to *copy* the exact sources from gcc just to avoid -lgcc.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090620/52ae8c6e/attachment.pgp 

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 15:59                 ` Mike Frysinger
@ 2009-06-20 17:15                   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-07-10 22:27                     ` Wolfgang Denk
  0 siblings, 1 reply; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-20 17:15 UTC (permalink / raw)
  To: u-boot

> > > >
> > > > This is where I disagree other arch as mips and other will also need to
> > > > move away from the needs to include libgcc to be really toolchain
> > > > independant
> > > >
> > > > I do think it's really important for U-Boot be able to have full
> > > > control to have a functions embedded into.
> > > >
> > > > So stop to have libgcc include by default will really reflect it
> > >
> > > so you have two arches (mips/arm) that you dont want to use libgcc.  that
> > > is still vastly the minority.  if we ever do get most ports not using
> > > libgcc, then pushing it to the arch configs makes sense.  but we havent
> > > and we arent even close.
> >
> > which minoroty?
> 
> the majority use libgcc
> 
> > I just give you example but you will see arm, mips, sh, powerpc etc...
> > toolchains problem just because we use the libgcc
> 
> 4 is still the minority, but this is Woflgang's call
> 
> > I've patch in qualification for mips and sh so it will not be so long
> > maybe 2 or 3 weeks
> 
> considering my proposed change is much simpler, and would allow for trivial
> migration as you converted things, it still makes more sense.
it's not the size of the change, it's just I do not agree with it

Best Regards,
J.

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

* [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore
  2009-06-20  9:33 ` [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-21 12:25   ` Dirk Behme
  0 siblings, 0 replies; 16+ messages in thread
From: Dirk Behme @ 2009-06-21 12:25 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> This patch removes the inclusion of libgcc functions into U-Boot on the ARM
> architecture. Only the really needed functions are provided in the lib_arm
> directory. Those implementations are copied from Linux where they are well
> proven related to reliably, performance.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Rebased against current HEAD
> 
> Best Regards,
> J.
...
>  create mode 100644 lib_arm/lib1funcs.S

For this I get

Warning: trailing whitespace in lines 51,65,152 of lib_arm/lib1funcs.S

Best regards

Dirk

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 13:57               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 15:59                 ` Mike Frysinger
@ 2009-06-22 18:55                 ` Scott Wood
  1 sibling, 0 replies; 16+ messages in thread
From: Scott Wood @ 2009-06-22 18:55 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 20, 2009 at 03:57:51PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> I just give you example but you will see arm, mips, sh, powerpc etc...
> toolchains problem just because we use the libgcc

What problems will powerpc have due to libgcc, and why would we choose to
reinvent the wheel rather than fix the toolchain if it's not supporting
the ABI we're trying to build for?

Linking libgcc *removes* dependencies on the interface between the
compiler and those functions.  If you really want u-boot to have complete
control of the generated code, you'll have to write in assembly.

-Scott

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20  9:33 [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20  9:33 ` [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore Jean-Christophe PLAGNIOL-VILLARD
  2009-06-20 10:18 ` [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Mike Frysinger
@ 2009-07-04 21:52 ` Wolfgang Denk
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2009-07-04 21:52 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1245490407-22770-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> This patch moves the libgcc Makefile inclusion from the toplevel Makefile to
> the arch_config.mk files. This is in preparation for the ARM architecture to
> move away from including libgcc function and only using self-contained U-Boot
> functions as done in Linux.
> 
> Currently in the next branch all the ARM boards that use the nand are broken due
> to the adding of the 64 Bit device size support. In the past we have seen
> problems with different toolchains due to EABI, FPU as example.
> With this patch and the following one we move away from all these problems and
> we will be able to have full control to have a functions embedded into u-boot.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---

NAK.

I think Mike Frysinger's proposal (see
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/61892/focus=61896
and the rest of the thread) makes perfect sense: the default settings
should be such that the majority of architectures just work as is,
and only the deviating ones need to change the behavior.

Please rework as suggested and resubmit.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A quarrel is quickly settled when deserted by one party; there is  no
battle unless there be two.                                  - Seneca

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

* [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files
  2009-06-20 17:15                   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-07-10 22:27                     ` Wolfgang Denk
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2009-07-10 22:27 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090620171547.GN3849@game.jcrosoft.org> you wrote:
>
> > 4 is still the minority, but this is Woflgang's call
> > 
> > > I've patch in qualification for mips and sh so it will not be so long
> > > maybe 2 or 3 weeks
> > 
> > considering my proposed change is much simpler, and would allow for trivial
> > migration as you converted things, it still makes more sense.
> it's not the size of the change, it's just I do not agree with it

We had this discussion before. My position  has  not  changed  since:
defaults  should  be  set such that the majority of boards / configu-
rations can just use the default settings,  and  only  deviation  (or
call it broken) configurations need to apply fixes.

Jean-Christophe, please implement this as suggested by Mike.

Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Obviously, a major malfunction has occurred."
              -- Steve Nesbitt, voice of Mission Control, January 28,
                 1986, as the shuttle Challenger exploded within view
                 of the grandstands.

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

end of thread, other threads:[~2009-07-10 22:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-20  9:33 [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Jean-Christophe PLAGNIOL-VILLARD
2009-06-20  9:33 ` [U-Boot] [PATCH 2/2 V2] ARM: Don't include libgcc anymore Jean-Christophe PLAGNIOL-VILLARD
2009-06-21 12:25   ` Dirk Behme
2009-06-20 10:18 ` [U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files Mike Frysinger
2009-06-20 10:40   ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-20 11:08     ` Mike Frysinger
2009-06-20 11:30       ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-20 12:57         ` Mike Frysinger
2009-06-20 13:01           ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-20 13:33             ` Mike Frysinger
2009-06-20 13:57               ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-20 15:59                 ` Mike Frysinger
2009-06-20 17:15                   ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-10 22:27                     ` Wolfgang Denk
2009-06-22 18:55                 ` Scott Wood
2009-07-04 21:52 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox