summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/powerpc64/conf/ld.script34
-rw-r--r--sys/arch/powerpc64/powerpc64/pmap.c6
2 files changed, 34 insertions, 6 deletions
diff --git a/sys/arch/powerpc64/conf/ld.script b/sys/arch/powerpc64/conf/ld.script
index 0b5bd8125d9..1103644328f 100644
--- a/sys/arch/powerpc64/conf/ld.script
+++ b/sys/arch/powerpc64/conf/ld.script
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.script,v 1.3 2020/06/06 22:36:22 kettenis Exp $ */
+/* $OpenBSD: ld.script,v 1.4 2020/07/18 13:16:32 kettenis Exp $ */
/*
* Copyright (c) 2013 Mark Kettenis <kettenis@openbsd.org>
@@ -22,6 +22,7 @@ PHDRS
{
text PT_LOAD;
dynamic PT_DYNAMIC;
+ openbsd_randomize PT_OPENBSD_RANDOMIZE;
}
SECTIONS
@@ -30,18 +31,35 @@ SECTIONS
.text :
{
*(.text)
- *(.rodata*)
} :text
PROVIDE (etext = .);
PROVIDE (_etext = .);
- .hash : { *(.hash) }
+ . = ALIGN(4096);
+ .rela.dyn : { *(.rela.dyn) }
+
+ .dynamic :
+ {
+ *(.dynamic)
+ } :dynamic :text
+
+ .rodata :
+ {
+ *(.rodata)
+ *(.data.rel.ro)
+ } :text
+
+ .openbsd.randomdata :
+ {
+ *(.openbsd.randomdata)
+ } :openbsd_randomize :text
+ PROVIDE (_erodata = .);
. = ALIGN(4096);
.data :
{
*(.data)
- }
+ } :text
. = ALIGN(4096);
.got : { *(.got) }
@@ -54,4 +72,12 @@ SECTIONS
}
PROVIDE (end = .);
PROVIDE (_end = .);
+
+ /DISCARD/ :
+ {
+ *(.dynsym)
+ *(.dynstr)
+ *(.gnu.hash)
+ *(.hash)
+ }
}
diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c
index 95624a21965..120ec3009a9 100644
--- a/sys/arch/powerpc64/powerpc64/pmap.c
+++ b/sys/arch/powerpc64/powerpc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.31 2020/07/16 09:47:16 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.32 2020/07/18 13:16:32 kettenis Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -60,7 +60,7 @@
#include <dev/ofw/fdt.h>
-extern char _start[], _etext[], _end[];
+extern char _start[], _etext[], _erodata[], _end[];
#define PMAP_HASH_LOCK_INIT() /* nothing */
#define PMAP_HASH_LOCK(s) (void)s
@@ -1393,6 +1393,8 @@ pmap_bootstrap(void)
for (pa = start; pa < end; pa += PAGE_SIZE) {
if (pa < (paddr_t)_etext)
prot = PROT_READ | PROT_EXEC;
+ else if (pa < (paddr_t)_erodata)
+ prot = PROT_READ;
else
prot = PROT_READ | PROT_WRITE;
pmap_kenter_pa(pa, pa, prot);