Re: Using floating point calculations in kernel module (x86/amd64)

Wilfried Holzke <[email protected]> Tue, 18 Oct 2016 18:55:51 +0200
Newsgroups gmane.linux.real-time.rtai
Message-ID <[email protected]>
Hi,

> Does your CPU support floating point?
> Have you configured RTAI for FP support in kernel space with NEWLIB-UCLIB-MUSL?
> Can you run the test in "showroom/v3.x/kernel/math"?

To run the math-example for:

PU: AMD FX 4300
Distribution: Gentoo
GCC: 4.9.3
RTAI: 5.0-test2

I tried the information from README.KBUILD (vulcano/base/math/, Rev. 1.13)

-------------------------------------

glibc 2.22: tested with x86
   - lib installed by Gentoo system

Result: unknown symbols:
   __get_cpu_features
   errno
   _GLOBAL_OFFSET_TABLE
   _dl_hwcap

I had no idea how to solve this.

-------------------------------------

newlib 2.4.0: tested with x86, x86_64
   - configure --prefix=installdir --disable-shared --disable-multilib 
--host=i386-pc-sysv CFLGAS="-02" --with-newlib

   Problem: missing symbol "__stack_chk_fail" from rtai_math.ko


The following is only tested with x86:

compiling with "-fno-stack-protector" is not possible, it seems that my 
attempts to insert the option is not at the right place or the wrong 
solution. In which Makefile would I have to insert this option?  (tried 
a simple hello world program with and without this options and disabling 
works)

With an empty function: "void __stack_chk_fail(void) {}"
it is possible to load the module.

Changed fp_rt.ko to run only one loop step (sine example),
When loading "fp_rt.ko":

   unknown symbol:
    - fpclassify
   added procedure: int fpclassify(double x) { return 1; }, then

   "default trap handler vector 13 suspend rt task ...."

    Probably due to the previous problem with "__stack_chk_fail" or 
"fpclassify"!?

-------------------------------------

musl 1.1.14: tested with x86
   - builds no libm.a, all is in libc.a: Do I miss a "configure" 
option/parameter?


-------------------------------------
Finally:

uClibc 0.9.33.2: tested with x86

    - build for 486 with options from README.KBUILD (multithreads: 
"newer" linux threads)
    - test fp_rt module building, loading and unloading

=> successfull.


So I will use uClibc.

Are there any differences between the different libraries for using 
floating point operations?


regards

     W. Holzke


_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai