PIE: Position Independant Executable support for BL31
This patch introduces Position Independant Executable(PIE) support
in TF-A. As a initial prototype, only BL31 can support PIE. A trivial
dynamic linker is implemented which supports fixing up Global Offset
Table(GOT) and Dynamic relocations(.rela.dyn). The fixup_gdt_reloc()
helper function implements this linker and this needs to be called
early in the boot sequence prior to invoking C functions. The GOT is
placed in the RO section of BL31 binary for improved security and the
BL31 linker script is modified to export the appropriate symbols
required for the dynamic linker.

The C compiler always generates PC relative addresses to linker symbols
and hence referencing symbols exporting constants are a problem when
relocating the binary. Hence the reference to the
`__PERCPU_TIMESTAMP_SIZE__` symbol in PMF is removed and is now calculated
at runtime based on start and end addresses.

Change-Id: I1228583ff92cf432963b7cef052e95d995cca93d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
1 parent 12af5ed commit 931f7c615643e5d0fb2cbab68e4093c980b0e271
@Soby Mathew Soby Mathew authored on 14 Oct 2018
Showing 5 changed files
View
bl31/aarch64/bl31_entrypoint.S
View
bl31/bl31.ld.S
View
include/common/bl_common.h
View
lib/aarch64/misc_helpers.S
View
lib/pmf/pmf_main.c