[PATCH] libtests/dl06: Add -lm
chrisj at rtems.org
Tue Nov 10 23:58:50 UTC 2020
On 10/11/20 6:32 pm, Sebastian Huber wrote:
> On 09/11/2020 23:42, Chris Johns wrote:
>> On 9/11/20 6:24 pm, Sebastian Huber wrote:
>>> 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 ...
>>>> 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
>>>> If the error was in the base kernel image then I suggest something else is
>>>> 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
>>> 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',
>> These should not be linked into the base image. They are in the RAP image in
> What shouldn't be linked in? The entire object files or only some functions in it?
In this test dl06-o1.o and dl06-o2.o.
In general any code placed in the tar file to be dynamically load. Linking the
code to be loaded into the base image potentinally breaks the test.
>>> '-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:
>>> BUILD_LIBTESTS = True
>>> OPTIMIZATION_FLAGS = -O0 -g
>>> LDFLAGS =
>>>> 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.
>> Would adding a pragma for this option to dl06-o1.c and dl06-o2.c be acceptable
>> as a solution?
> I am not sure if a pragma works for these options. We can add -fno-builtin=tan
> -fno-builtin=atan2. We can use also some global volatile variables which seems
> to work for the math tests.
But only for dl06-o1.o and dl06-o2.o in the test?
More information about the devel