From 92591120bb7797850fe14b9feea189a57881039d Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 13 Jul 2023 13:34:37 +0000 Subject: [PATCH] xen: Split segments into read/exec, read-only, and read/write. Attempts to fix: link XEN3_DOMU/netbsd /home/riastradh/netbsd/current/src/../obj.amd64/tooldir/bin/x86_64--netbsd-ld: warning: netbsd has a LOAD segment with RWX permissions This was broken in the change to fix the .note.Xen program header required by some versions of the Xen kernel, which set some explicit program headers, overriding defaults. --- sys/arch/amd64/conf/kern.ldscript.Xen | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sys/arch/amd64/conf/kern.ldscript.Xen b/sys/arch/amd64/conf/kern.ldscript.Xen index b03bd4666a2f..2babb037b9c0 100644 --- a/sys/arch/amd64/conf/kern.ldscript.Xen +++ b/sys/arch/amd64/conf/kern.ldscript.Xen @@ -13,7 +13,7 @@ SECTIONS *(.text.*) *(.stub) . = ALIGN(__PAGE_SIZE); - } :main =0xCC + } :rxmain =0xCC _etext = . ; PROVIDE (etext = .) ; @@ -26,7 +26,7 @@ SECTIONS __rodata_hotpatch_start = . ; *(.rodata.hotpatch) __rodata_hotpatch_end = . ; - } + } :romain .rodata : { @@ -36,7 +36,7 @@ SECTIONS __CTOR_LIST__ = .; *(.ctors) __CTOR_END__ = .; - } + } :romain . = ALIGN(__PAGE_SIZE); @@ -44,18 +44,18 @@ SECTIONS .data : { *(.data) - } + } :rwmain . = ALIGN(COHERENCY_UNIT); .data.cacheline_aligned : { *(.data.cacheline_aligned) - } + } :rwmain . = ALIGN(COHERENCY_UNIT); .data.read_mostly : { *(.data.read_mostly) - } + } :rwmain . = ALIGN(COHERENCY_UNIT); _edata = . ; @@ -67,7 +67,7 @@ SECTIONS *(.bss.*) *(COMMON) . = ALIGN(__PAGE_SIZE); - } + } :rwmain . = ALIGN(__PAGE_SIZE); @@ -79,7 +79,7 @@ SECTIONS .note.netbsd.ident : { KEEP(*(.note.netbsd.ident)); - } + } /* no section */ .note.Xen : { KEEP(*(.note.Xen)); @@ -88,6 +88,8 @@ SECTIONS PHDRS { - main PT_LOAD; + rxmain PT_LOAD; + romain PT_LOAD; + rwmain PT_LOAD; notes PT_NOTE; }