2006-11-08 Jie Zhang <jzhang918@gmail.com>

* bfin/configure.in: New.
        * bfin/crt0.S: New.
        * bfin/Makefile.in: New.
        * bfin/syscalls.c: New.
        * bfin/aclocal.m4: Generate.
        * bfin/configure: Ditto.
        * configure.in: Add support for bfin-*-*.
        * configure: Regenerate.
        * syscall.h (SYS_argc): Define.
        (SYS_argnlen): Define.
        (SYS_argn): Define.
This commit is contained in:
Jeff Johnston 2006-11-08 19:36:56 +00:00
parent 292f8e2328
commit c0977673ac
10 changed files with 4002 additions and 0 deletions

View File

@ -1,3 +1,17 @@
2006-11-08 Jie Zhang <jzhang918@gmail.com>
* bfin/configure.in: New.
* bfin/crt0.S: New.
* bfin/Makefile.in: New.
* bfin/syscalls.c: New.
* bfin/aclocal.m4: Generate.
* bfin/configure: Ditto.
* configure.in: Add support for bfin-*-*.
* configure: Regenerate.
* syscall.h (SYS_argc): Define.
(SYS_argnlen): Define.
(SYS_argn): Define.
2006-10-10 Thiemo Seufer <ths@mips.com>
* mips/Makefile.in: Add INCLUDES to local compile rules.

102
libgloss/bfin/Makefile.in Normal file
View File

@ -0,0 +1,102 @@
#
#
DESTDIR =
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 =
CFLAGS =
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
# 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: ${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}
#
#
#
.c.S:
${CC} ${CFLAGS_FOR_TARGET} -c $<
clean mostlyclean:
rm -f a.out core *.i *.o $(SIM_BSP)
distclean maintainer-clean realclean: clean
rm -f Makefile config.status *~
.PHONY: install info install-info clean-info
install: ${SIM_INSTALL}
install-sim:
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$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

344
libgloss/bfin/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,344 @@
# generated automatically by aclocal 1.9.5 -*- 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])

3135
libgloss/bfin/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
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

72
libgloss/bfin/crt0.S Normal file
View File

@ -0,0 +1,72 @@
/*
* crt0.S for the Blackfin processor
*
* Copyright (C) 2006 Analog Devices, Inc.
*
* 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.
*/
.text
.align 2
.global __start
__start:
/* Start by setting up a stack */
link 0xc;
/* Zero the memory in the .bss section. */
p0.l = __edata;
p0.h = __edata;
p1.l = __end;
p1.h = __end;
p1 -= p0;
r0 = 0;
lsetup (L$L$clear_bss, L$L$clear_bss) lc0 = p1;
L$L$clear_bss:
B [p0++] = r0;
#ifdef __BFIN_FDPIC__
/* Set up GOT pointer. */
P0.L = __ROFIXUP_END__;
P0.H = __ROFIXUP_END__;
P4 = [P0 - 4];
#endif
/* Need to set up standard file handles */
/* Parse string at r1 */
p0.l = __init;
p0.h = __init;
P3 = P4;
call (p0)
p0.l = _atexit;
p0.h = _atexit;
#ifdef __BFIN_FDPIC__
r0 = [P4 + __fini@FUNCDESC_GOT17M4] ;
P3 = P4;
#else
r0.l = __fini;
r0.h = __fini;
#endif
call (p0)
p0.l = ___setup_argv_and_call_main;
p0.h = ___setup_argv_and_call_main;
P3 = P4;
call (p0)
p0.l = _exit;
p0.h = _exit;
P3 = P4;
jump (p0) /* Should not return. */
nop;

264
libgloss/bfin/syscalls.c Normal file
View File

@ -0,0 +1,264 @@
/*
* C library support files for the Blackfin processor
*
* Copyright (C) 2006 Analog Devices, Inc.
*
* 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.
*/
#include <_ansi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>
#include "syscall.h"
#include <errno.h>
#include <reent.h>
#include <unistd.h>
register char *stack_ptr asm ("SP");
static inline int
do_syscall (int reason, void *arg)
{
int result;
asm volatile ("[--sp] = %1; [--sp] = %2; \
r1 = [sp++]; r0 = [sp++]; \
raise 0; %0 = r0;"
: "=r" (result)
: "r" (reason), "r" (arg)
: "R0", "R1", "memory", "cc");
return result;
}
int
_read (int file, char *ptr, int len)
{
int block[3];
block[0] = file;
block[1] = (int) ptr;
block[2] = len;
return do_syscall (SYS_read, block);
}
int
_lseek (int file, int ptr, int dir)
{
int block[2];
block[0] = file;
block[1] = ptr;
return do_syscall (SYS_lseek, block);
}
int
_write (int file, char *ptr, int len)
{
int block[3];
block[0] = file;
block[1] = (int) ptr;
block[2] = len;
return do_syscall (SYS_write, block);
}
int
_open (const char *path, int flags)
{
int block[2];
block[0] = (int) path;
block[1] = flags;
return do_syscall (SYS_open, block);
}
int
_close (int file)
{
return do_syscall (SYS_close, &file);
}
void
_exit (int n)
{
do_syscall (SYS_exit, &n);
}
int
_kill (int n, int m)
{
int block[2];
block[0] = n;
block[1] = m;
return do_syscall (SYS_kill, block);
}
int
_getpid (int n)
{
return 1;
}
caddr_t
_sbrk (int incr)
{
extern char end; /* Defined by the linker. */
static char *heap_end;
char *prev_heap_end;
if (heap_end == NULL)
heap_end = &end;
prev_heap_end = heap_end;
if (heap_end + incr > stack_ptr)
{
/* Some of the libstdc++-v3 tests rely upon detecting
out of memory errors, so do not abort here. */
#if 0
extern void abort (void);
_write (1, "_sbrk: Heap and stack collision\n", 32);
abort ();
#else
errno = ENOMEM;
return (caddr_t) -1;
#endif
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}
extern void memset (struct stat *, int, unsigned int);
int
_fstat (int file, struct stat * st)
{
memset (st, 0, sizeof (* st));
st->st_mode = S_IFCHR;
st->st_blksize = 1024;
return 0;
}
int _stat (const char *fname, struct stat *st)
{
int file;
/* The best we can do is try to open the file readonly. If it exists,
then we can guess a few things about it. */
if ((file = _open (fname, O_RDONLY)) < 0)
return -1;
memset (st, 0, sizeof (* st));
st->st_mode = S_IFREG | S_IREAD;
st->st_blksize = 1024;
_close (file); /* Not interested in the error. */
return 0;
}
int
_link (void)
{
return -1;
}
int
_unlink (void)
{
return -1;
}
void
_raise (void)
{
return;
}
int
_gettimeofday (struct timeval *tv, struct timezone *tz)
{
tv->tv_usec = 0;
tv->tv_sec = do_syscall (SYS_time, 0);
return 0;
}
/* Return a clock that ticks at 100Hz. */
clock_t
_times (struct tms * tp)
{
return -1;
}
int
isatty (int fd)
{
return 1;
}
int
_system (const char *s)
{
if (s == NULL)
return 0;
errno = ENOSYS;
return -1;
}
int
_rename (const char * oldpath, const char * newpath)
{
errno = ENOSYS;
return -1;
}
static inline int
__setup_argv_for_main (int argc)
{
int block[2];
char **argv;
int i = argc;
argv = __builtin_alloca ((1 + argc) * sizeof (*argv));
argv[i] = NULL;
while (i--) {
block[0] = i;
argv[i] = __builtin_alloca (1 + do_syscall (SYS_argnlen, (void *)block));
block[1] = (int) argv[i];
do_syscall (SYS_argn, (void *)block);
}
return main (argc, argv);
}
int
__setup_argv_and_call_main ()
{
int argc = do_syscall (SYS_argc, 0);
if (argc <= 0)
return main (argc, NULL);
else
return __setup_argv_for_main (argc);
}

8
libgloss/configure vendored
View File

@ -286,6 +286,7 @@ ac_subdirs_all="$ac_subdirs_all mips"
ac_subdirs_all="$ac_subdirs_all rs6000"
ac_subdirs_all="$ac_subdirs_all mn10200"
ac_subdirs_all="$ac_subdirs_all mn10300"
ac_subdirs_all="$ac_subdirs_all bfin"
ac_subdirs_all="$ac_subdirs_all cris"
ac_subdirs_all="$ac_subdirs_all crx"
ac_subdirs_all="$ac_subdirs_all d30v"
@ -1906,6 +1907,13 @@ subdirs="$subdirs mn10200"
subdirs="$subdirs mn10300"
config_testsuite = true;
;;
bfin-*-*)
subdirs="$subdirs bfin"
config_testsuite = true;
;;
cris-*-* | crisv32-*-*)

View File

@ -77,6 +77,10 @@ case "${target}" in
AC_CONFIG_SUBDIRS(mn10300)
config_testsuite = true;
;;
bfin-*-*)
AC_CONFIG_SUBDIRS(bfin)
config_testsuite = true;
;;
cris-*-* | crisv32-*-*)
AC_CONFIG_SUBDIRS(cris)
config_testsuite = true;

View File

@ -46,4 +46,9 @@
#define SYS_gettimeofday 19
#define SYS_times 20
#define SYS_link 21
/* New ARGV support. */
#define SYS_argc 22
#define SYS_argnlen 23
#define SYS_argn 24
#endif