14 changed files with 6333 additions and 2561 deletions
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,101 @@ |
|||
|
|||
VPATH = @srcdir@ @srcdir@/.. |
|||
srcdir = @srcdir@ |
|||
objdir = . |
|||
srcroot = $(srcdir)/../.. |
|||
objroot = $(objdir)/../.. |
|||
|
|||
mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs |
|||
|
|||
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) |
|||
|
|||
INSTALL = @INSTALL@ |
|||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|||
INSTALL_DATA = @INSTALL_DATA@ |
|||
|
|||
# Multilib support variables.
|
|||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
|||
MULTIDIRS = |
|||
MULTISUBDIR = |
|||
MULTIDO = true |
|||
MULTICLEAN = true |
|||
|
|||
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 = isatty.o scall.o |
|||
SCRIPTS = sim.ld |
|||
CRT0S = crt0.o |
|||
BSPS = libgloss.a |
|||
|
|||
# Host specific makefile fragment comes in here.
|
|||
@host_makefile_frag@ |
|||
|
|||
all: $(CRT0S) $(BSPS) |
|||
|
|||
libgloss.a: $(OBJS) |
|||
${AR} ${ARFLAGS} $@ $(OBJS) |
|||
${RANLIB} $@ |
|||
|
|||
#
|
|||
# Standard targets
|
|||
#
|
|||
|
|||
clean mostlyclean: |
|||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x |
|||
|
|||
distclean maintainer-clean realclean: clean |
|||
rm -f Makefile config.status *~ |
|||
|
|||
.PHONY: install info install-info clean-info |
|||
install: install-scripts # install-includes
|
|||
@for crt0 in ${CRT0S}; do\
|
|||
$(INSTALL_PROGRAM) $${crt0} $(tooldir)/lib${MULTISUBDIR}; \
|
|||
done |
|||
@for bsp in ${BSPS}; do\
|
|||
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
|
|||
done |
|||
|
|||
install-includes: |
|||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/excess; \
|
|||
for i in $(srcdir)/*.h; do \
|
|||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/excess/`basename $$i`; \
|
|||
done; |
|||
|
|||
install-scripts: |
|||
@for script in ${SCRIPTS}; do\
|
|||
$(INSTALL_DATA) ${srcdir}/$${script} $(tooldir)/lib${MULTISUBDIR}; \
|
|||
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 |
|||
@ -0,0 +1,344 @@ |
|||
# generated automatically by aclocal 1.9.6 -*- Autoconf -*- |
|||
|
|||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
|||
# 2005 Free Software Foundation, Inc. |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
|||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|||
# PARTICULAR PURPOSE. |
|||
|
|||
# AM_CONDITIONAL -*- Autoconf -*- |
|||
|
|||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 |
|||
# Free Software Foundation, Inc. |
|||
# |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
# serial 7 |
|||
|
|||
# AM_CONDITIONAL(NAME, SHELL-CONDITION) |
|||
# ------------------------------------- |
|||
# Define a conditional. |
|||
AC_DEFUN([AM_CONDITIONAL], |
|||
[AC_PREREQ(2.52)dnl |
|||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], |
|||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl |
|||
AC_SUBST([$1_TRUE]) |
|||
AC_SUBST([$1_FALSE]) |
|||
if $2; then |
|||
$1_TRUE= |
|||
$1_FALSE='#' |
|||
else |
|||
$1_TRUE='#' |
|||
$1_FALSE= |
|||
fi |
|||
AC_CONFIG_COMMANDS_PRE( |
|||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then |
|||
AC_MSG_ERROR([[conditional "$1" was never defined. |
|||
Usually this means the macro was only invoked conditionally.]]) |
|||
fi])]) |
|||
|
|||
|
|||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
|||
# Free Software Foundation, Inc. |
|||
# |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
# serial 8 |
|||
|
|||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be |
|||
# written in clear, in which case automake, when reading aclocal.m4, |
|||
# will think it sees a *use*, and therefore will trigger all it's |
|||
# C support machinery. Also note that it means that autoscan, seeing |
|||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use... |
|||
|
|||
|
|||
# _AM_DEPENDENCIES(NAME) |
|||
# ---------------------- |
|||
# See how the compiler implements dependency checking. |
|||
# NAME is "CC", "CXX", "GCJ", or "OBJC". |
|||
# We try a few techniques and use that to set a single cache variable. |
|||
# |
|||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was |
|||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular |
|||
# dependency, and given that the user is not expected to run this macro, |
|||
# just rely on AC_PROG_CC. |
|||
AC_DEFUN([_AM_DEPENDENCIES], |
|||
[AC_REQUIRE([AM_SET_DEPDIR])dnl |
|||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl |
|||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl |
|||
AC_REQUIRE([AM_DEP_TRACK])dnl |
|||
|
|||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=], |
|||
[$1], CXX, [depcc="$CXX" am_compiler_list=], |
|||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], |
|||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], |
|||
[depcc="$$1" am_compiler_list=]) |
|||
|
|||
AC_CACHE_CHECK([dependency style of $depcc], |
|||
[am_cv_$1_dependencies_compiler_type], |
|||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then |
|||
# We make a subdir and do the tests there. Otherwise we can end up |
|||
# making bogus files that we don't know about and never remove. For |
|||
# instance it was reported that on HP-UX the gcc test will end up |
|||
# making a dummy file named `D' -- because `-MD' means `put the output |
|||
# in D'. |
|||
mkdir conftest.dir |
|||
# Copy depcomp to subdir because otherwise we won't find it if we're |
|||
# using a relative directory. |
|||
cp "$am_depcomp" conftest.dir |
|||
cd conftest.dir |
|||
# We will build objects and dependencies in a subdirectory because |
|||
# it helps to detect inapplicable dependency modes. For instance |
|||
# both Tru64's cc and ICC support -MD to output dependencies as a |
|||
# side effect of compilation, but ICC will put the dependencies in |
|||
# the current directory while Tru64 will put them in the object |
|||
# directory. |
|||
mkdir sub |
|||
|
|||
am_cv_$1_dependencies_compiler_type=none |
|||
if test "$am_compiler_list" = ""; then |
|||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` |
|||
fi |
|||
for depmode in $am_compiler_list; do |
|||
# Setup a source with many dependencies, because some compilers |
|||
# like to wrap large dependency lists on column 80 (with \), and |
|||
# we should not choose a depcomp mode which is confused by this. |
|||
# |
|||
# We need to recreate these files for each test, as the compiler may |
|||
# overwrite some of them when testing with obscure command lines. |
|||
# This happens at least with the AIX C compiler. |
|||
: > sub/conftest.c |
|||
for i in 1 2 3 4 5 6; do |
|||
echo '#include "conftst'$i'.h"' >> sub/conftest.c |
|||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with |
|||
# Solaris 8's {/usr,}/bin/sh. |
|||
touch sub/conftst$i.h |
|||
done |
|||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf |
|||
|
|||
case $depmode in |
|||
nosideeffect) |
|||
# after this tag, mechanisms are not by side-effect, so they'll |
|||
# only be used when explicitly requested |
|||
if test "x$enable_dependency_tracking" = xyes; then |
|||
continue |
|||
else |
|||
break |
|||
fi |
|||
;; |
|||
none) break ;; |
|||
esac |
|||
# We check with `-c' and `-o' for the sake of the "dashmstdout" |
|||
# mode. It turns out that the SunPro C++ compiler does not properly |
|||
# handle `-M -o', and we need to detect this. |
|||
if depmode=$depmode \ |
|||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ |
|||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ |
|||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ |
|||
>/dev/null 2>conftest.err && |
|||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && |
|||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && |
|||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then |
|||
# icc doesn't choke on unknown options, it will just issue warnings |
|||
# or remarks (even with -Werror). So we grep stderr for any message |
|||
# that says an option was ignored or not supported. |
|||
# When given -MP, icc 7.0 and 7.1 complain thusly: |
|||
# icc: Command line warning: ignoring option '-M'; no argument required |
|||
# The diagnosis changed in icc 8.0: |
|||
# icc: Command line remark: option '-MP' not supported |
|||
if (grep 'ignoring option' conftest.err || |
|||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else |
|||
am_cv_$1_dependencies_compiler_type=$depmode |
|||
break |
|||
fi |
|||
fi |
|||
done |
|||
|
|||
cd .. |
|||
rm -rf conftest.dir |
|||
else |
|||
am_cv_$1_dependencies_compiler_type=none |
|||
fi |
|||
]) |
|||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) |
|||
AM_CONDITIONAL([am__fastdep$1], [ |
|||
test "x$enable_dependency_tracking" != xno \ |
|||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3]) |
|||
]) |
|||
|
|||
|
|||
# AM_SET_DEPDIR |
|||
# ------------- |
|||
# Choose a directory name for dependency files. |
|||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES |
|||
AC_DEFUN([AM_SET_DEPDIR], |
|||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl |
|||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl |
|||
]) |
|||
|
|||
|
|||
# AM_DEP_TRACK |
|||
# ------------ |
|||
AC_DEFUN([AM_DEP_TRACK], |
|||
[AC_ARG_ENABLE(dependency-tracking, |
|||
[ --disable-dependency-tracking speeds up one-time build |
|||
--enable-dependency-tracking do not reject slow dependency extractors]) |
|||
if test "x$enable_dependency_tracking" != xno; then |
|||
am_depcomp="$ac_aux_dir/depcomp" |
|||
AMDEPBACKSLASH='\' |
|||
fi |
|||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) |
|||
AC_SUBST([AMDEPBACKSLASH]) |
|||
]) |
|||
|
|||
# Generate code to set up dependency tracking. -*- Autoconf -*- |
|||
|
|||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
|||
# Free Software Foundation, Inc. |
|||
# |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
#serial 3 |
|||
|
|||
# _AM_OUTPUT_DEPENDENCY_COMMANDS |
|||
# ------------------------------ |
|||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], |
|||
[for mf in $CONFIG_FILES; do |
|||
# Strip MF so we end up with the name of the file. |
|||
mf=`echo "$mf" | sed -e 's/:.*$//'` |
|||
# Check whether this is an Automake generated Makefile or not. |
|||
# We used to match only the files named `Makefile.in', but |
|||
# some people rename them; so instead we look at the file content. |
|||
# Grep'ing the first line is not enough: some people post-process |
|||
# each Makefile.in and add a new line on top of each file to say so. |
|||
# So let's grep whole file. |
|||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then |
|||
dirpart=`AS_DIRNAME("$mf")` |
|||
else |
|||
continue |
|||
fi |
|||
# Extract the definition of DEPDIR, am__include, and am__quote |
|||
# from the Makefile without running `make'. |
|||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` |
|||
test -z "$DEPDIR" && continue |
|||
am__include=`sed -n 's/^am__include = //p' < "$mf"` |
|||
test -z "am__include" && continue |
|||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"` |
|||
# When using ansi2knr, U may be empty or an underscore; expand it |
|||
U=`sed -n 's/^U = //p' < "$mf"` |
|||
# Find all dependency output files, they are included files with |
|||
# $(DEPDIR) in their names. We invoke sed twice because it is the |
|||
# simplest approach to changing $(DEPDIR) to its actual value in the |
|||
# expansion. |
|||
for file in `sed -n " |
|||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ |
|||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do |
|||
# Make sure the directory exists. |
|||
test -f "$dirpart/$file" && continue |
|||
fdir=`AS_DIRNAME(["$file"])` |
|||
AS_MKDIR_P([$dirpart/$fdir]) |
|||
# echo "creating $dirpart/$file" |
|||
echo '# dummy' > "$dirpart/$file" |
|||
done |
|||
done |
|||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS |
|||
|
|||
|
|||
# AM_OUTPUT_DEPENDENCY_COMMANDS |
|||
# ----------------------------- |
|||
# This macro should only be invoked once -- use via AC_REQUIRE. |
|||
# |
|||
# This code is only required when automatic dependency tracking |
|||
# is enabled. FIXME. This creates each `.P' file that we will |
|||
# need in order to bootstrap the dependency handling code. |
|||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], |
|||
[AC_CONFIG_COMMANDS([depfiles], |
|||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], |
|||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) |
|||
]) |
|||
|
|||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc. |
|||
# |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
# serial 2 |
|||
|
|||
# Check whether the underlying file-system supports filenames |
|||
# with a leading dot. For instance MS-DOS doesn't. |
|||
AC_DEFUN([AM_SET_LEADING_DOT], |
|||
[rm -rf .tst 2>/dev/null |
|||
mkdir .tst 2>/dev/null |
|||
if test -d .tst; then |
|||
am__leading_dot=. |
|||
else |
|||
am__leading_dot=_ |
|||
fi |
|||
rmdir .tst 2>/dev/null |
|||
AC_SUBST([am__leading_dot])]) |
|||
|
|||
# Check to see how 'make' treats includes. -*- Autoconf -*- |
|||
|
|||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. |
|||
# |
|||
# This file is free software; the Free Software Foundation |
|||
# gives unlimited permission to copy and/or distribute it, |
|||
# with or without modifications, as long as this notice is preserved. |
|||
|
|||
# serial 3 |
|||
|
|||
# AM_MAKE_INCLUDE() |
|||
# ----------------- |
|||
# Check to see how make treats includes. |
|||
AC_DEFUN([AM_MAKE_INCLUDE], |
|||
[am_make=${MAKE-make} |
|||
cat > confinc << 'END' |
|||
am__doit: |
|||
@echo done |
|||
.PHONY: am__doit |
|||
END |
|||
# If we don't find an include directive, just comment out the code. |
|||
AC_MSG_CHECKING([for style of include used by $am_make]) |
|||
am__include="#" |
|||
am__quote= |
|||
_am_result=none |
|||
# First try GNU make style include. |
|||
echo "include confinc" > confmf |
|||
# We grep out `Entering directory' and `Leaving directory' |
|||
# messages which can occur if `w' ends up in MAKEFLAGS. |
|||
# In particular we don't look at `^make:' because GNU make might |
|||
# be invoked under some other name (usually "gmake"), in which |
|||
# case it prints its new name instead of `make'. |
|||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then |
|||
am__include=include |
|||
am__quote= |
|||
_am_result=GNU |
|||
fi |
|||
# Now try BSD make style include. |
|||
if test "$am__include" = "#"; then |
|||
echo '.include "confinc"' > confmf |
|||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then |
|||
am__include=.include |
|||
am__quote="\"" |
|||
_am_result=BSD |
|||
fi |
|||
fi |
|||
AC_SUBST([am__include]) |
|||
AC_SUBST([am__quote]) |
|||
AC_MSG_RESULT([$_am_result]) |
|||
rm -f confinc confmf |
|||
]) |
|||
|
|||
m4_include([../acinclude.m4]) |
|||
File diff suppressed because it is too large
@ -0,0 +1,55 @@ |
|||
dnl Process this file with autoconf to produce a configure script. |
|||
AC_PREREQ(2.59)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 |
|||
|
|||
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 |
|||
LIB_AM_PROG_AS |
|||
|
|||
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_CONFIG_FILES(Makefile, |
|||
. ${libgloss_topdir}/config-ml.in, |
|||
srcdir=${srcdir} |
|||
target=${target} |
|||
with_multisubdir=${with_multisubdir} |
|||
ac_configure_args="${ac_configure_args} --enable-multilib" |
|||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
|||
libgloss_topdir=${libgloss_topdir} |
|||
) |
|||
AC_OUTPUT |
|||
|
|||
@ -0,0 +1,64 @@ |
|||
/* |
|||
* Lattice Mico32 C startup code. |
|||
* Contributed by Jon Beniston <jon@beniston.com> |
|||
* |
|||
* 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 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 AUTHOR 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. |
|||
*/ |
|||
|
|||
.section .boot, "ax", @progbits |
|||
|
|||
/* Program starts here */ |
|||
|
|||
.global _start |
|||
_start: |
|||
|
|||
/* Setup stack and global pointer */ |
|||
mvhi sp, hi(_fstack) |
|||
ori sp, sp, lo(_fstack) |
|||
mvhi gp, hi(_gp) |
|||
ori gp, gp, lo(_gp) |
|||
|
|||
/* Clear BSS */ |
|||
mvhi r1, hi(_fbss) |
|||
ori r1, r1, lo(_fbss) |
|||
mvi r2, 0 |
|||
mvhi r3, hi(_ebss) |
|||
ori r3, r3, lo(_ebss) |
|||
sub r3, r3, r1 |
|||
calli memset |
|||
|
|||
/* Call C++ constructors */ |
|||
calli _init |
|||
|
|||
/* Call C++ destructors on exit */ |
|||
mvhi r1, hi(_fini) |
|||
ori r1, r1, lo(_fini) |
|||
calli atexit |
|||
|
|||
/* Call main program */ |
|||
mvi r1, 0 |
|||
mvi r2, 0 |
|||
mvi r3, 0 |
|||
calli main |
|||
|
|||
/* Call exit, which doesn't return, to perform any clean up */ |
|||
calli exit |
|||
@ -0,0 +1,43 @@ |
|||
/*
|
|||
* Lattice Mico32 implementation of isatty system call. |
|||
* Contributed by Jon Beniston <jon@beniston.com> |
|||
* |
|||
* 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 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 AUTHOR 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. |
|||
*/ |
|||
|
|||
#include "glue.h" |
|||
|
|||
/*
|
|||
* isatty -- returns 1 if connected to a terminal device, |
|||
* returns 0 if not. |
|||
* stdin, stdout and sterrr are assumed to be serial ports, |
|||
* other files are not. |
|||
*/ |
|||
int |
|||
_DEFUN (_isatty, (fd), |
|||
int fd) |
|||
{ |
|||
if ((fd == 0) || (fd == 1) || (fd == 2)) |
|||
return 1; |
|||
else |
|||
return 0; |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
/* |
|||
* Lattice Mico32 system calls. |
|||
* Contributed by Jon Beniston <jon@beniston.com> |
|||
* |
|||
* 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 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 AUTHOR 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. |
|||
*/ |
|||
|
|||
#include <syscall.h> |
|||
|
|||
/* |
|||
* System call convention (as implemented in simulator: |
|||
* - System call number in register r8 |
|||
* - Return value in r1 and r2 (only if 64-bit value) |
|||
* - errno in r3 |
|||
*/ |
|||
|
|||
.extern errno |
|||
|
|||
.global _write |
|||
_write: |
|||
mvi r8, SYS_write |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _read |
|||
_read: |
|||
mvi r8, SYS_read |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _open |
|||
_open: |
|||
mvi r8, SYS_open |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _close |
|||
_close: |
|||
mvi r8, SYS_close |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _lseek |
|||
_lseek: |
|||
mvi r8, SYS_lseek |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _fstat |
|||
_fstat: |
|||
mvi r8, SYS_fstat |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _stat |
|||
_stat: |
|||
mvi r8, SYS_stat |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _link |
|||
_link: |
|||
mvi r8, SYS_link |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _unlink |
|||
_unlink: |
|||
mvi r8, SYS_unlink |
|||
scall |
|||
mvhi r4, hi(errno) |
|||
ori r4, r4, lo(errno) |
|||
sw (r4+0), r3 |
|||
ret |
|||
|
|||
.global _exit |
|||
_exit: |
|||
/* This call doesn't return */ |
|||
mvi r8, SYS_exit |
|||
scall |
|||
@ -0,0 +1,149 @@ |
|||
/* |
|||
* Simulator Link script for Lattice Mico32. |
|||
* Contributed by Jon Beniston <jon@beniston.com> |
|||
* |
|||
* 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 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 AUTHOR 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. |
|||
*/ |
|||
|
|||
OUTPUT_FORMAT("elf32-lm32") |
|||
ENTRY(_start) |
|||
INPUT(crti.o crtbegin.o crt0.o crtend.o crtn.o) |
|||
GROUP(-lgloss -lnosys -lc -lgcc) |
|||
|
|||
MEMORY |
|||
{ |
|||
ram : ORIGIN = 0x00000000, LENGTH = 0x100000 |
|||
} |
|||
|
|||
SECTIONS |
|||
{ |
|||
|
|||
.boot : { *(.boot) } > ram |
|||
|
|||
/* Code */ |
|||
.text : |
|||
{ |
|||
. = ALIGN(4); |
|||
_ftext = .; |
|||
_ftext_rom = LOADADDR(.text); |
|||
*(.text .stub .text.* .gnu.linkonce.t.*) |
|||
*(.gnu.warning) |
|||
KEEP (*(.init)) |
|||
KEEP (*(.fini)) |
|||
/* Constructors and destructors */ |
|||
KEEP (*crtbegin*.o(.ctors)) |
|||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
|||
KEEP (*(SORT(.ctors.*))) |
|||
KEEP (*(.ctors)) |
|||
KEEP (*crtbegin*.o(.dtors)) |
|||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
|||
KEEP (*(SORT(.dtors.*))) |
|||
KEEP (*(.dtors)) |
|||
KEEP (*(.jcr)) |
|||
_etext = .; |
|||
} > ram =0 |
|||
|
|||
/* Exception handlers */ |
|||
.eh_frame_hdr : { *(.eh_frame_hdr) } > ram |
|||
.eh_frame : { KEEP (*(.eh_frame)) } > ram |
|||
.gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } > ram |
|||
|
|||
/* Read-only data */ |
|||
.rodata : |
|||
{ |
|||
. = ALIGN(4); |
|||
_frodata = .; |
|||
_frodata_rom = LOADADDR(.rodata); |
|||
*(.rodata .rodata.* .gnu.linkonce.r.*) |
|||
*(.rodata1) |
|||
_erodata = .; |
|||
} > ram |
|||
|
|||
/* Data */ |
|||
.data : |
|||
{ |
|||
. = ALIGN(4); |
|||
_fdata = .; |
|||
_fdata_rom = LOADADDR(.data); |
|||
*(.data .data.* .gnu.linkonce.d.*) |
|||
*(.data1) |
|||
SORT(CONSTRUCTORS) |
|||
_gp = ALIGN(16) + 0x7ff0; |
|||
*(.sdata .sdata.* .gnu.linkonce.s.*) |
|||
_edata = .; |
|||
} > ram |
|||
|
|||
/* BSS */ |
|||
.bss : |
|||
{ |
|||
. = ALIGN(4); |
|||
_fbss = .; |
|||
*(.dynsbss) |
|||
*(.sbss .sbss.* .gnu.linkonce.sb.*) |
|||
*(.scommon) |
|||
*(.dynbss) |
|||
*(.bss .bss.* .gnu.linkonce.b.*) |
|||
*(COMMON) |
|||
. = ALIGN(4); |
|||
_ebss = .; |
|||
_end = .; |
|||
PROVIDE (end = .); |
|||
} > ram |
|||
|
|||
/* First location in stack is highest address in RAM */ |
|||
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4); |
|||
|
|||
/* 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 .gnu.linkonce.wi.*) } |
|||
.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) } |
|||
} |
|||
Loading…
Reference in new issue