-# $OpenBSD: Makefile.sparc,v 1.78 2013/10/15 19:23:30 guenther Exp $
+# $OpenBSD: Makefile.sparc,v 1.79 2014/01/01 07:54:15 miod Exp $
# For instructions on building kernels consult the config(8) and options(4)
# manual pages.
COPTS?= -O2
CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -N -e start -Ttext F8004000 --warn-common -nopie
+LINKFLAGS= -N -e start -T ${_machdir}/conf/ld.script --warn-common -nopie
.if ${IDENT:M-DDDB_STRUCT}
DB_STRUCTINFO= db_structinfo.h
--- /dev/null
+/* $OpenBSD: ld.script,v 1.1 2014/01/01 07:54:15 miod Exp $ */
+
+/*
+ * Copyright (c) 2013 Mark Kettenis <kettenis@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+OUTPUT_FORMAT("elf32-big")
+OUTPUT_ARCH(sparc)
+ENTRY(start)
+
+PHDRS
+{
+ text PT_LOAD;
+ data PT_LOAD;
+ openbsd_randomize 0x65a3dbe6; /* PT_OPENBSD_RANDOMIZE */
+}
+
+SECTIONS
+{
+ . = 0xF8004000;
+ .text :
+ {
+ *(.text)
+ PROVIDE(etext = ABSOLUTE(.));
+ } :text
+ .rodata :
+ {
+ *(.rodata*)
+ }
+ . = ALIGN(0x2000);
+ .data :
+ {
+ PROVIDE(__data_start = ABSOLUTE(.));
+ *(.data)
+ PROVIDE(edata = ABSOLUTE(.));
+ } :data
+ .openbsd.randomdata :
+ {
+ *(.openbsd.randomdata)
+ } :data :openbsd_randomize
+ .bss :
+ {
+ *(.bss)
+ /* . = ALIGN(64 / 8); */
+ } :data
+ PROVIDE(end = ABSOLUTE(.));
+}