20000317 sourceware import
This commit is contained in:
143
libgloss/fr30/Makefile.in
Normal file
143
libgloss/fr30/Makefile.in
Normal file
@ -0,0 +1,143 @@
|
||||
#
|
||||
#
|
||||
|
||||
VPATH = @srcdir@ @srcdir@/..
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
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`
|
||||
|
||||
OBJS = putnum.o unlink.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS =
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = syscalls.o
|
||||
SIM_TEST = sim-test
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Here is all of the mon960 stuff
|
||||
MON_LDFLAGS =
|
||||
MON_BSP = libmon960.a
|
||||
MON_CRT0 = crt0.o
|
||||
MON_OBJS =
|
||||
MON_SCRIPTS = mon960.ld
|
||||
MON_TEST =
|
||||
MON_INSTALL = install-mon
|
||||
|
||||
# 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: ${MON_CRT0} ${MON_BSP}
|
||||
all: ${SIM_CRT0} ${SIM_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} ${SIM_BSP}
|
||||
|
||||
${MON_BSP}: ${OBJS} ${MON_OBJS}
|
||||
${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS}
|
||||
${RANLIB} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST}
|
||||
|
||||
sim-test: sim-test.x sim-test.dis
|
||||
|
||||
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
|
||||
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
|
||||
${SIM_CRT0} test.o \
|
||||
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
|
||||
|
||||
sim-test.dis: sim-test.x
|
||||
${OBJDUMP} -d sim-test.x > sim-test.dis
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
.c.S:
|
||||
${CC} ${CFLAGS_FOR_TARGET} -c $<
|
||||
|
||||
simulator.o: simulator.S
|
||||
sim-crt0.o: sim-crt0.S
|
||||
mvme-crt0.o: mvme-crt0.S
|
||||
mvme-exit.o: mvme-exit.S
|
||||
mvme-inbyte.o: mvme-inbyte.S
|
||||
mvme-outbyte.o: mvme-outbyte.S
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(MON_BSP)
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL}
|
||||
|
||||
install-mon:
|
||||
set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
1219
libgloss/fr30/configure
vendored
Executable file
1219
libgloss/fr30/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
75
libgloss/fr30/configure.in
Normal file
75
libgloss/fr30/configure.in
Normal file
@ -0,0 +1,75 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.s)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
|
||||
AC_CONFIG_AUX_DIR(${mdir}../../..)
|
||||
else
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../..)
|
||||
fi
|
||||
|
||||
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 probably using a cross compiler, which will not be able to fully
|
||||
# link an executable. This should really be fixed in autoconf
|
||||
# itself.
|
||||
|
||||
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
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
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)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
46
libgloss/fr30/crt0.s
Normal file
46
libgloss/fr30/crt0.s
Normal file
@ -0,0 +1,46 @@
|
||||
# FR30 startup code
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
_start:
|
||||
|
||||
;; Initialise the stack pointer
|
||||
ldi:32 __stack, r0
|
||||
mov r0, sp
|
||||
mov r0, fp
|
||||
|
||||
;; Zero the data space
|
||||
ldi:32 #_edata, r0
|
||||
ldi:32 #_end, r1
|
||||
ldi:8 #0, r2
|
||||
.L0:
|
||||
st r2, @r0
|
||||
add #4, r0
|
||||
cmp r1, r0
|
||||
blt .L0
|
||||
|
||||
;; Call global and static constructors
|
||||
ldi:32 _init, r0
|
||||
call @r0
|
||||
|
||||
;; Setup destrcutors to be called from exit.
|
||||
;; (Just in case main never returns....)
|
||||
ldi:32 atexit, r0
|
||||
ldi:32 _fini, r4
|
||||
call @r0
|
||||
|
||||
;; Initialise argc, argv and envp to empty
|
||||
ldi:8 #0, r4
|
||||
ldi:8 #0, r5
|
||||
ldi:8 #0, r6
|
||||
|
||||
;; Call main
|
||||
ldi:32 main, r0
|
||||
call @r0
|
||||
|
||||
;; Jump to exit
|
||||
ldi:32 exit, r0
|
||||
call @r0
|
||||
|
||||
;; Should never reach here
|
||||
int #9
|
162
libgloss/fr30/syscalls.c
Normal file
162
libgloss/fr30/syscalls.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* FR30 system call emulation code
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Solutions.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "../syscall.h"
|
||||
|
||||
int
|
||||
_read (file, ptr, len)
|
||||
int file;
|
||||
char * ptr;
|
||||
int len;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_lseek (file, ptr, dir)
|
||||
int file;
|
||||
int ptr;
|
||||
int dir;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_write (file, ptr, len)
|
||||
int file;
|
||||
char * ptr;
|
||||
int len;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_open (path, flags)
|
||||
const char * path;
|
||||
int flags;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_open) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_close (file)
|
||||
int file;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_close) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_exit (n)
|
||||
int n;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_exit) : "r0");
|
||||
asm ("int #10");
|
||||
}
|
||||
|
||||
|
||||
caddr_t
|
||||
_sbrk (incr)
|
||||
int incr;
|
||||
{
|
||||
extern char end asm ("_end"); /* Defined by the linker */
|
||||
extern int __stack; /* Defined by linker script. */
|
||||
static char * heap_end;
|
||||
char * prev_heap_end;
|
||||
|
||||
if (heap_end == NULL)
|
||||
heap_end = & end;
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
#if 0
|
||||
if (heap_end + incr > __stack)
|
||||
{
|
||||
_write ( 1, "_sbrk: Heap and stack collision\n", 32);
|
||||
abort ();
|
||||
}
|
||||
#endif
|
||||
heap_end += incr;
|
||||
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
||||
|
||||
int
|
||||
_fstat (file, st)
|
||||
int file;
|
||||
struct stat * st;
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_unlink ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
isatty (fd)
|
||||
int fd;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_raise ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_times ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_kill (pid, sig)
|
||||
int pid;
|
||||
int sig;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_getpid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user