| |||
| Home > Features of the Base Platform linking model > Restrictions on the use of scatter files with the Base Platform model | |||
The Base Platform model supports scatter files. Although there are no restrictions on the keywords you can use in a scatter file, there are restrictions on the types of scatter files you can use:
A load region marked with the RELOC attribute
must contain only execution regions with a relative base address
of +. The following
examples show valid and invalid scatter files using the offsetRELOC attribute
and + relative
base address:offset
Example 45. Valid scatter file example using RELOC and +offset
# This is valid. All execution regions have +offset addresses.
LR1 0x8000 RELOC
{
ER_RELATIVE +0
{
*(+RO)
}
}
Example 46. Invalid scatter file example using RELOC and +offset
# This is not valid. One execution region has an absolute base address.
LR1 0x8000 RELOC
{
ER_RELATIVE +0
{
*(+RO)
}
ER_ABSOLUTE 0x1000
{
*(+RW)
}
}
Any load region that requires a PLT section must
contain at least one execution region containing code, that is not
marked OVERLAY. This execution region is used
to hold the PLT section. An OVERLAY region cannot
be used as the PLT must remain in memory at all times. The following
examples show valid and invalid scatter files that define execution
regions requiring a PLT section:
Example 47. Valid scatter file example for a load region that requires a PLT section
# This is valid. ER_1 contains code and is not OVERLAY.
LR_NEEDING_PLT 0x8000
{
ER_1 +0
{
*(+RO)
}
}
Example 48. Invalid scatter file example for a load region that requires a PLT section
# This is not valid. All execution regions containing code are marked OVERLAY.
LR_NEEDING_PLT 0x8000
{
ER_1 +0 OVERLAY
{
*(+RO)
}
ER_2 +0
{
*(+RW)
}
}
If a load region requires a PLT section, then the PLT section must be placed within the load region. By default, if a load region requires a PLT section, the linker places the PLT section in the first execution region containing code. You can override this choice with a scatter-loading selector.
If there is more than one load region containing code, the
PLT section for a load region with name is name.plt_.
If there is only one load region containing code, the PLT section
is called name.plt.
The following examples show valid and invalid scatter files that place a PLT section:
Example 49. Valid scatter file example for placing a PLT section
#This is valid. The PLT section for LR1 is placed in LR1.
LR1 0x8000
{
ER1 +0
{
*(+RO)
}
ER2 +0
{
*(.plt_LR1)
}
}
LR2 0x10000
{
ER1 +0
{
*(other_code)
}
}
Example 50. Invalid scatter file example for placing a PLT section
#This is not valid. The PLT section of LR1 has been placed in LR2.
LR1 0x8000
{
ER1 +0
{
*(+RO)
}
}
LR2 0x10000
{
ER1 +0
{
*(.plt_LR1)
}
}