Browse Source

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>
Letu Ren 2 years ago
parent
commit
98f1250742
1 changed files with 1 additions and 0 deletions
  1. 1 0
      gnuefi/elf_riscv64_efi.lds

+ 1 - 0
gnuefi/elf_riscv64_efi.lds

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