From 3a759fb4b59efc98bb650e48d2acd4988fceee0e Mon Sep 17 00:00:00 2001 From: mortimer Date: Sun, 7 Mar 2021 23:10:54 +0000 Subject: [PATCH] Explicitly align kernel text. lld11 no longer quietly aligns this when given an address, so we do the alignment explicitly. ok kettenis@ --- sys/arch/amd64/conf/ld.script | 6 +++--- sys/arch/i386/conf/ld.script | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/arch/amd64/conf/ld.script b/sys/arch/amd64/conf/ld.script index bc7ce33756e..eb9a549536e 100644 --- a/sys/arch/amd64/conf/ld.script +++ b/sys/arch/amd64/conf/ld.script @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.script,v 1.16 2020/02/19 16:55:04 kettenis Exp $ */ +/* $OpenBSD: ld.script,v 1.17 2021/03/07 23:10:54 mortimer Exp $ */ /* * Copyright (c) 2009 Tobias Weingartner @@ -45,8 +45,8 @@ __kernel_virt_to_phys = __kernel_phys_base - __kernel_virt_base; ENTRY(start) SECTIONS { - .text (__kernel_virt_base + SIZEOF_HEADERS) : - AT (__kernel_phys_base + SIZEOF_HEADERS) + .text ALIGN(__kernel_virt_base + SIZEOF_HEADERS, __ALIGN_SIZE) : + AT (ALIGN(__kernel_phys_base + SIZEOF_HEADERS, __ALIGN_SIZE)) { start = .; locore0.o(.text) diff --git a/sys/arch/i386/conf/ld.script b/sys/arch/i386/conf/ld.script index 6afd7f3afa2..18d4a8a7ba0 100644 --- a/sys/arch/i386/conf/ld.script +++ b/sys/arch/i386/conf/ld.script @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.script,v 1.11 2019/11/09 20:07:00 guenther Exp $ */ +/* $OpenBSD: ld.script,v 1.12 2021/03/07 23:10:54 mortimer Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -46,7 +46,8 @@ SECTIONS { __kernel_text_virt = __kernel_base_virt; __kernel_text_phys = __kernel_base_phys; - .text (__kernel_text_virt) : AT (__kernel_text_phys) + .text ALIGN(__kernel_text_virt, __ALIGN_SIZE) : + AT (ALIGN(__kernel_text_phys, __ALIGN_SIZE)) { __text_start = ABSOLUTE(.) & 0xfffff000; __text_size = SIZEOF(.text); -- 2.20.1