Altera Nios2 troubles

Cristiano Ghirardi cristiano.ghirardi at gmail.com
Wed Jul 12 13:08:47 UTC 2006


Hi all,
I have had some troubles  compiling  buildroot for Altera Nios2
architecture. First of all I got this error:

<<
   ../buildroot/toolchain_build _nios2/binutils-2.15/gas/config/tc-nios2.c:
In function 'md_apply_fix3':
    ../buildroot/toolchain_build_nios2/binutils-2.15/gas/config/tc-nios2.c:1664:
error: invalid lvalue in assignment
>>

My gcc compiler 4.0.2 doesn't like very much this kind of statement:

<<
      /* apply the rightshift */
      (signed) fixup >>= howto->rightshift;
>>

To get rid of the error I've applied this patch:

1523d1522
<   signed tmp_s;
1665,1667c1664
<           tmp_s = (signed)fixup;
<           tmp_s >>= howto->rightshift;
<           fixup = tmp_s;
---
>         (signed) fixup >>= howto->rightshift;
1711,1712d1707
<   signed tmp_s;
<
1714,1716c1709
<   tmp_s = (signed)fixup;
<   tmp_s >>= howto->rightshift;
<   fixup = tmp_s;
---
>   (signed) fixup >>= howto->rightshift;

After this I've discovered that it's necessary to do a:

make clean
make

to restart in a clean way.

Everything seems fine until the final gcc linking at this stage I get:

<<
        PREFIX=../buildroot/build_nios2/root utils install_utils
make[1]: Entering directory `../buildroot/toolchain_build_nios2/uClibc'
  CC utils/readelf
../lib/libc.a(fwrite_unlocked.o)(.text+0x58): In function
`__GI_fwrite_unlocked':
: undefined reference to `__udivsi3'
../lib/libc.a(fwrite_unlocked.o)(.text+0x78): In function
`__GI_fwrite_unlocked':
: undefined reference to `__udivsi3'
../lib/libc.a(_uintmaxtostr.o)(.text+0x70): In function `_uintmaxtostr':
: undefined reference to `__udivsi3'

>>

If I try to compile selecting gcc-3.4.2 all works fine.
After a long analysis the problem seems the different contents in libgcc.a:

toolchain_build_nios2/gcc-3.4.6-final/gcc> nm libgcc.a|grep __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3

 toolchain_build_nios2/gcc-3.4.2-final/gcc>  nm libgcc.a|grep __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3
         U __udivsi3
00000114 T __udivsi3

That depends in differences between  libgcc.mk makefile in the two
directories.
I was not able to understand the origin of the problem: to tell the truth I
didn't find enough documentation to clarify myself  the
way gcc get compiled in two stages (initial and final) and the way the
makefiles are  created.
Any help will be very appreciated!
Thanks  in advance.


-- 
-- Cristiano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20060712/d11fa273/attachment-0002.htm 


More information about the uClibc mailing list