Module Name: src Committed By: thorpej Date: Wed May 5 01:35:35 UTC 2021
Modified Files: src/sys/arch/alpha/conf: Makefile.alpha Added Files: src/sys/arch/alpha/conf: kern.ldscript Log Message: Add a linker script for the kernel. The main difference vs the standard built-in for "ld -N" is to actually process the .data.cacheline_aligned and .data.read_mostly sections correctly. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/alpha/conf/Makefile.alpha cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/conf/kern.ldscript Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/alpha/conf/Makefile.alpha diff -u src/sys/arch/alpha/conf/Makefile.alpha:1.85 src/sys/arch/alpha/conf/Makefile.alpha:1.86 --- src/sys/arch/alpha/conf/Makefile.alpha:1.85 Sat Sep 22 12:24:01 2018 +++ src/sys/arch/alpha/conf/Makefile.alpha Wed May 5 01:35:35 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.alpha,v 1.85 2018/09/22 12:24:01 rin Exp $ +# $NetBSD: Makefile.alpha,v 1.86 2021/05/05 01:35:35 thorpej Exp $ # Makefile for NetBSD # @@ -61,9 +61,9 @@ lock_stubs.o: assym.h ## ## (5) link settings ## -LINKFORMAT= -N TEXTADDR?= fffffc0000a00000 ENTRYPOINT= __transfer +KERNLDSCRIPT?= ${ALPHA}/conf/kern.ldscript EXTRA_LINKFLAGS= -G 4 STRIPFLAGS= -g -X Added files: Index: src/sys/arch/alpha/conf/kern.ldscript diff -u /dev/null src/sys/arch/alpha/conf/kern.ldscript:1.1 --- /dev/null Wed May 5 01:35:35 2021 +++ src/sys/arch/alpha/conf/kern.ldscript Wed May 5 01:35:35 2021 @@ -0,0 +1,86 @@ +/* $NetBSD: kern.ldscript,v 1.1 2021/05/05 01:35:35 thorpej Exp $ */ + +/* + * Linker script for the NetBSD/alpha kernel. + * + * This largely behaves the same as the standard elf64-alpha linker + * script for "ld -N"; the kernel is loaded into K0SEG, so there is + * no reason to page-align the .data segment. + */ + +#include "assym.h" /* for COHERENCY_UNIT */ + +OUTPUT_FORMAT("elf64-alpha", "elf64-alpha", + "elf64-alpha") +OUTPUT_ARCH(alpha) +SECTIONS +{ + .text : + { + *(.text) + *(.text.*) + *(.stub) + } =0x47ff041f + _etext = . ; + PROVIDE (etext = .); + + .rodata : + { + *(.rodata .rodata.*) + } + + .data : + { + *(.data) + + . = ALIGN(COHERENCY_UNIT); + *(.data.cacheline_aligned) + + . = ALIGN(COHERENCY_UNIT); + *(.data.read_mostly) + + . = ALIGN(COHERENCY_UNIT); + *(.data.*) + } + + /* + * Small-data located along side GOT and small-bss for + * GP-relative addressing. + */ + + .got : + { + *(.got) + } + + .sdata : + { + *(.sdata .sdata.*) + } + _edata = . ; + PROVIDE (edata = .) ; + + . = .; + __bss_start = .; + .sbss : + { + *(.sbss .sbss.*) + *(.scommon) + } + + .bss : + { + *(.bss .bss.*) + *(COMMON) + } + + /* End of the kernel image */ + __kernel_end = . ; + _end = . ; + PROVIDE (end = .) ; + + .note.netbsd.ident : + { + KEEP(*(.note.netbsd.ident)); + } +}