[PATCH] libtests/dl06: Add -lm

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Nov 9 07:24:28 UTC 2020

On 09/11/2020 02:23, Chris Johns wrote:

> On 3/11/20 3:39 am, Sebastian Huber wrote:
>> There is probably something wrong with this test program.  If it is compiled
>> without function/data sections, no optimization, and no linker garbage
>> collection, then there is an undefined reference to atan2() and tan().
> These symbols are referenced in the loaded module ...
> https://git.rtems.org/rtems/tree/testsuites/libtests/dl06/dl06-o2.c
> This test gets rtems-ld with the RAP format to collect the atan1 and tan code
> into the loaded module. They should not be present in the base image. The libm
> library is used because it is _not_ part of the standard libraries linked and is
> available everywhere.
>> Fix this issue by adding -lm.
> Is the error linking the base kernel image or the RAP loadable module?
> If it is the loadable module and this is how you add the libraries to be
> searched to the rtems-ld command then the fix is needed and there is no problem.
> If the error was in the base kernel image then I suggest something else is wrong
> because those symbols should not be present in the base image. If the build
> system can support options for just rtems-ld then adding it there would be good.

The error is in this command:

[4044/4050] Processing link: 
build/arm/realview_pbx_a9_qemu/testsuites/libtests/dl06/dl06-sym.o -> 
08:21:03 runner ['/build/rtems/6/bin/arm-rtems6-gcc', '-qnolinkcmds', 
'-T', 'linkcmds.realview_pbx_a9_qemu', 
'-Wl,--wrap=printf', '-Wl,--wrap=puts', '-L.', '-lrtemscpu', 
'-lrtemsbsp', '-lrtemstest', '-qrtems', '-march=armv7-a', '-mthumb', 
'-mfpu=neon', '-mfloat-abi=hard', '-mtune=cortex-a9', 
in function `dl_o2_func2':
undefined reference to `atan2'
in function `dl_o2_func3':

undefined reference to `tan'

I used the following config.ini:


> More of a concern is no error. I wonder if the code is being inlined when there
> is FPU support. Maybe the test needs to create a library linking to it to be
> more robust?
Using these functions without -fno-builtin is not really robust.

embedded brains GmbH
Sebastian HUBER
Dornierstr. 4
82178 Puchheim
email: sebastian.huber at embedded-brains.de
Phone: +49-89-18 94 741 - 16
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

embedded brains GmbH
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/

More information about the devel mailing list