MicroBlaze Dynamic Loader Test Failures

Chris Johns chrisj at rtems.org
Tue Aug 1 03:52:51 UTC 2023


On 1/8/2023 1:46 pm, Alex White wrote:
> Hi,
> 
> I am currently working on RTEMS dynamic loader support for MicroBlaze. I got most of the dynamic loader tests working, but for a few of them, I had to modify the test. I believe the failures are because the MicroBlaze RTEMS port uses soft floating point emulation. Tests dl07, dl08, and dl09 fail because the objects being loaded include floating point code that requires an extra routine from GCC, `__extendsfdf2`, that is not included in the base application.
> 
> According to GCC documentation (https://gcc.gnu.org/onlinedocs/gccint/Soft-float-library-routines.html), `__extendsfdf2` is used to extend a float to a double. This is needed in test dl07, for example, to print `dl01_bss2[0]` on line 66:
> 
> printf (DL_NAME ": dl01_bss2: %4zu: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
> 
> The modification that I made to get this working was to add the following to init.c in each of the three failing tests:
> 
> #ifdef __microblaze__
> extern double __extendsfdf2 (float a);
> /* This ensures that __extendsfdf2 is included in the compiled output. */
> double (*extendsfdf2_fp)(float) = &__extendsfdf2;
> #endif /* __microblaze__ */
> 
> I'm not sure of any way to check whether or not this code should be included other than `#ifdef __microblaze__`. This doesn't seem like a great solution, though. I searched for a predefined macro that would allow this to be generic across different architectures, maybe something indicating software floating point, but I couldn't find anything suitable.
> 
> Does anyone have a suggestion for a better way to solve this?

There is no clean way to solve this. It is the classic embedded dynamic loading
trade off normally solved at a system level.

A solution that may work is to add `libgcc.a` to the tar file in the test exe
then configure a `/etc/ld.conf` (I think that is the file name) to search the
archive for symbols. The RTL should resolve the missing symbols on the target at
run time and load the needed object files.

If this support is made conditional on some sort of soft-float build system
conditional it should work for any other targets with the same issue.

Chris


More information about the devel mailing list