mirror of
https://github.com/seL4/seL4.git
synced 2026-03-27 10:29:57 +00:00
riscv: Optimize gp-relative linker relaxation
Changes compiler options and the linker script to group most small data objects together in a new .small section, and point __global_pointer$ at .small so that nearly all objects can be referenced via gp. Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
This commit is contained in:
committed by
Kent McLeod
parent
d31f76c813
commit
89e5774292
@@ -286,7 +286,12 @@ elseif(KernelArchARM)
|
||||
endif()
|
||||
|
||||
elseif(KernelArchRiscV)
|
||||
KernelCommonFlags(-mcmodel=medany)
|
||||
# Group "small" data objects together in a small-data section so they can
|
||||
# be referenced using gp-relative addressing. The exact value of
|
||||
# small-data-limit is not crucial but it should be lowered if .small
|
||||
# exceeds 4KiB.
|
||||
#
|
||||
KernelCommonFlags(-mcmodel=medany -msmall-data-limit=1024)
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "unknown KernelArch '${KernelArch}'")
|
||||
|
||||
@@ -48,12 +48,13 @@ SECTIONS
|
||||
|
||||
/* Start of data section */
|
||||
_sdata = .;
|
||||
.sdata : {
|
||||
.small : {
|
||||
/* Small data that should be accessed relative to gp. ld has trouble
|
||||
with the relaxation if they are not in a single section. */
|
||||
__global_pointer$ = . + 0x800;
|
||||
*(.sdata*)
|
||||
}
|
||||
.srodata : {
|
||||
*(.srodata*)
|
||||
*(.sdata*)
|
||||
*(.sbss)
|
||||
}
|
||||
|
||||
.rodata . : AT(ADDR(.rodata) - KERNEL_OFFSET)
|
||||
@@ -71,7 +72,6 @@ SECTIONS
|
||||
{
|
||||
*(.bss)
|
||||
*(COMMON) /* fallback in case '-fno-common' is not used */
|
||||
*(.sbss)
|
||||
|
||||
/* 4k breakpoint stack */
|
||||
_breakpoint_stack_bottom = .;
|
||||
|
||||
Reference in New Issue
Block a user