소스 검색

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 = .;
 	_text_size = . - _text;
+. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
 .dynamic  :
 	{ *(.dynamic) }
 .data :