ts-7000
[Top] [All Lists]

[ts-7000] FYI: Fix for the "undefined reference to `__umoddi3' / `__udi

To:
Subject: [ts-7000] FYI: Fix for the "undefined reference to `__umoddi3' / `__udivdi3'" error
From: "kaiwanbillimoria" <>
Date: Wed, 07 Jan 2009 04:30:16 -0000
Hey all,

I faced an issue when building a 2.6.24-based kernel for the TS72xx
(in particular, TS7200) using Matt's 2.6.24.4-ts7200-matt-10 patch
(you can get it from the 'Files' section; thanks Matt!).

Am posting this fyi, in case others come across a similar issue.


Issue:
------
$ make CROSS_COMPILE=arm-none-linux-gnueabi-
...
...
 LD      .tmp_vmlinux1

kernel/built-in.o: In function `timekeeping_resume':

utsname_sysctl.c:(.text+0x23a24): undefined reference to `__umoddi3'

utsname_sysctl.c:(.text+0x23a40): undefined reference to `__udivdi3'

kernel/built-in.o: In function `update_wall_time':

utsname_sysctl.c:(.text+0x2407c): undefined reference to `__umoddi3'

utsname_sysctl.c:(.text+0x24098): undefined reference to `__udivdi3'

make: *** [.tmp_vmlinux1] Error 1

$

Turns out this issue has been faced before; it's due to gcc
optimization (what else). The solution is to prevent gcc-3.4
optimization by inserting an inline assembler statement in
include/linux/time.h .

The "patch" is:
--------
Prevent gcc-4.3 form "optimizing" the while loop into a costly modulo
operation.
Patch found at http://lkml.org/lkml/2008/2/22/464.

Reported-by: Sven Rebhan <>
Signed-off-by: Segher Boessenkool <>
---
 include/linux/time.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index b04136d..3e8fd9e 100644
     ns += a->tv_nsec; 
     while(unlikely(ns >= NSEC_PER_SEC)) {   
              /* The following asm() prevents the compiler from 
                * optimising this loop into a modulo operation.  */   
                asm("" : "+r"(ns)); 
                ns -= NSEC_PER_SEC; 
                a->tv_sec++; 
     }

Original link:
https://dev.openwrt.org/browser/trunk/target/linux/s3c24xx/patches-2.6.24/1300-fix-gcc-4.3-false-modulo-optimization.patch.patch?rev=13613

[Toolchain: CodeSourcery GNU EABI ver 2008q3. Link:
http://www.codesourcery.com/gnu_toolchains/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
]

Also, I found that it hangs upon uncompressing if you turn ARM EABI
on, default is off (in Matt's config).

-Kaiwan.


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
    
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
  • [ts-7000] FYI: Fix for the "undefined reference to `__umoddi3' / `__udivdi3'" error, kaiwanbillimoria <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU