SPARC floating point functions from math.h

Joel Sherrill joel at rtems.org
Sun Dec 11 19:29:44 UTC 2016


On Dec 11, 2016 1:21 PM, "Rehab Massoud" <rehab.massoud at gmail.com> wrote:

Hi RTEMS users,

I have 2 questions:

1) Can I use the -msoft-mfloat option while compiling an application that
have floating point calculations to handle them using software implemented
floating point functions?

2) I'm trying to compile an application that runs as a task in RTEMS using
gaisler's sparc-rtems; and it is using some floating point functions from
math.h. The program compiles and runs normally on host. But when I try to
compile it with sparc-rtems compiler it doesn't accept these functions with
-lm linking option as below:



What did you do to link against libm. What was the actual command line for
linking?

The methods are there.


sparc-rtems-gcc: unrecognized option '-rdynamic'
s/(my_file.c.o): In function `round':
my_file.c:(.text+0x434): undefined reference to `ceilf'
s/(my_file.c.o): In function `round':
my_file.c:(.text+0x450): undefined reference to `floorf'
s/(my_file.c.o): In function `wi':
my_file.c:(.text+0x478): undefined reference to `fmodf'
s/(my_file.c.o): In function `arc_tangens':
my_file.c:(.text+0x488): undefined reference to `atan2f'
s/(my_file.c.o): In function `arc_tangens':
my_file.c:(.text+0x498): undefined reference to `atanf'
s/(my_file.c.o): In function `tangens':
my_file.c:(.text+0x4a8): undefined reference to `tanf'
s/(my_file.c.o): In function `cosinus':
my_file.c:(.text+0x4b8): undefined reference to `cosf'
s/(my_file.c.o): In function `sinus':
my_file.c:(.text+0x4c8): undefined reference to `sinf'
s/(my_file.c.o): In function `resol':
my_file.c:(.text+0x51c): undefined reference to `sqrtf'
collect2: ld returned 1 exit status

when using -std=99 to force accepting them (not sure if this is correct or
if there is a better way to force it). But then I get obviously the error
below:

/opt/rtems-4.10/sparc-rtems/leon3/lib/include/leon.h: In function
'leon_r32_no_cache':
/opt/rtems-4.10/sparc-rtems/leon3/lib/include/leon.h:258: error: 'asm'
undeclared (first use in this function)
/opt/rtems-4.10/sparc-rtems/leon3/lib/include/leon.h:258: error: (Each
undeclared identifier is reported only once
/opt/rtems-4.10/sparc-rtems/leon3/lib/include/leon.h:258: error: for each
function it appears in.)
/opt/rtems-4.10/sparc-rtems/leon3/lib/include/leon.h:258: error: expected
';' before 'volatile'


These likely are addressed in newer versions. The trick is using the
keyword with underscores that is accepted. Can't give more specific details
from my phone but checking the current source should show them.


Do these floating point functions' implementations exist in libm.a included
in the sparc-rtems binary downloaded from http://www.gaisler.com/
anonftp/rcc/src/rtems-4.10-1.2.20-src.tar.bz2
<http://www.gaisler.com/anonftp/rcc/src/rtems-4.10-1.2.20-src.tar.bz2>04-Nov-2016
07:46 8.9M? or do I have to implement these functions myself?


They should be since they have existed in the main RTEMS distribution for
20 years.


Best Regards,

Rehab

_______________________________________________
users mailing list
users at rtems.org
http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20161211/45b7a2e3/attachment-0002.html>


More information about the users mailing list