Skip to contentSkip to conversation

unresolved symbol __udivsi3_i4

DISCUSSION Donald Duckie 6 participants 11 messages Sep 24, 2004

lore
Share & tools
lore
#0 lore raw

hi!

can somebody please help me how to overcome this
problem:
unresolved symbol __udivsi3_i4

I compiled the snull files that i got from
http://www.oreilly.com.tw/editor_column/a138_read.htmland
ran depmod -a -F /proc/ksyms 2.4.18 snull.o

And in another machine (my running machine), I got the following files from my compilation machine:
snull.o
/lib/modules/2.4.18/*

In my running machine, I ran modprobe but got this error:
Using /lib/modules/2.4.18-sh/kernel/drivers/net/snull.
<cut>
modprobe: unresolved symbol __udivsi3_i4
<cut>

The gcc version that is used is:
[aprhodite@aphrodite2 bin]$ sh-linux-gcc -v
Reading specs from
/usr/lib/gcc-lib/sh-linux/3.0.3/specs
Configured with: ../configure --prefix=/usr
--mandir=/usr/share/man --target=sh-linux
--host=i686-pc-linux-gnu --build=i
686-pc-linux-gnu --disable-c99 --disable-nls
--enable-languages=c,c++ --with-system-zlib
--with-gxx-include-dir=/usr/sh-
linux/include/g++-v3
--includedir=/usr/sh-linux/include
--enable-threads=posix --enable-long-long
Thread model: posix
gcc version 3.0.3

Running nm -l-s snull.o
00000000 a *ABS*
<cut>

         U __udivsi3_i4

/home/aphrodite/snull/snull3/snull/snull.c:355
<cut>

the block in snull.c that contains ine 355 is:

    352     if (lockup && ((priv->stats.tx_packets +

1) % lockup) == 0) {
353 /* Simulate a dropped transmit
interrupt */
354 netif_stop_queue(dev);
355 PDEBUG("Simulate lockup at %ld, txp
%ld\n", jiffies,
356 (unsigned long)

priv->stats.tx_packets);
    357     }

(which seems to be okey)

The only modification to the downloaded snull files is on snull.c:

     30 //#include <linux/malloc.h> /* kmalloc() */
     31 #include <linux/slab.h> /* kmalloc()

deprecated use slab.h instead*/

can anyone please tell me how to deal with this
unresolved symbol __udivsi3_i4?

thank you very much.
-donald

_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

#1 lore raw

On Thu, 23 Sep 2004 19:10:50 -0700 (PDT) Donald Duckie wrote:

| hi!

Hi again, Donald-

Note: I haven't forgotten your other question.
Is is still a problem?

| can somebody please help me how to overcome this
| problem:
| unresolved symbol __udivsi3_i4

That clearly shouldn't be happening, and that symbol isn't in snull.o when I build it (on x86).

| I compiled the snull files that i got from 
| http://www.oreilly.com.tw/editor_column/a138_read.htmland
| ran depmod -a -F /proc/ksyms 2.4.18 snull.o

How did you build snull (or all of the LDD drivers)? What command(s)?

| And in another machine (my running machine), I got the
| following files from my compilation machine:
| snull.o
| /lib/modules/2.4.18/*
| 
| In my running machine, I ran modprobe but got this
| error:
| Using /lib/modules/2.4.18-sh/kernel/drivers/net/snull.
|   <cut>
| modprobe: unresolved symbol __udivsi3_i4
|   <cut>

So the problem machine is an sh-arch machine? Maybe gcc 3.0.3 has some problem on sh.
Can you try this on some other architecture machine?

| The gcc version that is used is:
| [aprhodite@aphrodite2 bin]$ sh-linux-gcc -v
| Reading specs from
| /usr/lib/gcc-lib/sh-linux/3.0.3/specs
| Configured with: ../configure --prefix=/usr
| --mandir=/usr/share/man --target=sh-linux
| --host=i686-pc-linux-gnu --build=i
| 686-pc-linux-gnu --disable-c99 --disable-nls
| --enable-languages=c,c++ --with-system-zlib
| --with-gxx-include-dir=/usr/sh-
| linux/include/g++-v3
| --includedir=/usr/sh-linux/include
| --enable-threads=posix --enable-long-long
| Thread model: posix
| gcc version 3.0.3
| 
| 
| Running nm -l-s snull.o
| 00000000 a *ABS*
|   <cut>
|          U __udivsi3_i4
| /home/aphrodite/snull/snull3/snull/snull.c:355
|   <cut>

Seeing an objdump of that function (snull_hw_tx) should/could be helpful.

| the block in snull.c that contains ine 355 is:
|     352     if (lockup && ((priv->stats.tx_packets +
| 1) % lockup) == 0) {
|     353         /* Simulate a dropped transmit
| interrupt */
|     354         netif_stop_queue(dev);
|     355         PDEBUG("Simulate lockup at %ld, txp
| %ld\n", jiffies,
|     356                         (unsigned long)
| priv->stats.tx_packets);
|     357     }
| (which seems to  be okey)

Yes.

| The only modification to the downloaded snull files is
| on snull.c:
|      30 //#include <linux/malloc.h> /* kmalloc() */
|      31 #include <linux/slab.h> /* kmalloc()
| deprecated use slab.h instead*/
| 
| 
| can anyone please tell me how to deal with this
| unresolved symbol __udivsi3_i4?

--
~Randy

#2 lore raw
In reply to Donald Duckie

On Thu, 23 Sep 2004 19:10:50 -0700 (PDT) Donald Duckie wrote:

| hi!
| 
| can somebody please help me how to overcome this
| problem:
| unresolved symbol __udivsi3_i4
| 
| I compiled the snull files that i got from 
| http://www.oreilly.com.tw/editor_column/a138_read.htmland
| ran depmod -a -F /proc/ksyms 2.4.18 snull.o
| 
| And in another machine (my running machine), I got the
| following files from my compilation machine:
| snull.o
| /lib/modules/2.4.18/*
| 
| In my running machine, I ran modprobe but got this
| error:
| Using /lib/modules/2.4.18-sh/kernel/drivers/net/snull.
|   <cut>
| modprobe: unresolved symbol __udivsi3_i4
|   <cut>

Let me try this again. I suspect that the problem is the '%' (mod) operator at line 351. Can you just delete part of that if-test to prove or disprove my suspicion?

| The gcc version that is used is:
| [aprhodite@aphrodite2 bin]$ sh-linux-gcc -v
| Reading specs from
| /usr/lib/gcc-lib/sh-linux/3.0.3/specs
| Configured with: ../configure --prefix=/usr
| --mandir=/usr/share/man --target=sh-linux
| --host=i686-pc-linux-gnu --build=i
| 686-pc-linux-gnu --disable-c99 --disable-nls
| --enable-languages=c,c++ --with-system-zlib
| --with-gxx-include-dir=/usr/sh-
| linux/include/g++-v3
| --includedir=/usr/sh-linux/include
| --enable-threads=posix --enable-long-long
| Thread model: posix
| gcc version 3.0.3
| 
| 
| Running nm -l-s snull.o
| 00000000 a *ABS*
|   <cut>
|          U __udivsi3_i4
| /home/aphrodite/snull/snull3/snull/snull.c:355
|   <cut>
| 
| 
| the block in snull.c that contains ine 355 is:
|     352     if (lockup && ((priv->stats.tx_packets +
| 1) % lockup) == 0) {
|     353         /* Simulate a dropped transmit
| interrupt */
|     354         netif_stop_queue(dev);
|     355         PDEBUG("Simulate lockup at %ld, txp
| %ld\n", jiffies,
|     356                         (unsigned long)
| priv->stats.tx_packets);
|     357     }
| (which seems to  be okey)
| 
| 
| The only modification to the downloaded snull files is
| on snull.c:
|      30 //#include <linux/malloc.h> /* kmalloc() */
|      31 #include <linux/slab.h> /* kmalloc()
| deprecated use slab.h instead*/
| 
| 
| can anyone please tell me how to deal with this
| unresolved symbol __udivsi3_i4?
| 
| 
| thank you very much.
| -donald

--
~Randy

#3 lore raw

hi randy!

thank you very much for your help.

it is indeed the % (mod) operator that generates the unresolved symbol. it is also true with the / (division) operator.

is there any patch on this for
2.4.18-sh? or how will i do away with this problem aside from commenting it out from the code?

btw, the previous unresolved symbol problems were already solved. i just didn't copy the depmod generated files in the running machine, that was why those occured.

thank you.

Quoted 12 lines · --- "Randy.Dunlap

On Thu, 23 Sep 2004 19:10:50 -0700 (PDT) Donald
Duckie wrote:

| hi!
| 
| can somebody please help me how to overcome this
| problem:
| unresolved symbol __udivsi3_i4
| 
| I compiled the snull files that i got from 
|

http://www.oreilly.com.tw/editor_column/a138_read.htmland

Quoted 80 lines
| ran depmod -a -F /proc/ksyms 2.4.18 snull.o
| 
| And in another machine (my running machine), I got
the
| following files from my compilation machine:
| snull.o
| /lib/modules/2.4.18/*
| 
| In my running machine, I ran modprobe but got this
| error:
| Using
/lib/modules/2.4.18-sh/kernel/drivers/net/snull.
|   <cut>
| modprobe: unresolved symbol __udivsi3_i4
|   <cut>

Let me try this again. I suspect that the problem is the '%' (mod)
operator at line 351. Can you just delete part of that if-test
to prove or disprove my suspicion?

| The gcc version that is used is:
| [aprhodite@aphrodite2 bin]$ sh-linux-gcc -v
| Reading specs from
| /usr/lib/gcc-lib/sh-linux/3.0.3/specs
| Configured with: ../configure --prefix=/usr
| --mandir=/usr/share/man --target=sh-linux
| --host=i686-pc-linux-gnu --build=i
| 686-pc-linux-gnu --disable-c99 --disable-nls
| --enable-languages=c,c++ --with-system-zlib
| --with-gxx-include-dir=/usr/sh-
| linux/include/g++-v3
| --includedir=/usr/sh-linux/include
| --enable-threads=posix --enable-long-long
| Thread model: posix
| gcc version 3.0.3
| 
| 
| Running nm -l-s snull.o
| 00000000 a *ABS*
|   <cut>
|          U __udivsi3_i4
| /home/aphrodite/snull/snull3/snull/snull.c:355
|   <cut>
| 
| 
| the block in snull.c that contains ine 355 is:
|     352     if (lockup && ((priv->stats.tx_packets
+
| 1) % lockup) == 0) {
|     353         /* Simulate a dropped transmit
| interrupt */
|     354         netif_stop_queue(dev);
|     355         PDEBUG("Simulate lockup at %ld,
txp
| %ld\n", jiffies,
|     356                         (unsigned long)
| priv->stats.tx_packets);
|     357     }
| (which seems to  be okey)
| 
| 
| The only modification to the downloaded snull

files is
| on snull.c:
| 30 //#include <linux/malloc.h> /* kmalloc()
*/

|      31 #include <linux/slab.h> /* kmalloc()
| deprecated use slab.h instead*/
| 
| 
| can anyone please tell me how to deal with this
| unresolved symbol __udivsi3_i4?
| 
| 
| thank you very much.
| -donald
Quoted 3 lines

--
~Randy

__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

#4 lore raw

On Thu, 23 Sep 2004 21:49:52 -0700 (PDT) Donald Duckie wrote:

| hi randy!
| 
| thank you very much for your help.
| 
| it is indeed the % (mod) operator that generates the
| unresolved symbol. it is also true with the /
| (division) operator.  
| 
| is there any patch on this for
| 2.4.18-sh? or how will i do away with this problem
| aside from commenting it out from the code?

Sorry, I don't track sh changes. However, I do see in 2.4.26 that arch/sh/lib/udivdi3.c contains a __udivdi3() function, so perhaps you could manage to use it or implement something similar to it.

Or perhaps you could use a different kernel version.

| btw, the previous unresolved symbol problems were
| already solved. i just didn't copy the depmod
| generated files in the running machine, that was why
| those occured.

Good.

--
~Randy

| --- "Randy.Dunlap" <[email protected]> wrote:
| 
| > On Thu, 23 Sep 2004 19:10:50 -0700 (PDT) Donald
| > Duckie wrote:
| > 
| > | hi!
| > | 
| > | can somebody please help me how to overcome this
| > | problem:
| > | unresolved symbol __udivsi3_i4
| > | 
| > | I compiled the snull files that i got from 
| > |
| >
| http://www.oreilly.com.tw/editor_column/a138_read.htmland
| > | ran depmod -a -F /proc/ksyms 2.4.18 snull.o
| > | 
| > | And in another machine (my running machine), I got
| > the
| > | following files from my compilation machine:
| > | snull.o
| > | /lib/modules/2.4.18/*
| > | 
| > | In my running machine, I ran modprobe but got this
| > | error:
| > | Using
| > /lib/modules/2.4.18-sh/kernel/drivers/net/snull.
| > |   <cut>
| > | modprobe: unresolved symbol __udivsi3_i4
| > |   <cut>
| > 
| > Let me try this again.  I suspect that the problem
| > is the '%' (mod)
| > operator at line 351.  Can you just delete part of
| > that if-test
| > to prove or disprove my suspicion?
| > 
| > 
| > | The gcc version that is used is:
| > | [aprhodite@aphrodite2 bin]$ sh-linux-gcc -v
| > | Reading specs from
| > | /usr/lib/gcc-lib/sh-linux/3.0.3/specs
| > | Configured with: ../configure --prefix=/usr
| > | --mandir=/usr/share/man --target=sh-linux
| > | --host=i686-pc-linux-gnu --build=i
| > | 686-pc-linux-gnu --disable-c99 --disable-nls
| > | --enable-languages=c,c++ --with-system-zlib
| > | --with-gxx-include-dir=/usr/sh-
| > | linux/include/g++-v3
| > | --includedir=/usr/sh-linux/include
| > | --enable-threads=posix --enable-long-long
| > | Thread model: posix
| > | gcc version 3.0.3
| > | 
| > | 
| > | Running nm -l-s snull.o
| > | 00000000 a *ABS*
| > |   <cut>
| > |          U __udivsi3_i4
| > | /home/aphrodite/snull/snull3/snull/snull.c:355
| > |   <cut>
| > | 
| > | 
| > | the block in snull.c that contains ine 355 is:
| > |     352     if (lockup && ((priv->stats.tx_packets
| > +
| > | 1) % lockup) == 0) {
| > |     353         /* Simulate a dropped transmit
| > | interrupt */
| > |     354         netif_stop_queue(dev);
| > |     355         PDEBUG("Simulate lockup at %ld,
| > txp
| > | %ld\n", jiffies,
| > |     356                         (unsigned long)
| > | priv->stats.tx_packets);
| > |     357     }
| > | (which seems to  be okey)
| > | 
| > | 
| > | The only modification to the downloaded snull
| > files is
| > | on snull.c:
| > |      30 //#include <linux/malloc.h> /* kmalloc()
| > */
| > |      31 #include <linux/slab.h> /* kmalloc()
| > | deprecated use slab.h instead*/
| > | 
| > | 
| > | can anyone please tell me how to deal with this
| > | unresolved symbol __udivsi3_i4?
| > | 
| > | 
| > | thank you very much.
| > | -donald
#5 lore raw
In reply to Donald Duckie
Quoted 5 lines · Donald Duckie

hi!

can somebody please help me how to overcome this
problem:
unresolved symbol __udivsi3_i4

the kernel module tries to use a divide operation on machine that doesn't support that. this could be caused by %,/ operators or floating point arithmetic. gcc uses emulation in these cases.

# objdump -T /lib/libgcc_s.so.1|grep div
000024c0 g    DF .text  00000162  GLIBC_2.0   __divdi3
00002b80 g    DF .text  000001ed  GCC_3.0     __udivmoddi4
00002870 g    DF .text  00000120  GLIBC_2.0   __udivdi3

you can link module with libgcc.a or fix it.

Signature · 3 lines
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

                           #define say(x) lie(x)
#6 lore raw
Quoted 9 lines · On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
Quoted 3 lines · Donald Duckie

can somebody please help me how to overcome this
problem:
unresolved symbol __udivsi3_i4

the kernel module tries to use a divide operation on machine that doesn't support that. this could be caused by %,/ operators or floating point arithmetic. gcc uses emulation in these cases.

Quoted 6 lines
# objdump -T /lib/libgcc_s.so.1|grep div
000024c0 g    DF .text  00000162  GLIBC_2.0   __divdi3
00002b80 g    DF .text  000001ed  GCC_3.0     __udivmoddi4
00002870 g    DF .text  00000120  GLIBC_2.0   __udivdi3

you can link module with libgcc.a or fix it.

Just add an implementation for __udivsi3_i4 to arch/sh/lib/. They already have udivdi3.c over there.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw

On Fri, 2004-09-24 10:33:12 +0200, Geert Uytterhoeven <[email protected]> wrote in message <[email protected]>:

Quoted 10 lines · On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
Quoted 9 lines · Donald Duckie
Quoted 3 lines

can somebody please help me how to overcome this
problem:
unresolved symbol __udivsi3_i4

# objdump -T /lib/libgcc_s.so.1|grep div
000024c0 g    DF .text  00000162  GLIBC_2.0   __divdi3
00002b80 g    DF .text  000001ed  GCC_3.0     __udivmoddi4
00002870 g    DF .text  00000120  GLIBC_2.0   __udivdi3
Quoted 4 lines
Quoted 1 line

you can link module with libgcc.a or fix it.

Just add an implementation for __udivsi3_i4 to arch/sh/lib/. They already have udivdi3.c over there.

Either that (which I don't like!), or have a try compiling the kernel with -ffreestanding, if your toolchain accepts that. Maybe that doesn't create these external function calls at all...

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#8 lore raw
Quoted 12 lines · Jan-Benedict Glaw

On Fri, 2004-09-24 10:33:12 +0200, Geert Uytterhoeven <[email protected]> wrote in message <[email protected]>:

Quoted 10 lines · On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
Quoted 9 lines · Donald Duckie
Quoted 3 lines

can somebody please help me how to overcome this
problem:
unresolved symbol __udivsi3_i4

# objdump -T /lib/libgcc_s.so.1|grep div
000024c0 g    DF .text  00000162  GLIBC_2.0   __divdi3
00002b80 g    DF .text  000001ed  GCC_3.0     __udivmoddi4
00002870 g    DF .text  00000120  GLIBC_2.0   __udivdi3
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

you can link module with libgcc.a or fix it.

Just add an implementation for __udivsi3_i4 to arch/sh/lib/. They already have udivdi3.c over there.

Either that (which I don't like!), or have a try compiling the kernel

Why don't you like that? It's done that way on most architectures.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#9 lore raw

On Fri, 2004-09-24 13:15:26 +0200, Geert Uytterhoeven <[email protected]> wrote in message <[email protected]>:

Quoted 7 lines · Jan-Benedict Glaw
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

unresolved symbol __udivsi3_i4

# objdump -T /lib/libgcc_s.so.1|grep div
000024c0 g    DF .text  00000162  GLIBC_2.0   __divdi3
00002b80 g    DF .text  000001ed  GCC_3.0     __udivmoddi4
00002870 g    DF .text  00000120  GLIBC_2.0   __udivdi3
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

you can link module with libgcc.a or fix it.

Just add an implementation for __udivsi3_i4 to arch/sh/lib/. They already have udivdi3.c over there.

Either that (which I don't like!), or have a try compiling the kernel

Why don't you like that? It's done that way on most architectures.

Well, the kernel is (or should be) a freestanding program, so it shouldn't use *any* external code (and it doesn't, intentionally). We're working hard not linking in libgcc.a (IIRC some archs actually do that) (because eg. your compiler was compiled for i686-pc-linux-gnu, you want to compile for a real i386 and end up with Pentium-alike code in your i386 kernel).

So people started doing freestanding implementations of eg. __udivsi3 in their kernel files. But why should they? GCC also could have emitted inlined code to do that task, without ever calling an external function for that.

However, this topic has been discussed several times with no real resolution, so I guess we won't find a real cool solution this time, too.

MfG, JBG (and greetings from Oldenburg!)

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#10 lore raw
Quoted 3 lines · Jan-Benedict Glaw

Well, the kernel is (or should be) a freestanding program, so it shouldn't use *any* external code (and it doesn't, intentionally). We're working hard not linking in libgcc.a

libgcc is an intrinsic part of the freestanding implementation provided by the compiler, just like <stdarg.h>.

Quoted 4 lines

So people started doing freestanding implementations of eg. __udivsi3 in their kernel files. But why should they? GCC also could have emitted inlined code to do that task, without ever calling an external function for that.

Inlining can be less efficient due to icache issues.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."