[RTEMS Project] #4443: powerpc/motorola_powerpc BSPs build bootloader with -msoft-float
RTEMS trac
trac at rtems.org
Wed May 26 19:59:57 UTC 2021
#4443: powerpc/motorola_powerpc BSPs build bootloader with -msoft-float
-----------------------------+--------------------
Reporter: Andrew Johnson | Owner: (none)
Type: defect | Status: new
Priority: normal | Milestone:
Component: admin | Version: 5
Severity: normal | Keywords:
Blocked By: | Blocking:
-----------------------------+--------------------
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:
{{{#!patch
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/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
@@ -21,7 +21,7 @@ bootloader_SOURCES +=
../../../../../../../bsps/powerpc/motorola_powerpc/bootloa
# Remove references to EABI when compiling bootloader
BOOTLOADER_CPU_CFLAGS=$(subst -msdata=eabi,,$(subst
-meabi,,$(CPU_CFLAGS)))
AM_CPPFLAGS = -D__BOOT__ @RTEMS_CPPFLAGS@ @RTEMS_BSP_CPPFLAGS@
-AM_CFLAGS = -mrelocatable -msoft-float \
+AM_CFLAGS = -mrelocatable \
-mstrict-align -fno-builtin -Wall -mmultiple -mstring -O2 \
-fomit-frame-pointer -ffixed-r13 -mno-sdata $(BOOTLOADER_CPU_CFLAGS)
AM_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:
{{{#!patch
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/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/bootloader/Makefile.am
@@ -21,11 +21,11 @@ bootloader_SOURCES +=
../../../../../../../bsps/powerpc/motorola_powerpc/bootloa
# Remove references to EABI when compiling bootloader
BOOTLOADER_CPU_CFLAGS=$(subst -msdata=eabi,,$(subst
-meabi,,$(CPU_CFLAGS)))
AM_CPPFLAGS = -D__BOOT__ @RTEMS_CPPFLAGS@ @RTEMS_BSP_CPPFLAGS@
-AM_CFLAGS = -mrelocatable -msoft-float \
+AM_CFLAGS = -mrelocatable-lib \
-mstrict-align -fno-builtin -Wall -mmultiple -mstring -O2 \
-fomit-frame-pointer -ffixed-r13 -mno-sdata $(BOOTLOADER_CPU_CFLAGS)
AM_CCASFLAGS = $(AM_CPPFLAGS) \
- -mrelocatable -DASM $(BOOTLOADER_CPU_CFLAGS)
+ -mrelocatable-lib -DASM $(BOOTLOADER_CPU_CFLAGS)
#
# 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?
--
Ticket URL: <http://devel.rtems.org/ticket/4443>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list