Migrating a BSP to 4.11

Till Straumann strauman at slac.stanford.edu
Tue Feb 1 03:27:36 UTC 2011

On 01/31/2011 08:48 PM, Claus, Ric wrote:
> Hi All,
> I'm trying to migrate a custom BSP from RTEMS 4.9.2 to 4.11 (which
> has been far from self evident).  I am now getting bursts of the
> following error message when the testsuites are built.  Could someone
> please tell me what's causing it and where to start looking?

The PPC sysv ABI reserves one register (the eabi reserves two)
which remains constant throughout the execution of the program.
It points to a memory area which can be addressed in both
a time- and space-efficient way (many instructions can access
a datum within +/- 32k off where that base register points to

Since the space in this area is limited it is best used for
small data objects, hence the acronym SDA for Small Data Area.

The compiler can locate data in the SDA and emits special
relocations for these data. The linker must make sure all
these data are within a single 64k section. In order for this
to work the compiler puts such data in '.sdata' or '.sbss'
sections which must be gathered by the linker into a single
output section (which must be <64k for the link to succeed).

Most likely, your linker script (if you designed a BSP then you most
likely copy/pasted a linker script) does not correctly define/use the
.sdata, .sbss (and in case of eabi: .sdata2  and .sbss2) sections.

If at all possible let your BSP's Makefile.am grab a linker script
from another PPC BSP (rather than copy/paste it) e.g.,
powerpc/startup/shared. This way, you 'inherit' modifications.
If that's not possible then you have to merge the relevant pieces
of e.g., the aforementioned script into yours.

> section is being wanted?

.sdata and .sbss (+ .sdata2 and .sbss2 in case of eabi).

However, note that the script also must define a few symbols
(IIRC they are _SDA_BASE_, __SDATA_START__, __SDATA_END__,
__SDATA2_END__, __SBSS2_START__, __SBSS2_END__) so that the
BSP initialization code correctly loads the base register
(R13; in case of eabi also R2).
Hopefully your BSP uses the correct gcc start/end files and
startup code etc. to do that for you.
See 'powerpc/shared/start/rtems_crti.S , powerpc/shared/start/start.S
et. al'.

Basically, your start.S (which is also better to inherit rather
than copy/paste from powerpc/shared/start/) should call __eabi
(provided by gcc: <gcc_src_top>/gcc/config/rs6000/eabi.asm)
and your bsp_specs should list rtems_crti at the right place (see

-- Till

> Thanks very much!
> Ric
> /reg/common/package/gnu/rtems-4.11/lib/gcc/powerpc-rtems4.11/4.5.1/../../../../powerpc-rtems4.11/bin/ld:
> ../../../../../rce405/lib/librtemsbsp.a(exc_bspsupport.rel): the
> target (ppc_exc_msr_bits) of a R_PPC_SDAREL16 relocation is in the
> wrong output section (.data)
> _______________________________________________ rtems-users mailing
> list rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users

More information about the users mailing list