Placement of PLT sequences with the Base Platform model
The linker supports Procedure Linkage Table (PLT) generation for multiple load regions containing code when linking in Base Platform mode.
To turn on PLT generation when in Base Platform mode (--base_platform
) use
--pltgot=
. You
can use the option option
that generates PLT sequences--pltgot_opts=crosslr
to add entries in the PLT for
calls between RELOC
load-regions. PLT generation for multiple Load Regions
is only supported for --pltgot=direct
.
The --pltgot_opts=crosslr
option is useful when you have multiple load
regions that might be moved relative to each other when the image is dynamically loaded. The
linker generates a PLT for each load region so that calls do not have to be extended to
reach a distant PLT.
Placement of linker generated PLT sections:
When there is only one load region there is one PLT. The linker creates a section called
.plt
with an objectanon$$obj.o
.When there are multiple load regions, a PLT section is created for each load region that requires one. By default, the linker places the PLT section in the first execution region containing code. You can override this by specifying the exact PLT section name in the scatter file.
For example, a load region with name
the PLT section is calledLR Name
.plt_
with an object ofLR_NAME
anon$$obj.o
. To precisely name this PLT section in a scatter file, use the selector:anon$$obj.o(.plt_
LR_NAME
)
Be aware of the following:
The linker gives an error message if the PLT for load region
is moved out of load regionLR_NAME
.LR_NAME
The linker gives an error message if load region
contains a mixture ofLR_NAME
RELOC
and non-RELOC
execution regions. This is because it cannot guarantee that theRELOC
execution regions are able to reach the PLT at run-time.--pltgot=indirect
and--pltgot=sbrel
are not supported for multiple load regions.