浏览代码

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 年之前
父节点
当前提交
98f1250742
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      gnuefi/elf_riscv64_efi.lds

+ 1 - 0
gnuefi/elf_riscv64_efi.lds

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