Use lldiv from div64.h for 64-bit divisions
cover Use lldiv from div64.h for 64-bit divisions
Hi,
During the review of my patchset
[PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/119249/
a linker problem was discovered by Tom Rini and Wolfgang Denk that occured only with certain toolchains:
Quoted 2 lines
arm-linux-gnueabi-ld: error: no memory region specified for loadable section `.ARM.exidx'
This section .ARM.exidx is only present when the 64-bit division from libgcc is used.
The two patches in this patchset replace the 64-bit divisions in arch/arm/cpu/arm926ejs/davinci/timer.c and post/post.c by the lldiv function from div64.h and thus fix the linker problem.
Regards, Christian
Christian Riesch (2):
arm, davinci: Use lldiv for the 64-bit divisions in timer.c post/post.c: Use lldiv for 64-bit divisions
arch/arm/cpu/arm926ejs/davinci/timer.c | 6 ++++-- post/post.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/2 arm, davinci: Use lldiv for the 64-bit divisions in timer.c
--- arch/arm/cpu/arm926ejs/davinci/timer.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/davinci/timer.c +4 -2
@@ -40,6 +40,7 @@#include <common.h> #include <asm/io.h> #include <asm/arch/timer_defs.h> +#include <div64.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -86,14 +87,15 @@ ulong get_timer(ulong base) timer_diff =get_ticks () - gd->timer_reset_value; -return (timer_diff / (gd->timer_rate_hz /CONFIG_SYS_HZ )) - base; +return lldiv (timer_diff, (gd->timer_rate_hz /CONFIG_SYS_HZ )) - base; }void __udelay (unsigned long usec) {unsigned long long endtime; - endtime = ((unsigned long long )usec * gd->timer_rate_hz) /1000000UL ; + endtime =lldiv ((unsigned long long )usec * gd->timer_rate_hz, +1000000UL ); endtime +=get_ticks ();while (get_ticks () < endtime)
Signature · 1 line
1.7.4.1
Wolfgang Denk
AppliedPATCH 1/2 arm, davinci: Use lldiv for the 64-bit divisions in timer.c
Dear Christian Riesch,
Quoted 7 lines · In message <[email protected]> you…
Signed-off-by Christian Riesch <[email protected]>Cc Tom Rini <[email protected]>Cc Heiko Schocher <[email protected]>Cc Wolfgang Denk <[email protected]>--- arch/arm/cpu/arm926ejs/davinci/timer.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 Anyone who isn't confused here doesn't really know what's going on.
PATCH 2/2 post/post.c: Use lldiv for 64-bit divisions
In reply to Christian Riesch--- post/post.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
post/post.c +2 -1
@@ -24,6 +24,7 @@#include <common.h> #include <stdio_dev.h> #include <watchdog.h> +#include <div64.h> #include <post.h> #ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
@@ -495,7 +496,7 @@ void post_reloc(void)unsigned long post_time_ms (unsigned long base) {#if defined(CONFIG_PPC ) || defined(CONFIG_ARM ) -return (unsigned long )(get_ticks () / (get_tbclk () /CONFIG_SYS_HZ )) +return (unsigned long )lldiv (get_ticks (),get_tbclk () /CONFIG_SYS_HZ ) - base;#else #warning "Not implemented yet"
Signature · 1 line
1.7.4.1
Wolfgang Denk
AppliedPATCH 2/2 post/post.c: Use lldiv for 64-bit divisions
Dear Christian Riesch,
Quoted 7 lines · In message <[email protected]> you…
Signed-off-by Christian Riesch <[email protected]>Cc Tom Rini <[email protected]>Cc Heiko Schocher <[email protected]>Cc Wolfgang Denk <[email protected]>--- post/post.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
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.