Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools Build nbm68k-elf2aout as a host tool on m68k targets



details:   https://anonhg.NetBSD.org/src/rev/fe32f34bf476
branches:  trunk
changeset: 767347:fe32f34bf476
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jul 16 15:52:01 2011 +0000

description:
Build nbm68k-elf2aout as a host tool on m68k targets
for an ancient PROM bootloader.
Mostly taken from nbmips-elf2ecoff.

diffstat:

 tools/Makefile                             |    6 +-
 tools/m68k-elf2aout/Makefile               |   17 +
 tools/m68k-elf2aout/a.out.h                |   68 ++
 tools/m68k-elf2aout/machine/aout_machdep.h |   58 ++
 tools/m68k-elf2aout/nlist.h                |   96 +++
 tools/m68k-elf2aout/sys/aout_mids.h        |   68 ++
 tools/m68k-elf2aout/sys/exec_aout.h        |  182 ++++++
 tools/m68k-elf2aout/sys/exec_elf.h         |  805 +++++++++++++++++++++++++++++
 8 files changed, 1299 insertions(+), 1 deletions(-)

diffs (truncated from 1342 to 300 lines):

diff -r 530f240d62c2 -r fe32f34bf476 tools/Makefile
--- a/tools/Makefile    Sat Jul 16 15:45:24 2011 +0000
+++ b/tools/Makefile    Sat Jul 16 15:52:01 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.147 2011/07/10 08:43:51 mrg Exp $
+#      $NetBSD: Makefile,v 1.148 2011/07/16 15:52:01 tsutsui Exp $
 
 .include <bsd.own.mk>
 
@@ -107,6 +107,10 @@
 SUBDIR+=       powerpc-mkbootimage
 .endif
 
+.if ${MACHINE_ARCH} == "m68k"
+SUBDIR+=       m68k-elf2aout
+.endif
+
 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
 SUBDIR+=       mips-elf2ecoff
diff -r 530f240d62c2 -r fe32f34bf476 tools/m68k-elf2aout/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m68k-elf2aout/Makefile      Sat Jul 16 15:52:01 2011 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.1 2011/07/16 15:52:02 tsutsui Exp $
+
+HOSTPROGNAME=  ${_TOOL_PREFIX}m68k-elf2aout
+HOST_SRCDIR=   usr.bin/elf2aout
+HOST_CPPFLAGS= -I${.CURDIR}
+
+NOMAN= # defined
+
+.include <bsd.endian.mk>
+
+.if   ${TARGET_ENDIANNESS} == "1234"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=LITTLE_ENDIAN
+.elif ${TARGET_ENDIANNESS} == "4321"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=BIG_ENDIAN
+.endif
+
+.include "${.CURDIR}/../Makefile.host"
diff -r 530f240d62c2 -r fe32f34bf476 tools/m68k-elf2aout/a.out.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m68k-elf2aout/a.out.h       Sat Jul 16 15:52:01 2011 +0000
@@ -0,0 +1,68 @@
+/*     $NetBSD: a.out.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $        */
+
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
+ */
+
+/*-
+ * Copyright (c) 1993 Theo de Raadt.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef        _AOUT_H_
+#define        _AOUT_H_
+
+#include <sys/exec_aout.h>
+
+#define        _AOUT_INCLUDE_
+#include <nlist.h>
+
+#endif /* !_AOUT_H_ */
diff -r 530f240d62c2 -r fe32f34bf476 tools/m68k-elf2aout/machine/aout_machdep.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m68k-elf2aout/machine/aout_machdep.h        Sat Jul 16 15:52:01 2011 +0000
@@ -0,0 +1,58 @@
+/*     $NetBSD: aout_machdep.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _M68K_EXEC_H_
+#define _M68K_EXEC_H_
+
+#ifndef        AOUT_LDPGSZ
+#define AOUT_LDPGSZ    8192
+#endif
+
+/*
+ * Override the N_PAGSIZ() macro.
+ * XXX Nicer way to do this?
+ */
+#undef N_PAGSIZ
+#define        N_PAGSIZ(ex)    (N_GETMID((ex)) == MID_M68K4K ? 4096 : AOUT_LDPGSZ)
+
+/* Relocation format. */
+struct relocation_info_m68k {
+       int r_address;                  /* offset in text or data segment */
+       unsigned int r_symbolnum : 24,  /* ordinal number of add symbol */
+                        r_pcrel :  1,  /* 1 if value should be pc-relative */
+                       r_length :  2,  /* log base 2 of value's width */
+                       r_extern :  1,  /* 1 if need to add symbol to value */
+                      r_baserel :  1,  /* linkage table relative */
+                     r_jmptable :  1,  /* relocate to jump table */
+                     r_relative :  1,  /* load address relative */
+                         r_copy :  1;  /* run time copy */
+};
+#define relocation_info        relocation_info_m68k
+
+#endif  /* _M68K_EXEC_H_ */
diff -r 530f240d62c2 -r fe32f34bf476 tools/m68k-elf2aout/nlist.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m68k-elf2aout/nlist.h       Sat Jul 16 15:52:01 2011 +0000
@@ -0,0 +1,96 @@
+/*     $NetBSD: nlist.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $        */
+
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)nlist.h     8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _NLIST_H_
+#define        _NLIST_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * Symbol table entry format.  The #ifdef's are so that programs including
+ * nlist.h can initialize nlist structures statically.
+ */
+struct nlist {
+#ifdef _AOUT_INCLUDE_
+       union {
+#if 0
+               __aconst char *n_name;  /* symbol name (in memory) */
+#endif
+               int32_t n_strx;         /* file string table offset (on disk) */
+       } n_un;
+# define N_NAME(nlp)   ((nlp)->n_un.n_name)
+#else
+       const char *n_name;             /* symbol name (in memory) */
+# define N_NAME(nlp)   ((nlp)->n_name)
+#endif
+
+#define        N_UNDF  0x00            /* undefined */
+#define        N_ABS   0x02            /* absolute address */
+#define        N_TEXT  0x04            /* text segment */
+#define        N_DATA  0x06            /* data segment */
+#define        N_BSS   0x08            /* bss segment */
+#define        N_INDR  0x0a            /* alias definition */
+#define        N_SIZE  0x0c            /* pseudo type, defines a symbol's size */
+#define        N_COMM  0x12            /* common reference */
+#define N_SETA 0x14            /* absolute set element symbol */
+#define N_SETT 0x16            /* text set element symbol */
+#define N_SETD 0x18            /* data set element symbol */
+#define N_SETB 0x1a            /* bss set element symbol */
+#define N_SETV 0x1c            /* set vector symbol */
+#define        N_FN    0x1e            /* file name (N_EXT on) */
+#define        N_WARN  0x1e            /* warning message (N_EXT off) */
+
+#define        N_EXT   0x01            /* external (global) bit, OR'ed in */
+#define        N_TYPE  0x1e            /* mask for all the type bits */
+       unsigned char n_type;   /* type defines */
+
+       char n_other;           /* spare */
+#define        n_hash  n_desc          /* used internally by ld(1); XXX */
+       int16_t n_desc;         /* used by stab entries */
+       uint32_t n_value;       /* address/value of the symbol */
+};
+
+#define        N_FORMAT        "%08x"  /* namelist value format; XXX */
+#define        N_STAB          0x0e0   /* mask for debugger symbols -- stab(5) */
+
+__BEGIN_DECLS
+int nlist(const char *, struct nlist *);
+int __fdnlist(int, struct nlist *);            /* XXX for libkvm */
+__END_DECLS
+
+#endif /* !_NLIST_H_ */
diff -r 530f240d62c2 -r fe32f34bf476 tools/m68k-elf2aout/sys/aout_mids.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m68k-elf2aout/sys/aout_mids.h       Sat Jul 16 15:52:01 2011 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: aout_mids.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $ */
+
+/*
+ * Copyright (c) 2009, The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,



Home | Main Index | Thread Index | Old Index