riscv: Fix ld RWX warning

The current ld script places .dynamic section right after .text, which
results in that one LOAD segment contains both data and code. Binutils
2.39 and later will throw a warning if RWX segments exist. Code and
data should be placed in different LOAD segments with different
permissions. This patch adds a gap between data and code sections which
is taken from the default ld script in riscv64.

Co-developed-by: Moody Liu <mooodyhunter@outlook.com>
Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
Signed-off-by: Letu Ren <fantasquex@gmail.com>
This commit is contained in:
Letu Ren 2022-10-10 10:40:04 +02:00
parent 4a566dd746
commit 98f1250742
1 changed files with 1 additions and 0 deletions

View File

@ -17,6 +17,7 @@ SECTIONS {
}
_etext = .;
_text_size = . - _text;
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
.dynamic :
{ *(.dynamic) }
.data :