firmware: Support position independent execution
authorVincent Chen <vincent.chen@sifive.com>
Wed, 17 Mar 2021 01:16:38 +0000 (09:16 +0800)
committerAnup Patel <anup@brainfault.org>
Fri, 19 Mar 2021 09:30:50 +0000 (15:00 +0530)
commit0f20e8adcf42d31bc478d6700b625d00a68cb30e
treee2968cd11e015d47ce8062c0a9b4aa0e00dbc3d0
parent22d8ee9758128070aa838f7c8c46f9e50d6aaf5a
firmware: Support position independent execution

Enable OpenSBI to support position independent execution. Because the
position independent code will cause an additional GOT reference when
accessing the global variables, it will reduce performance a bit. Therefore,
the position independent execution is disabled by default. Users can
through specifying "FW_PIC=y" on the make command to enable this feature.

In theory, after enabling position-independent execution, the OpenSBI
can run at arbitrary address with appropriate alignment. Therefore, the
original relocation mechanism will be skipped. In other words, OpenSBI will
directly run at the load address without any code movement.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Makefile
firmware/fw_base.S
firmware/fw_base.ldS
firmware/objects.mk
include/sbi/riscv_elf.h [new file with mode: 0644]