20000317 sourceware import
This commit is contained in:
148
libgloss/mn10200/Makefile.in
Normal file
148
libgloss/mn10200/Makefile.in
Normal file
@@ -0,0 +1,148 @@
|
||||
# Copyright (c) 1998 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
# that existing copyright notices are retained in all copies and that this
|
||||
# notice is included verbatim in any distributions. No written agreement,
|
||||
# license, or royalty fee is required for any of the authorized uses.
|
||||
# Modifications to this software may be copyrighted by their authors
|
||||
# and need not follow the licensing terms described here, provided that
|
||||
# the new terms are clearly indicated on the first page of each file where
|
||||
# they apply.
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
#AS = @AS@
|
||||
AS = `if [ -f ${objroot}/../gas/as.new ] ; \
|
||||
then echo ${objroot}/../gas/as.new ; \
|
||||
else echo as ; fi`
|
||||
|
||||
AR = @AR@
|
||||
|
||||
#LD = @LD@
|
||||
LD = `if [ -f ${objroot}/../ld/ld.new ] ; \
|
||||
then echo ${objroot}/../ld/ld.new ; \
|
||||
else echo ld ; fi`
|
||||
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
CRT0 = crt0.o
|
||||
|
||||
# Generic object files common to all targets.
|
||||
GENOBJS = _exit.o access.o chmod.o close.o crt1.o \
|
||||
fstat.o getpid.o isatty.o \
|
||||
kill.o lseek.o open.o read.o \
|
||||
sbrk.o stat.o time.o trap.o unlink.o utime.o write.o
|
||||
|
||||
# Object files specific to particular targets.
|
||||
EVALOBJS = ${GENOBJS}
|
||||
|
||||
CFLAGS = -g
|
||||
|
||||
GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
|
||||
then echo -L${objroot}/../gcc ; fi`
|
||||
|
||||
SCRIPTS = eval sim
|
||||
BSP = libeval.a
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
|
||||
all: ${CRT0} test.o ${BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
|
||||
libeval.a: $(EVALOBJS)
|
||||
${AR} ${ARFLAGS} $@ $(EVALOBJS)
|
||||
${RANLIB} $@
|
||||
|
||||
|
||||
# compile a fully linked binary. The -Wl,-T*.ld is for the linker
|
||||
# script. By using -Wl, the linker script is put on the proper place
|
||||
# in the comand line for ld, and all the symbols will get fully
|
||||
# resolved.
|
||||
|
||||
test: $(CRT0) test.o
|
||||
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
|
||||
test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Teval.ld
|
||||
@echo Done...
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status a.out
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
||||
@for bsp in ${BSP}; do\
|
||||
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
|
||||
done
|
||||
@for script in ${SCRIPTS}; do\
|
||||
$(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||
done
|
||||
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
test.o: ${srcdir}/test.c
|
||||
|
||||
# these are for the BSPs
|
||||
${CRT0}: ${srcdir}/crt0.S
|
||||
|
||||
# target specific makefile fragment comes in here.
|
||||
@target_makefile_frag@
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
29
libgloss/mn10200/_exit.c
Normal file
29
libgloss/mn10200/_exit.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
static void _do_dtors()
|
||||
{
|
||||
/* The loop variable is static so that if a destructor calls exit,
|
||||
and we return here, we simply continue with the next destructor. */
|
||||
typedef void (*pfunc) ();
|
||||
extern pfunc __dtors[];
|
||||
extern pfunc __dtors_end[];
|
||||
static pfunc *p = __dtors;
|
||||
|
||||
while (p < __dtors_end)
|
||||
(*p++) ();
|
||||
}
|
||||
|
||||
|
||||
void _exit (n)
|
||||
{
|
||||
/* Destructors should be done earlier because they need to be done before the
|
||||
files are closed, but here is better than nowhere (and this balances the
|
||||
constructors done in crt1.c. */
|
||||
_do_dtors();
|
||||
|
||||
TRAP0 (SYS_exit, n, 0, 0);
|
||||
}
|
34
libgloss/mn10200/access.c
Normal file
34
libgloss/mn10200/access.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* This is file ACCESS.C */
|
||||
/*
|
||||
** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
|
||||
**
|
||||
** This file is distributed under the terms listed in the document
|
||||
** "copying.dj", available from DJ Delorie at the address above.
|
||||
** A copy of "copying.dj" should accompany this file; if not, a copy
|
||||
** should be available from where this file was obtained. This file
|
||||
** may not be distributed without a verbatim copy of "copying.dj".
|
||||
**
|
||||
** This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int access(const char *fn, int flags)
|
||||
{
|
||||
struct stat s;
|
||||
if (stat(fn, &s))
|
||||
return -1;
|
||||
if (s.st_mode & S_IFDIR)
|
||||
return 0;
|
||||
if (flags & W_OK)
|
||||
{
|
||||
if (s.st_mode & S_IWRITE)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
11
libgloss/mn10200/chmod.c
Normal file
11
libgloss/mn10200/chmod.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
chmod (const char *path, mode_t mode)
|
||||
{
|
||||
return TRAP0 (SYS_chmod, path, mode, 0);
|
||||
}
|
12
libgloss/mn10200/chown.c
Normal file
12
libgloss/mn10200/chown.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
|
||||
int
|
||||
chown (const char *path, short owner, short group)
|
||||
{
|
||||
return TRAP0 (SYS_chown, path, owner, group);
|
||||
}
|
11
libgloss/mn10200/close.c
Normal file
11
libgloss/mn10200/close.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_close (int file)
|
||||
{
|
||||
return TRAP0 (SYS_close, file, 0, 0);
|
||||
}
|
1213
libgloss/mn10200/configure
vendored
Executable file
1213
libgloss/mn10200/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
115
libgloss/mn10200/configure.in
Normal file
115
libgloss/mn10200/configure.in
Normal file
@@ -0,0 +1,115 @@
|
||||
# Copyright (c) 1995, 1996, 1997, 1998 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
# that existing copyright notices are retained in all copies and that this
|
||||
# notice is included verbatim in any distributions. No written agreement,
|
||||
# license, or royalty fee is required for any of the authorized uses.
|
||||
# Modifications to this software may be copyrighted by their authors
|
||||
# and need not follow the licensing terms described here, provided that
|
||||
# the new terms are clearly indicated on the first page of each file where
|
||||
# they apply.
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.S)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are building a library that must be included in all links, so we
|
||||
# can't link an executable until this lib is built.
|
||||
# autoconf should provide a way to do this.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
case "${target}" in
|
||||
*)
|
||||
part_specific_obj=vr4300.o
|
||||
;;
|
||||
esac
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
target_makefile_frag=${srcdir}/../config/mn10200.mt
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
target_makefile_frag_path=$target_makefile_frag
|
||||
AC_SUBST(target_makefile_frag_path)
|
||||
AC_SUBST_FILE(target_makefile_frag)
|
||||
AC_SUBST(part_specific_obj)
|
||||
|
||||
AC_OUTPUT(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
||||
|
||||
|
12
libgloss/mn10200/creat.c
Normal file
12
libgloss/mn10200/creat.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
creat (const char *path,
|
||||
int mode)
|
||||
{
|
||||
return TRAP0 (SYS_creat, path, mode, 0);
|
||||
}
|
58
libgloss/mn10200/crt0.S
Normal file
58
libgloss/mn10200/crt0.S
Normal file
@@ -0,0 +1,58 @@
|
||||
##==============================================================================
|
||||
##
|
||||
## crt0.S
|
||||
##
|
||||
## MN10200 startup code
|
||||
##
|
||||
##==============================================================================
|
||||
##
|
||||
## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions
|
||||
##
|
||||
## The authors hereby grant permission to use, copy, modify, distribute,
|
||||
## and license this software and its documentation for any purpose, provided
|
||||
## that existing copyright notices are retained in all copies and that this
|
||||
## notice is included verbatim in any distributions. No written agreement,
|
||||
## license, or royalty fee is required for any of the authorized uses.
|
||||
## Modifications to this software may be copyrighted by their authors
|
||||
## and need not follow the licensing terms described here, provided that
|
||||
## the new terms are clearly indicated on the first page of each file where
|
||||
## they apply.
|
||||
##
|
||||
|
||||
##------------------------------------------------------------------------------
|
||||
|
||||
.file "crt0.S"
|
||||
|
||||
##------------------------------------------------------------------------------
|
||||
## Startup code
|
||||
.section .text
|
||||
.global _start
|
||||
_start:
|
||||
mov _stack,a3 # Load up the stack pointer and allocate
|
||||
# our current frame.
|
||||
|
||||
mov _edata,a0 # Get the start/end of bss
|
||||
mov _end,a1
|
||||
|
||||
cmp a0,a1 # If no bss, then do nothing
|
||||
beqx .L0
|
||||
|
||||
sub d0,d0 # clear d0
|
||||
|
||||
.L1:
|
||||
movb d0,(a0) # Clear a byte and bump pointer
|
||||
add 1,a0
|
||||
cmp a0,a1
|
||||
bnex .L1
|
||||
|
||||
.L0:
|
||||
jsr ___main
|
||||
sub d0,d0
|
||||
mov d0,d1
|
||||
mov d0,(a3)
|
||||
jsr _main # Call main program
|
||||
jmp _exit # All done, no need to return or
|
||||
# deallocate our stack.
|
||||
|
||||
.section .stack
|
||||
_stack: .long 1
|
16
libgloss/mn10200/crt1.c
Normal file
16
libgloss/mn10200/crt1.c
Normal file
@@ -0,0 +1,16 @@
|
||||
void __main ()
|
||||
{
|
||||
static int initialized;
|
||||
if (! initialized)
|
||||
{
|
||||
typedef void (*pfunc) ();
|
||||
extern pfunc __ctors[];
|
||||
extern pfunc __ctors_end[];
|
||||
pfunc *p;
|
||||
|
||||
initialized = 1;
|
||||
for (p = __ctors_end; p > __ctors; )
|
||||
(*--p) ();
|
||||
|
||||
}
|
||||
}
|
157
libgloss/mn10200/eval.ld
Normal file
157
libgloss/mn10200/eval.ld
Normal file
@@ -0,0 +1,157 @@
|
||||
/* Linker script for the MN10200 Evaluation Board.
|
||||
It differs from the default linker script only in the
|
||||
addresses assigned to text and stack sections.
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-mn10200", "elf32-mn10200",
|
||||
"elf32-mn10200")
|
||||
OUTPUT_ARCH(mn10200)
|
||||
ENTRY(_start)
|
||||
GROUP(-lc -leval -lgcc)
|
||||
SEARCH_DIR(.);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
/* Start of RAM (leaving room for Cygmon data) */
|
||||
. = 0x408000;
|
||||
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.text :
|
||||
{ *(.rel.text) *(.rel.gnu.linkonce.t*) }
|
||||
.rela.text :
|
||||
{ *(.rela.text) *(.rela.gnu.linkonce.t*) }
|
||||
.rel.data :
|
||||
{ *(.rel.data) *(.rel.gnu.linkonce.d*) }
|
||||
.rela.data :
|
||||
{ *(.rela.data) *(.rela.gnu.linkonce.d*) }
|
||||
.rel.rodata :
|
||||
{ *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
|
||||
.rela.rodata :
|
||||
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) } =0
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} =0
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.fini : { *(.fini) } =0
|
||||
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(1) + (. & (1 - 1));
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.ctors :
|
||||
{
|
||||
___ctors = .;
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
*crtbegin.o(.ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
___dtors = .;
|
||||
*crtbegin.o(.dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
}
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata : { *(.sdata) }
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
.sbss : { *(.sbss) *(.scommon) }
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
|
||||
/* Top of RAM is 0x43ffff, but Cygmon uses the top 4K for its stack. */
|
||||
.stack 0x43f000 : { _stack = .; *(.stack) *(._stack) }
|
||||
|
||||
/* These must appear regardless of . */
|
||||
}
|
11
libgloss/mn10200/execv.c
Normal file
11
libgloss/mn10200/execv.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
execv (const char *path, char *const argv[])
|
||||
{
|
||||
return TRAP0 (SYS_execv, path, argv, 0);
|
||||
}
|
11
libgloss/mn10200/execve.c
Normal file
11
libgloss/mn10200/execve.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_execve (const char *path, char *const argv[], char *const envp[])
|
||||
{
|
||||
return TRAP0 (SYS_execve, path, argv, envp);
|
||||
}
|
11
libgloss/mn10200/fork.c
Normal file
11
libgloss/mn10200/fork.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_fork ()
|
||||
{
|
||||
return TRAP0 (SYS_fork, 0, 0, 0);
|
||||
}
|
14
libgloss/mn10200/fstat.c
Normal file
14
libgloss/mn10200/fstat.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_fstat (int file,
|
||||
struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
st->st_blksize = 4096;
|
||||
return 0;
|
||||
}
|
10
libgloss/mn10200/getpid.c
Normal file
10
libgloss/mn10200/getpid.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
_getpid (n)
|
||||
{
|
||||
return 1;
|
||||
}
|
12
libgloss/mn10200/gettime.c
Normal file
12
libgloss/mn10200/gettime.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
#include "sys/time.h"
|
||||
|
||||
|
||||
int
|
||||
_gettimeofday (struct timeval *tp, void *tzp)
|
||||
{
|
||||
return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
|
||||
}
|
11
libgloss/mn10200/isatty.c
Normal file
11
libgloss/mn10200/isatty.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
isatty (fd)
|
||||
int fd;
|
||||
{
|
||||
return 1;
|
||||
}
|
11
libgloss/mn10200/kill.c
Normal file
11
libgloss/mn10200/kill.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
_kill (n, m)
|
||||
{
|
||||
return TRAP0 (SYS_exit, 0xdead, 0, 0);
|
||||
}
|
||||
|
14
libgloss/mn10200/lseek.c
Normal file
14
libgloss/mn10200/lseek.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/unistd.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
off_t
|
||||
_lseek (int file,
|
||||
off_t ptr,
|
||||
int dir)
|
||||
{
|
||||
return TRAP0 (SYS_lseek, file, ptr, dir);
|
||||
}
|
12
libgloss/mn10200/open.c
Normal file
12
libgloss/mn10200/open.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_open (const char *path,
|
||||
int flags)
|
||||
{
|
||||
return TRAP0 (SYS_open, path, flags, 0);
|
||||
}
|
11
libgloss/mn10200/pipe.c
Normal file
11
libgloss/mn10200/pipe.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
pipe (int fd)
|
||||
{
|
||||
return TRAP0 (SYS_pipe, fd, 0, 0);
|
||||
}
|
12
libgloss/mn10200/read.c
Normal file
12
libgloss/mn10200/read.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
_read (int file,
|
||||
char *ptr,
|
||||
size_t len)
|
||||
{
|
||||
return TRAP0 (SYS_read, file, ptr, len);
|
||||
}
|
31
libgloss/mn10200/sbrk.c
Normal file
31
libgloss/mn10200/sbrk.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
caddr_t
|
||||
_sbrk (size_t incr)
|
||||
{
|
||||
extern char end; /* Defined by the linker */
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
#if 0
|
||||
char *sp = (char *)stack_ptr;
|
||||
#else
|
||||
char *sp = (char *)&sp;
|
||||
#endif
|
||||
|
||||
if (heap_end == 0)
|
||||
{
|
||||
heap_end = &end;
|
||||
}
|
||||
prev_heap_end = heap_end;
|
||||
heap_end += incr;
|
||||
if (heap_end > sp)
|
||||
{
|
||||
_write (1, "Heap and stack collision\n", 25);
|
||||
abort ();
|
||||
}
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
152
libgloss/mn10200/sim.ld
Normal file
152
libgloss/mn10200/sim.ld
Normal file
@@ -0,0 +1,152 @@
|
||||
/* Linker script for the MN10200 simulator. */
|
||||
|
||||
OUTPUT_FORMAT("elf32-mn10200", "elf32-mn10200",
|
||||
"elf32-mn10200")
|
||||
OUTPUT_ARCH(mn10200)
|
||||
ENTRY(_start)
|
||||
GROUP(-lc -leval -lgcc)
|
||||
SEARCH_DIR(.);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = 0x0;
|
||||
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.text :
|
||||
{ *(.rel.text) *(.rel.gnu.linkonce.t*) }
|
||||
.rela.text :
|
||||
{ *(.rela.text) *(.rela.gnu.linkonce.t*) }
|
||||
.rel.data :
|
||||
{ *(.rel.data) *(.rel.gnu.linkonce.d*) }
|
||||
.rela.data :
|
||||
{ *(.rela.data) *(.rela.gnu.linkonce.d*) }
|
||||
.rel.rodata :
|
||||
{ *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
|
||||
.rela.rodata :
|
||||
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) } =0
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} =0
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.fini : { *(.fini) } =0
|
||||
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(1) + (. & (1 - 1));
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.ctors :
|
||||
{
|
||||
___ctors = .;
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
*crtbegin.o(.ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
___dtors = .;
|
||||
*crtbegin.o(.dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
}
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata : { *(.sdata) }
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
.sbss : { *(.sbss) *(.scommon) }
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
|
||||
.stack 0x80000 : { _stack = .; *(.stack) *(._stack) }
|
||||
|
||||
/* These must appear regardless of . */
|
||||
}
|
12
libgloss/mn10200/stat.c
Normal file
12
libgloss/mn10200/stat.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_stat (const char *path, struct stat *st)
|
||||
|
||||
{
|
||||
return TRAP0 (SYS_stat, path, st, 0);
|
||||
}
|
40
libgloss/mn10200/test.c
Normal file
40
libgloss/mn10200/test.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
send_msg1 (void)
|
||||
{
|
||||
static char msg[] = "Hello World\r\n";
|
||||
write(1, msg, strlen (msg));
|
||||
}
|
||||
|
||||
static void
|
||||
send_msg2 (void)
|
||||
{
|
||||
static char msg[] = "Goodnight Irene\r\n";
|
||||
write(1, msg, strlen (msg));
|
||||
}
|
||||
|
||||
static void
|
||||
delay (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32000; i++)
|
||||
;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
send_msg1 ();
|
||||
delay ();
|
||||
send_msg2 ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
11
libgloss/mn10200/time.c
Normal file
11
libgloss/mn10200/time.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
time_t
|
||||
time (time_t *tloc)
|
||||
{
|
||||
return TRAP0 (SYS_time, tloc, 0, 0);
|
||||
}
|
12
libgloss/mn10200/times.c
Normal file
12
libgloss/mn10200/times.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
#include "sys/times.h"
|
||||
|
||||
|
||||
clock_t
|
||||
times (struct tms *buffer)
|
||||
{
|
||||
return TRAP0 (SYS_times, buffer, 0, 0);
|
||||
}
|
9
libgloss/mn10200/trap.S
Normal file
9
libgloss/mn10200/trap.S
Normal file
@@ -0,0 +1,9 @@
|
||||
.text
|
||||
.global ___trap0
|
||||
___trap0:
|
||||
syscall
|
||||
cmp 0,d0
|
||||
beq noerr
|
||||
mov d0,(_errno)
|
||||
noerr:
|
||||
rts
|
5
libgloss/mn10200/trap.h
Normal file
5
libgloss/mn10200/trap.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "syscall.h"
|
||||
|
||||
int __trap0 ();
|
||||
|
||||
#define TRAP0(f, p1, p2, p3) __trap0(f, (p1), (p2), (p3))
|
11
libgloss/mn10200/unlink.c
Normal file
11
libgloss/mn10200/unlink.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_unlink ()
|
||||
{
|
||||
return -1;
|
||||
}
|
13
libgloss/mn10200/utime.c
Normal file
13
libgloss/mn10200/utime.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
utime (path, times)
|
||||
const char *path;
|
||||
char *times;
|
||||
{
|
||||
return TRAP0 (SYS_utime, path, times, 0);
|
||||
}
|
12
libgloss/mn10200/wait.c
Normal file
12
libgloss/mn10200/wait.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_wait (statusp)
|
||||
int *statusp;
|
||||
{
|
||||
return TRAP0 (SYS_wait, 0, 0, 0);
|
||||
}
|
13
libgloss/mn10200/write.c
Normal file
13
libgloss/mn10200/write.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "trap.h"
|
||||
|
||||
|
||||
int
|
||||
_write ( int file,
|
||||
char *ptr,
|
||||
size_t len)
|
||||
{
|
||||
return TRAP0 (SYS_write, file, ptr, len);
|
||||
}
|
Reference in New Issue
Block a user