summaryrefslogtreecommitdiff
path: root/sys/arch/luna88k/conf
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-01-05 11:20:57 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-01-05 11:20:57 +0000
commit34fe484bd1ebda2a0a3be6925defcca214148624 (patch)
treee109e53aac9f159240d7bd2f6d81eb65a3a3bd78 /sys/arch/luna88k/conf
parent7d77ce8ae17a2d60c0c384747a1dfb8dabfca904 (diff)
Switch m88k ports to ELF.
Diffstat (limited to 'sys/arch/luna88k/conf')
-rw-r--r--sys/arch/luna88k/conf/Makefile.luna88k16
-rw-r--r--sys/arch/luna88k/conf/ld.script51
2 files changed, 62 insertions, 5 deletions
diff --git a/sys/arch/luna88k/conf/Makefile.luna88k b/sys/arch/luna88k/conf/Makefile.luna88k
index a9e22e9b0d2..2aca53f3dfe 100644
--- a/sys/arch/luna88k/conf/Makefile.luna88k
+++ b/sys/arch/luna88k/conf/Makefile.luna88k
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.luna88k,v 1.44 2011/11/08 18:41:34 matthieu Exp $
+# $OpenBSD: Makefile.luna88k,v 1.45 2013/01/05 11:20:55 miod Exp $
# For instructions on building kernels consult the config(8) and options(4)
# manual pages.
@@ -12,6 +12,7 @@
SIZE?= size
STRIP?= strip
+OBJCOPY?= objcopy
# source tree is located via $S relative to the compilation directory
.ifndef S
@@ -38,7 +39,8 @@ CMACHFLAGS+= -fno-stack-protector
COPTS?= -O2
CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
AFLAGS= -D_LOCORE -x assembler-with-cpp -traditional-cpp ${CMACHFLAGS}
-LINKFLAGS= -N -Ttext 0x20000 -e start
+LINKFLAGS= -T ${_machdir}/conf/ld.script -Ttext 0x20000 -e __start -X -N \
+ --warn-common -nopie
.if ${IDENT:M-DDDB_STRUCT}
DB_STRUCTINFO= db_structinfo.h
@@ -76,19 +78,23 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
SYSTEM_LD_HEAD= @rm -f $@
SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
+SYSTEM_LD_TAIL= @${SIZE} $@
DEBUG?=
.if ${DEBUG} == "-g"
LINKFLAGS+= -X
-STRIPFLAGS= -g
+STRIPFLAGS= -g -x
SYSTEM_LD_TAIL+=; \
echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
.else
-LINKFLAGS+= -x
+LINKFLAGS+= -S -x
.endif
+SYSTEM_LD_TAIL+=; \
+ echo ${OBJCPY} -O a.out-m88k-openbsd --impure $@; \
+ ${OBJCPY} -O a.out-m88k-openbsd --impure $@; \
+ chmod 755 $@
%LOAD
diff --git a/sys/arch/luna88k/conf/ld.script b/sys/arch/luna88k/conf/ld.script
new file mode 100644
index 00000000000..9836ad241fd
--- /dev/null
+++ b/sys/arch/luna88k/conf/ld.script
@@ -0,0 +1,51 @@
+/* $OpenBSD: ld.script,v 1.1 2013/01/05 11:20:55 miod Exp $ */
+
+/*
+ * Copyright (c) 2012 Miodrag Vallat.
+ *
+ * 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.
+ */
+
+/*
+ * This linker script is used to merge .rodata into .text and pad .text to
+ * a page size. This allows objcopy to correctly be able to convert it to
+ * an OMAGIC binary, suitable to be booted from the PROM.
+ */
+OUTPUT_FORMAT("elf32-m88k")
+OUTPUT_ARCH(m88k)
+ENTRY(__start)
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ *(.rodata*)
+ PROVIDE(etext = ABSOLUTE(.));
+ FILL(0xf4005800)
+ . = ALIGN(0x1000);
+ }
+ .data :
+ {
+ *(.data)
+ PROVIDE(edata = ABSOLUTE(.));
+ }
+ .bss :
+ {
+ *(.bss)
+ }
+ PROVIDE(end = ABSOLUTE(.));
+ /DISCARD/ :
+ {
+ *(.comment)
+ }
+}