Module Name: src
Committed By: jmcneill
Date: Thu Aug 23 17:35:42 UTC 2018
Modified Files:
src/sys/lib/libsa: loadfile_elf32.c
Log Message:
Support loading read-only data sections. ARM64 ELF kernels need this. ok skrll@
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/lib/libsa/loadfile_elf32.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.52 src/sys/lib/libsa/loadfile_elf32.c:1.53
--- src/sys/lib/libsa/loadfile_elf32.c:1.52 Thu Dec 21 14:28:39 2017
+++ src/sys/lib/libsa/loadfile_elf32.c Thu Aug 23 17:35:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.52 2017/12/21 14:28:39 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.53 2018/08/23 17:35:42 jmcneill Exp $ */
/*
* Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc.
@@ -256,7 +256,7 @@ externalize_shdr(Elf_Byte bo, Elf_Shdr *
#endif /* _STANDALONE */
#define IS_TEXT(p) (p.p_flags & PF_X)
-#define IS_DATA(p) (p.p_flags & PF_W)
+#define IS_DATA(p) ((p.p_flags & PF_X) == 0)
#define IS_BSS(p) (p.p_filesz < p.p_memsz)
#ifndef MD_LOADSEG /* Allow processor ABI specific segment loads */
@@ -708,7 +708,7 @@ ELFNAMEEND(loadfile_static)(int fd, Elf_
goto loadseg;
if (phdr[i].p_type != PT_LOAD ||
- (phdr[i].p_flags & (PF_W|PF_X)) == 0)
+ (phdr[i].p_flags & (PF_W|PF_R|PF_X)) == 0)
continue;
if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||