firmware: Move dynsym and reladyn sections to RX section

Currently, the dynsym and reladyn sections are under RW data.
They are moved to the Read-only/Executable region.

Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Himanshu Chauhan 2023-01-19 20:48:23 +05:30 committed by Anup Patel
parent fefa548803
commit 2f40a99c9e

View file

@ -30,23 +30,39 @@
/* Beginning of the read-only data sections */ /* Beginning of the read-only data sections */
PROVIDE(_rodata_start = .);
.rodata : .rodata :
{ {
PROVIDE(_rodata_start = .);
*(.rodata .rodata.*) *(.rodata .rodata.*)
. = ALIGN(8); . = ALIGN(8);
PROVIDE(_rodata_end = .);
} }
/* End of the read-only data sections */
. = ALIGN(0x1000); /* Ensure next section is page aligned */ . = ALIGN(0x1000); /* Ensure next section is page aligned */
.dynsym : {
PROVIDE(__dyn_sym_start = .);
*(.dynsym)
PROVIDE(__dyn_sym_end = .);
}
.rela.dyn : {
PROVIDE(__rel_dyn_start = .);
*(.rela*)
. = ALIGN(8);
PROVIDE(__rel_dyn_end = .);
}
PROVIDE(_rodata_end = .);
/* End of the read-only data sections */
/* /*
* PMP regions must be to be power-of-2. RO/RW will have separate * PMP regions must be to be power-of-2. RX/RW will have separate
* regions, so ensure that the split is power-of-2. * regions, so ensure that the split is power-of-2.
*/ */
. = ALIGN(1 << LOG2CEIL(SIZEOF(.rodata) + SIZEOF(.text))); . = ALIGN(1 << LOG2CEIL((SIZEOF(.rodata) + SIZEOF(.text)
+ SIZEOF(.dynsym) + SIZEOF(.rela.dyn))));
PROVIDE(_fw_rw_offset = (. - _fw_start)); PROVIDE(_fw_rw_offset = (. - _fw_start));
@ -67,19 +83,6 @@
PROVIDE(_data_end = .); PROVIDE(_data_end = .);
} }
.dynsym : {
PROVIDE(__dyn_sym_start = .);
*(.dynsym)
PROVIDE(__dyn_sym_end = .);
}
.rela.dyn : {
PROVIDE(__rel_dyn_start = .);
*(.rela*)
. = ALIGN(8);
PROVIDE(__rel_dyn_end = .);
}
. = ALIGN(0x1000); /* Ensure next section is page aligned */ . = ALIGN(0x1000); /* Ensure next section is page aligned */
.bss : .bss :