Altera Nios2 troubles

Peter S. Mazinger ps.m at gmx.net
Wed Jul 12 15:38:55 UTC 2006


On Wed, 12 Jul 2006, Cristiano Ghirardi wrote:

Repeating 3 times the question (and IIRC one time yesterday) won't make it 
get an answer, probably gcc-4.0.2 needs some patches that are in 
gcc-3.4.x

Peter

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

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2




More information about the uClibc mailing list