Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#4443 new defect

powerpc/motorola_powerpc BSPs build bootloader with -msoft-float

Reported by: Andrew Johnson Owned by:
Priority: normal Milestone:
Component: admin Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

While working on the EPICS port to RTEMS-5 and trying to link an EPICS test application into a bootable binary for the mvme2100 BSP built with RTEMS-5.1, I get this error:

/usr/local/rtems-5.1/bin/powerpc-rtems5-ld: libComTestHarness uses hard float, /usr/local/rtems-5.1/powerpc-rtems5/mvme2100/lib/bootloader.o uses soft float
/usr/local/rtems-5.1/bin/powerpc-rtems5-ld: failed to merge target specific data of file libComTestHarness

The libComTestHarness is the EPICS test application. I get the same error with the mvme2307 BSP, which is part of the same powerpc/motorola_powerpc BSP family as the mvme2100.

After investigation I found that a recent version of binutils has made linking soft-float code with hard-float an error instead of just emitting a warning, which may be why this problem hasn't come up before. I don't see that warning when I build for the mvme2100 with RTEMS-4.9.2 but the warning message may have been added more recently than the version of binutils used for that release.

This is coming from the AM_CFLAGS definition in c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am which includes the flag -msoft-float whereas all of the motorola_powerpc boards have an FPU as far as I know (none of the BSP config/*.cfg files provide that flag). Thus I first tried removing just that flag:

  • c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am

    diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am b/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
    index 42b70544e6..1b4b95b14c 100644
    a b bootloader_SOURCES += ../../../../../../../bsps/powerpc/motorola_powerpc/bootloa 
    2121# Remove references to EABI when compiling bootloader
    2222BOOTLOADER_CPU_CFLAGS=$(subst -msdata=eabi,,$(subst -meabi,,$(CPU_CFLAGS)))
    2323AM_CPPFLAGS = -D__BOOT__ @RTEMS_CPPFLAGS@ @RTEMS_BSP_CPPFLAGS@
    24 AM_CFLAGS = -mrelocatable -msoft-float \
     24AM_CFLAGS = -mrelocatable \
    2525    -mstrict-align -fno-builtin -Wall -mmultiple -mstring -O2 \
    2626    -fomit-frame-pointer -ffixed-r13 -mno-sdata $(BOOTLOADER_CPU_CFLAGS)
    2727AM_CCASFLAGS = $(AM_CPPFLAGS) \

However that doesn't seem to be enough, the result gives this application build error instead:

/usr/local/rtems-5.1/bin/powerpc-rtems5-objcopy -O binary -R .comment -S libComTestHarness rtems
gzip -f9 rtems
/usr/local/rtems-5.1/bin/powerpc-rtems5-ld -o libComTestHarness.boot /usr/local/rtems-5.1/powerpc-rtems5/mvme2100/lib/bootloader.o --just-symbols=libComTestHarness -b binary rtems.gz -T /usr/local/rtems-5.1/powerpc-rtems5/mvme2100/lib/ppcboot.lds -Map libComTestHarness.map
/usr/local/rtems-5.1/bin/powerpc-rtems5-ld: libComTestHarness: compiled normally and linked with modules compiled with -mrelocatable
/usr/local/rtems-5.1/bin/powerpc-rtems5-ld: failed to merge target specific data of file libComTestHarness

I don't have a good feel for exactly what the -mrelocatable flag is doing, but the documentation implied something like it is probably needed in this case. It also showed a similar but apparently more liberal -mrelocatable-lib flag. On applying this change and rebuilding the BSP I was able to get my EPICS build to succeed:

  • c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am

    diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am b/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
    index 42b70544e6..92d6e21f40 100644
    a b bootloader_SOURCES += ../../../../../../../bsps/powerpc/motorola_powerpc/bootloa 
    2121# Remove references to EABI when compiling bootloader
    2222BOOTLOADER_CPU_CFLAGS=$(subst -msdata=eabi,,$(subst -meabi,,$(CPU_CFLAGS)))
    2323AM_CPPFLAGS = -D__BOOT__ @RTEMS_CPPFLAGS@ @RTEMS_BSP_CPPFLAGS@
    24 AM_CFLAGS = -mrelocatable -msoft-float \
     24AM_CFLAGS = -mrelocatable-lib \
    2525    -mstrict-align -fno-builtin -Wall -mmultiple -mstring -O2 \
    2626    -fomit-frame-pointer -ffixed-r13 -mno-sdata $(BOOTLOADER_CPU_CFLAGS)
    2727AM_CCASFLAGS = $(AM_CPPFLAGS) \
    28     -mrelocatable -DASM $(BOOTLOADER_CPU_CFLAGS)
     28    -mrelocatable-lib -DASM $(BOOTLOADER_CPU_CFLAGS)
    2929
    3030#
    3131# CAUTION :

I don't have a VME chassis or an MVME2100 board at home with me to test with, but I hope to be able to check if the result boots and works properly once I get back into the office (which might be a few weeks though). I'm filing this ticket now to see if anyone else has come across or already solved this problem, and to see if the solution looks reasonable to those with more experience.

Any comments?

Change History (1)

comment:1 Changed on 06/21/21 at 00:52:05 by Andrew Johnson

Felix Kraemer from Gemini found a linker flag --no-warn-mismatch which seems to permit applications to be built against an unmodified BSP without getting the error, but that probably isn't the best solution in the long run. I have added that flag to the EPICS build system for the mvme2100 and mvme2700 (AKA mvme2307) BSPs since we have a release coming up, but I plan to work on a better fix to the RTEMS BSP bootloader files once I have access to my VME systems again.

Note: See TracTickets for help on using tickets.