On Sun, Sep 21, 2014 at 9:55 PM, BAndViG <[email protected]> wrote:
> Hello all.
> I'm trying to port 'whetstone' FPU benchmark. I've found that I couldn't
> compile the ported result due to or1k-elf-gcc isn't able to find references
> for trigonometric functions. So, I wrote the simple program:
>
> /* start of fsin.c */
> #include <stdlib.h>
> #include <stdio.h>
> #include <math.h>
>
> int main(void)
> {
>  float x = 3.14159 / 4.0;
>  printf("\n x=%f y=%f",x,sin(x));
>  return 0;
> }
> /* end of fsin.c */
>
> and I run compilation with the following command:
>
> or1k-elf-gcc -mhard-mul -mhard-div -msoft-float -mboard=atlys fsin.c -o
> fsin.elf
>
> I received the following error messages:
>
>  /tmp/ccChxUjX.o: In function `main':
>  fsin.c:(.text+0x48): undefined reference to `sin'
>  collect2: error: ld returned 1 exit status
>
> I tried to add -lm option (as I found trigonometric names in
> /opt/or1k-toolchain/or1k-elf/lib/soft-float/libm.a), but the result was the
> same.
>
> So my question is how to use trigonometric functions in or1k newlib tool
> chain?

This works fine for me:
or1k-elf-gcc -mhard-mul -mhard-div -msoft-float -mboard=atlys fsin.c
-lm -o fsin.elf

Stefan
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to