[PATCH] libtests/dl06: Add -lm

Chris Johns chrisj at rtems.org
Mon Nov 9 01:23:41 UTC 2020


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.

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?

Chris

> ---
>  spec/build/testsuites/libtests/dl06.yml | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/spec/build/testsuites/libtests/dl06.yml b/spec/build/testsuites/libtests/dl06.yml
> index 2f5d4ab08d..e1bbd006c9 100644
> --- a/spec/build/testsuites/libtests/dl06.yml
> +++ b/spec/build/testsuites/libtests/dl06.yml
> @@ -42,7 +42,8 @@ ldflags: []
>  links: []
>  prepare-build: null
>  prepare-configure: null
> -stlib: []
> +stlib:
> +- m
>  type: build
>  use-after: []
>  use-before: []
> 


More information about the devel mailing list