OpenCores
no use no use 1/1 no use no use
Why I can not use division in my application?
by dk.pure on Oct 11, 2011
dk.pure
Posts: 3
Joined: Aug 13, 2011
Last seen: Aug 22, 2012
Hi,

I would like to ask why i can not use division in my c application?
I use the or32-elf-gcc to cpmpile my program and the CFLAGS is "-g -c -Wunknown-pragmas -mhard-mul -msoft-div -msoft-float -O2".

For example there is a function:

void func(int number)
{
int a = number / 10;
int b = a;
}

after "make" I got this error: undefined refernce to `__divsi3'.
I just do not know why this was happened.
Please give me some hints.

Many thanks in advance.
RE: Why I can not use division in my application?
by julius on Oct 11, 2011
julius
Posts: 363
Joined: Jul 1, 2008
Last seen: May 17, 2021
That function should be in the GCC-provided library that is always accessible to the linker, unless you use the -nostdlib switch when compiling.

How did you build and install your toolchain?
RE: Why I can not use division in my application?
by dk.pure on Oct 12, 2011
dk.pure
Posts: 3
Joined: Aug 13, 2011
Last seen: Aug 22, 2012
Thanks for your reply!

I install the toolchain by following this "http://opencores.org/openrisc,gnu_toolchain" website.
Actually I use the so-called "Newlib Toolchain 1.0rc1 Precompiled Binaries" in my ubuntu 9.10.The toolchain which i downloaded is "or32-elf-1.0rc1-x86.tar.bz2", and i installed it follow that website:
cd /opt
tar xjf or32-elf-1.0rc1-x86.tar.bz2
sudo ln -s or32-elf-1.0rc1 or32-elf
sudo ln -s or1ksim-0.5.1rc1 or1ksim

and in my ~/.bashrc there is:
export PATH=$PATH/opt/or32-elf/bin:/opt/or1ksim/bin

I think it has been correctly installed, isn't it?


RE: Why I can not use division in my application?
by dk.pure on Oct 13, 2011
dk.pure
Posts: 3
Joined: Aug 13, 2011
Last seen: Aug 22, 2012
That function should be in the GCC-provided library that is always accessible to the linker, unless you use the -nostdlib switch when compiling.

How did you build and install your toolchain?


Thanks for your reply!

I install the toolchain by following this "http://opencores.org/openrisc,gnu_toolchain" website.
Actually I use the so-called "Newlib Toolchain 1.0rc1 Precompiled Binaries" in my ubuntu 9.10.The toolchain which i downloaded is "or32-elf-1.0rc1-x86.tar.bz2", and i installed it follow that website:
cd /opt
tar xjf or32-elf-1.0rc1-x86.tar.bz2
sudo ln -s or32-elf-1.0rc1 or32-elf
sudo ln -s or1ksim-0.5.1rc1 or1ksim

and in my ~/.bashrc there is:
export PATH=$PATH/opt/or32-elf/bin:/opt/or1ksim/bin

I think it has been correctly installed, isn't it?
RE: Why I can not use division in my application?
by julius on Oct 19, 2011
julius
Posts: 363
Joined: Jul 1, 2008
Last seen: May 17, 2021
What is the final make command that causes the linking error?
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.