2004-09-24 02:32:21

by Donald Duckie

[permalink] [raw]
Subject: unresolved symbol __udivsi3_i4

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


2004-09-24 03:03:24

by Randy.Dunlap

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

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

2004-09-24 03:31:17

by Randy.Dunlap

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

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

2004-09-24 06:06:48

by Paweł Sikora

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

On Friday 24 of September 2004 04:10, Donald Duckie wrote:
> 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.

--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

#define say(x) lie(x)

2004-09-24 06:14:56

by Donald Duckie

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

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.



--- "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
>
> --
> ~Randy
>




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

2004-09-24 08:35:05

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
> On Friday 24 of September 2004 04:10, Donald Duckie wrote:
> > 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.

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

2004-09-24 10:52:25

by Jan-Benedict Glaw

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

On Fri, 2004-09-24 10:33:12 +0200, Geert Uytterhoeven <[email protected]>
wrote in message <[email protected]>:
> On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
> > On Friday 24 of September 2004 04:10, Donald Duckie wrote:
> > > 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
> >
> > 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

--
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));


Attachments:
(No filename) (1.26 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-24 11:15:41

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

On Fri, 24 Sep 2004, Jan-Benedict Glaw wrote:
> On Fri, 2004-09-24 10:33:12 +0200, Geert Uytterhoeven <[email protected]>
> wrote in message <[email protected]>:
> > On Fri, 24 Sep 2004, [utf-8] Pawe? Sikora wrote:
> > > On Friday 24 of September 2004 04:10, Donald Duckie wrote:
> > > > 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
> > >
> > > 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

2004-09-24 11:29:59

by Jan-Benedict Glaw

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

On Fri, 2004-09-24 13:15:26 +0200, Geert Uytterhoeven <[email protected]>
wrote in message <[email protected]>:
> On Fri, 24 Sep 2004, Jan-Benedict Glaw wrote:
> > > > > 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
> > > >
> > > > 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!)

--
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));


Attachments:
(No filename) (1.87 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-24 12:49:16

by Andreas Schwab

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

Jan-Benedict Glaw <[email protected]> writes:

> 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>.

> 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.

--
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."

2004-09-24 23:21:01

by Randy.Dunlap

[permalink] [raw]
Subject: Re: unresolved symbol __udivsi3_i4

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