2007-02-08 Dave Brolley <brolley@redhat.com>

* mep: New target directory.
        * README: Add MeP.
        * configure.in: Add support for MeP.
        * configure: Regenerated.
        * mep/configure.in: New file.
        * mep/configure: Ditto.
        * mep/Makefile.in: Ditto.
        * mep/aclocal.m4: Ditto.
        * mep/crt0.S: Ditto.
        * mep/crtn.S: Ditto.
        * mep/sim-crt0.S: Ditto.
        * mep/sim-crtn.S: Ditto.
        * mep/fmax.ld: Ditto.
        * mep/gcov-io.h: Ditto.
        * mep/gmap_default.ld: Ditto.
        * mep/handlers.c: Ditto.
        * mep/h_reset.c: Ditto.
        * mep/isatty.c: Ditto.
        * mep/mep-bb.c: Ditto.
        * mep/mep-gmon.c: Ditto.
        * mep/min.ld: Ditto.
        * mep/read.c: Ditto.
        * mep/sbrk.c: Ditto.
        * mep/sdram-crt0.S: Ditto.
        * mep/sdram-crtn.S: Ditto.
        * mep/simnovec-crt0.S: Ditto.
        * mep/simple.ld: Ditto.
        * mep/simsdran-crt0.S: Ditto.
        * mep/syscalls.S: Ditto.
        * mep/write.c: Ditto.
This commit is contained in:
Jeff Johnston 2007-02-08 21:22:05 +00:00
parent aafecff6a8
commit 1d94f73114
29 changed files with 7483 additions and 0 deletions

View File

@ -1,3 +1,36 @@
2007-02-08 Dave Brolley <brolley@redhat.com>
* mep: New target directory.
* README: Add MeP.
* configure.in: Add support for MeP.
* configure: Regenerated.
* mep/configure.in: New file.
* mep/configure: Ditto.
* mep/Makefile.in: Ditto.
* mep/aclocal.m4: Ditto.
* mep/crt0.S: Ditto.
* mep/crtn.S: Ditto.
* mep/sim-crt0.S: Ditto.
* mep/sim-crtn.S: Ditto.
* mep/fmax.ld: Ditto.
* mep/gcov-io.h: Ditto.
* mep/gmap_default.ld: Ditto.
* mep/handlers.c: Ditto.
* mep/h_reset.c: Ditto.
* mep/isatty.c: Ditto.
* mep/mep-bb.c: Ditto.
* mep/mep-gmon.c: Ditto.
* mep/min.ld: Ditto.
* mep/read.c: Ditto.
* mep/sbrk.c: Ditto.
* mep/sdram-crt0.S: Ditto.
* mep/sdram-crtn.S: Ditto.
* mep/simnovec-crt0.S: Ditto.
* mep/simple.ld: Ditto.
* mep/simsdran-crt0.S: Ditto.
* mep/syscalls.S: Ditto.
* mep/write.c: Ditto.
2007-01-19 Kazunori Asayama <asayama@sm.sony.co.jp>
* spu/syscalls.c: Replace vector with __vector.

View File

@ -2,5 +2,6 @@ sparc - Fujitsu Sparclite board. Works on the ex930, ex931, ex933
hp74x - Hewlett Packard HP742 board. Also some support for the hp743.
m68hc11 - Motorola 68HC11 or 68HC12 support.
m68k - Motorola MVME135 and IDP board. For CPU32 systems.
mep - Toshiba Media Processor.
pa - WinBond and Oki boards with a PA.
mips - R3000 support. Array Tech LSI33k based RAID disk controller.

8
libgloss/configure vendored
View File

@ -293,6 +293,7 @@ ac_subdirs_all="$ac_subdirs_all d30v"
ac_subdirs_all="$ac_subdirs_all fr30"
ac_subdirs_all="$ac_subdirs_all frv"
ac_subdirs_all="$ac_subdirs_all mcore"
ac_subdirs_all="$ac_subdirs_all mep"
ac_subdirs_all="$ac_subdirs_all mt"
ac_subdirs_all="$ac_subdirs_all xstormy16"
ac_subdirs_all="$ac_subdirs_all m32c"
@ -1957,6 +1958,13 @@ subdirs="$subdirs mcore"
config_testsuite=true
;;
mep-*-*)
subdirs="$subdirs mep"
config_testsuite = true;
;;
mt-*-*)

View File

@ -104,6 +104,10 @@ case "${target}" in
AC_CONFIG_SUBDIRS(mcore)
config_testsuite=true
;;
mep-*-*)
AC_CONFIG_SUBDIRS(mep)
config_testsuite = true;
;;
mt-*-*)
AC_CONFIG_SUBDIRS(mt)
config_testsuite=true

126
libgloss/mep/Makefile.in Normal file
View File

@ -0,0 +1,126 @@
# Copyright (c) 1999, 2001, 2003 Red Hat 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.
# Makefile for libgloss/mep. We only support the simulator at the
# moment.
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)
# 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@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
AR_FLAGS = rc
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`
SCRIPTS = min.ld simple.ld fmax.ld
CRT = crt0.o sdram-crt0.o sim-crt0.o simnovec-crt0.o simsdram-crt0.o crtn.o sim-crtn.o
SIM_BSP = libsim.a
LIBNOSYS = ../libnosys/libnosys.a
SIM_OBJS = \
isatty.o \
sbrk.o \
syscalls.o \
mep-gmon.o \
mep-bb.o \
handlers.o \
h_reset.o \
read.o \
write.o
#### Host specific Makefile fragment comes in here.
@host_makefile_frag@
# Override .S.o rule to pass assembler debugging flags
.S.o:
$(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
all: $(CRT) $(SIM_BSP)
$(SIM_BSP): $(SIM_OBJS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
$(AR) $(ARFLAGS) $(LIBNOSYS) handlers.o h_reset.o
$(RANLIB) $(LIBNOSYS)
syscalls.o: $(srcdir)/syscalls.S
sbrk.o: $(srcdir)/sbrk.c
crt0.o: $(srcdir)/crt0.S $(srcdir)/sim-crt0.S
sdram-crt0.o: $(srcdir)/sdram-crt0.S $(srcdir)/sim-crt0.S
sim-crt0.o: $(srcdir)/sim-crt0.S
simsdram-crt0.o: $(srcdir)/simsdram-crt0.S $(srcdir)/sim-crt0.S
simnovec-crt0.o: $(srcdir)/simnovec-crt0.S $(srcdir)/sim-crt0.S
crtn.o: $(srcdir)/crtn.S $(srcdir)/sim-crtn.S
install: $(CRT) $(SIM_BSP)
for c in $(CRT) $(SIM_BSP); do \
$(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\
done
if test -z "$(MULTISUBDIR)"; then \
for c in $(SCRIPTS); do \
$(INSTALL_DATA) $(srcdir)/$$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\
done; \
$(INSTALL_DATA) $(srcdir)/gmap_default.ld $(tooldir)/lib/gmap_default.tmpl; \
else true; fi
clean mostlyclean:
rm -f *.o *.a
distclean maintainer-clean realclean: clean
rm -f Makefile config.cache config.log config.status
.PHONY: info dvi doc install-info clean-info
info doc dvi:
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/mep/aclocal.m4 vendored Normal file
View File

@ -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])

3111
libgloss/mep/configure vendored Executable file

File diff suppressed because it is too large Load Diff

66
libgloss/mep/configure.in Normal file
View File

@ -0,0 +1,66 @@
dnl Copyright (c) 2000-2007 Red Hat, Inc. All rights reserved.
dnl
dnl This copyrighted material is made available to anyone wishing to use,
dnl modify, copy, or redistribute it subject to the terms and conditions of
dnl the BSD License. This program is distributed in the hope that
dnl it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
dnl including the implied warranties of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE. A copy of this license is available at
dnl http://www.opensource.org/licenses. Any Red Hat trademarks that are
dnl incorporated in the source code or documentation are not subject to the
dnl BSD License and may only be used or replicated with the express permission
dnl of Red Hat, Inc.
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
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

19
libgloss/mep/crt0.S Normal file
View File

@ -0,0 +1,19 @@
# Copyright (c) 2000-2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of
# this license is available at http://www.opensource.org/licenses. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
# subject to the BSD License and may only be used or replicated with the express
# permission of Red Hat, Inc.
#
# Toshiba Media Processor startup file (crt0.S)
#
# Designed for user programs running in the 0-2Mb startup section.
#
#define NOSIM
#include "sim-crt0.S"

13
libgloss/mep/crtn.S Normal file
View File

@ -0,0 +1,13 @@
# Copyright (c) 2000-2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of
# this license is available at http://www.opensource.org/licenses. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
# subject to the BSD License and may only be used or replicated with the express
#define NOSIM
#include "sim-crtn.S"

270
libgloss/mep/fmax.ld Normal file
View File

@ -0,0 +1,270 @@
/******************************************************************************
begin-header
DO NOT EDIT. THIS FILE IS MACHINE-GENERATED
FROM THE TEMPLATE FILE gmap_default.ld.
ALL EDITS WILL BE ERASED WITH NEXT MeP-Integrator RUN.
Custom linker script for the MeP Module fmax.
end-header
*******************************************************************************/
OUTPUT_FORMAT("elf32-mep", "elf32-mep",
"elf32-mep")
OUTPUT_ARCH(mep)
ENTRY(_reset)
MEMORY
{
/* begin-memory */
VEC (r) : ORIGIN = 0x00000000, LENGTH = 0x000000b8
HWINIT (r) : ORIGIN = 0x000000b8, LENGTH = 0x00000148
ROM (r) : ORIGIN = 0x00000200, LENGTH = 0x001ffe00
RAM1 (w) : ORIGIN = 0x008000b8, LENGTH = 0x007fff48
/*VEC_WARM (w) : ORIGIN = 0x00800000, LENGTH = 0x000000b8 */
/*RAM2 (w) : ORIGIN = 0x80800000, LENGTH = 0x00800000 */
/* end-memory */
}
SECTIONS
{
/* Sections to be placed in the vec area. */
.vec : { *(.vec) } >VEC /* VEC-section */
/* Sections to be placed in the HWINIT area. */
.hwinit : { *(.hwinit) } >HWINIT /* HWINIT-section */
/* Sections to be placed in the ROM area. */
.gnu.version : { *(.gnu.version) } >ROM /* ROM-section */
.gnu.version_d : { *(.gnu.version_d) } >ROM /* ROM-section */
.gnu.version_r : { *(.gnu.version_r) } >ROM /* ROM-section */
/* Sections to be placed in the romdata.s area. */
.srodata :
{
__sdabase = . + 0x8000;
*(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*)
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.s area. */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
} >RAM1 /* DATA-section */
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
/* Assert maximum size */
__assert_tiny_size = ASSERT ((. < __sdabase) || ((. - __sdabase) <= 0x8000),
"tiny section overflow");
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.m area. */
.data :
{
__data_start = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} >RAM1 /* DATA-section */
.data1 : { *(.data1) } >RAM1 /* DATA-section */
.eh_frame : { KEEP (*(.eh_frame))} >RAM1 /* DATA-section */
.gcc_except_table : { *(.gcc_except_table) } >RAM1 /* DATA-section */
.dynamic : { *(.dynamic) } >RAM1 /* DATA-section */
.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. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >RAM1 /* DATA-section */
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >RAM1 /* DATA-section */
.jcr :
{
. = ALIGN(4);
*(.jcr)
} >RAM1 /* DATA-section */
.got :
{
*(.got.plt) *(.got)
_edata = .;
PROVIDE (edata = .);
} >RAM1 /* DATA-section */
.based :
{
__tpbase = .;
*(.based) *(.based.*) *(.gnu.linkonce.based.*)
/* Assert maximum size */
__assert_based_size = ASSERT ((. - __tpbase) <= 0x80,
"based section overflow");
} >RAM1 /* DATA-section */
.bss :
{
__bss_start = .;
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
_end = .;
PROVIDE (end = .);
} >RAM1 /* DATA-section */
/* Sections to be placed in the code.m area. */
.init :
{
KEEP (*(.init))
} >RAM1 /* CODE-section */
.plt : { *(.plt) } >RAM1 /* DATA-section */
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} >RAM1 /* CODE-section */ =0
.vtext ALIGN(8) :
{
*(.vtext)
} >RAM1 /* CODE-section */
.fini :
{
KEEP (*(.fini))
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
} >RAM1 /* CODE-section */ =0
/* Sections to be placed in the romdata.m area. */
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } >RAM1 /* DATA-section */
.rodata1 : { *(.rodata1) } >RAM1 /* DATA-section */
/* Sections to be placed in the code.l area. */
.ftext : { *(.ftext) *(.ftext.*) *(.gnu.linkonce.ft.*) } >RAM1 /* CODE-section */
.vftext ALIGN(8) :
{
*(.vftext) *(.vftext.*) *(.gnu.linkonce.vf.*)
} >RAM1 /* CODE-section */
/* Sections to be placed in the romdata.l area. */
.frodata :
{
*(.frodata) *(.frodata.*) *(.gnu.linkonce.frd.*)
__assert_near_size = ASSERT (. <= 0x1000000, "near section overflow");
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.l area. */
.far : { *(.far) *(.far.*) *(.gnu.linkonce.far.*) } >RAM1 /* DATA-section */
.farbss :
{ PROVIDE (__farbss_start = .);
*(.farbss) *(.farbss.*)
PROVIDE (__farbss_end = .);
} >RAM1 /* DATA-section */
/* END-mep-sections */
/* begin-stack-table */
__stack1 = (__stack - (0 * (__stack_size / 2)) + 15) / 16 * 16;
__stack2 = (__stack - (1 * (__stack_size / 2)) + 15) / 16 * 16;
.rostacktab :
{
/* Emit a table describing the location of the different stacks. */
. = ALIGN(4);
__stack_table = .;
LONG (__stack2);
LONG (__stack1);
LONG (__stack2);
__stack_end = .;
} >RAM1
/* end-stack-table */
/* begin-heap */
/* End of DATA is 0x008000b8 + 0x007fff48. That's where the heap will end. */
__heap_end = 0x008000b8 + 0x007fff48 - 1;
/* end-heap */
/* Default stack size is 1M. That's where the heap will start if there's
room. If there's not enough room, allocate half of the remaining space
for stack and half for heap. Align the heap on a 16 byte boundary. */
__stack_size = (__stack_end + 0x100000 <= __heap_end + 1
? 0x100000
: ((__heap_end + 1 - __stack_end) / 2));
__heap = (__stack_end + __stack_size + 15) / 16 * 16;
/* Leave 16 bytes between the stack and the heap. */
__stack = __heap - 0x10;
/* 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) }
.debug_ranges 0 : { *(.debug_ranges) }
/* 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) }
/* These must appear regardless of . */
}

137
libgloss/mep/gcov-io.h Normal file
View File

@ -0,0 +1,137 @@
/* Machine-independent I/O routines for gcov.
Copyright (c) 2000 Red Hat, Inc. All rights reserved.
This copyrighted material is made available to anyone wishing to use, modify,
copy, or redistribute it subject to the terms and conditions of the BSD
License. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY expressed or implied, including the implied
warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of
this license is available at http://www.opensource.org/licenses. Any Red Hat
trademarks that are incorporated in the source code or documentation are not
subject to the BSD License and may only be used or replicated with the
express permission of Red Hat, Inc.
*/
#ifndef GCC_GCOV_IO_H
#define GCC_GCOV_IO_H
#include <stdio.h>
#include <sys/types.h>
static int __fetch_long (long *, char *, size_t);
static int __store_long (long, char *, size_t);
static int __read_long (long *, FILE *, size_t);
static int __write_long (long, FILE *, size_t);
/* These routines only work for signed values. */
/* Store a portable representation of VALUE in DEST using BYTES*8-1 bits.
Return a non-zero value if VALUE requires more than BYTES*8-1 bits
to store. */
static int
__store_long (value, dest, bytes)
long value;
char *dest;
size_t bytes;
{
int upper_bit = (value < 0 ? 128 : 0);
size_t i;
if (value < 0)
{
long oldvalue = value;
value = -value;
if (oldvalue != -value)
return 1;
}
for(i = 0 ; i < (sizeof (value) < bytes ? sizeof (value) : bytes) ; i++) {
dest[i] = value & (i == (bytes - 1) ? 127 : 255);
value = value / 256;
}
if (value && value != -1)
return 1;
for(; i < bytes ; i++)
dest[i] = 0;
dest[bytes - 1] |= upper_bit;
return 0;
}
/* Retrieve a quantity containing BYTES*8-1 bits from SOURCE and store
the result in DEST. Returns a non-zero value if the value in SOURCE
will not fit in DEST. */
static int
__fetch_long (dest, source, bytes)
long *dest;
char *source;
size_t bytes;
{
long value = 0;
int i;
for (i = bytes - 1; (size_t) i > (sizeof (*dest) - 1); i--)
if (source[i] & ((size_t) i == (bytes - 1) ? 127 : 255 ))
return 1;
for (; i >= 0; i--)
value = value * 256 + (source[i] & ((size_t)i == (bytes - 1) ? 127 : 255));
if ((source[bytes - 1] & 128) && (value > 0))
value = - value;
*dest = value;
return 0;
}
/* Write a BYTES*8-bit quantity to FILE, portably. Returns a non-zero
value if the write fails, or if VALUE can't be stored in BYTES*8
bits.
Note that VALUE may not actually be large enough to hold BYTES*8
bits, but BYTES characters will be written anyway.
BYTES may be a maximum of 10. */
static int
__write_long (value, file, bytes)
long value;
FILE *file;
size_t bytes;
{
char c[10];
if (bytes > 10 || __store_long (value, c, bytes))
return 1;
else
return fwrite(c, 1, bytes, file) != bytes;
}
/* Read a quantity containing BYTES bytes from FILE, portably. Return
a non-zero value if the read fails or if the value will not fit
in DEST.
Note that DEST may not be large enough to hold all of the requested
data, but the function will read BYTES characters anyway.
BYTES may be a maximum of 10. */
static int
__read_long (dest, file, bytes)
long *dest;
FILE *file;
size_t bytes;
{
char c[10];
if (bytes > 10 || fread(c, 1, bytes, file) != bytes)
return 1;
else
return __fetch_long (dest, c, bytes);
}
#endif /* ! GCC_GCOV_IO_H */

View File

@ -0,0 +1,280 @@
/******************************************************************************
begin-header
Copyright (c) 2000-2007 Red Hat, Inc. All rights reserved.
This copyrighted material is made available to anyone wishing to use, modify,
copy, or redistribute it subject to the terms and conditions of the BSD
License. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY expressed or implied, including the implied
warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
of this license is available at http://www.opensource.org/licenses. Any
Red Hat trademarks that are incorporated in the source code or documentation
are not subject to the BSD License and may only be used or replicated with
the express permission of Red Hat, Inc.
Default linker script for use with the Configuration Tool for
Toshiba Media Processor.
When generating a configuration for a media module, M, the
configuration tool will copy this file into a custom linker script
M.ld, and customize the script with settings from the media
module's global map file.
end-header
*******************************************************************************/
OUTPUT_FORMAT("elf32-mep", "elf32-mep",
"elf32-mep")
OUTPUT_ARCH(mep)
ENTRY(_reset)
MEMORY
{
/* begin-memory */
VEC (r) : ORIGIN = 0x00000000, LENGTH = 0x000000b8
ROM (r) : ORIGIN = 0x000000b8, LENGTH = 0x001fff48
RAM (w) : ORIGIN = 0x00800000, LENGTH = 0x00800000
/* end-memory */
}
SECTIONS
{
/* Sections to be placed in the vec area. */
.vec : { *(.vec) } >VEC /* VEC-section */
/* Sections to be placed in the HWINIT area. */
.hwinit : { *(.hwinit) } >HWINIT /* HWINIT-section */
/* Sections to be placed in the ROM area. */
.gnu.version : { *(.gnu.version) } >ROM /* ROM-section */
.gnu.version_d : { *(.gnu.version_d) } >ROM /* ROM-section */
.gnu.version_r : { *(.gnu.version_r) } >ROM /* ROM-section */
/* Sections to be placed in the romdata.s area. */
.srodata :
{
__sdabase = . + 0x8000;
*(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*)
} >RAM /* DATA-section */
/* Sections to be placed in the data.s area. */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
} >RAM /* DATA-section */
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
/* Assert maximum size */
__assert_tiny_size = ASSERT ((. < __sdabase) || ((. - __sdabase) <= 0x8000),
"tiny section overflow");
} >RAM /* DATA-section */
/* Sections to be placed in the data.m area. */
.data :
{
__data_start = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} >RAM /* DATA-section */
.data1 : { *(.data1) } >RAM /* DATA-section */
.eh_frame : { KEEP (*(.eh_frame))} >RAM /* DATA-section */
.gcc_except_table : { *(.gcc_except_table) } >RAM /* DATA-section */
.dynamic : { *(.dynamic) } >RAM /* DATA-section */
.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. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >RAM /* DATA-section */
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >RAM /* DATA-section */
.jcr :
{
. = ALIGN(4);
*(.jcr)
} >RAM /* DATA-section */
.got :
{
*(.got.plt) *(.got)
_edata = .;
PROVIDE (edata = .);
} >RAM /* DATA-section */
.based :
{
__tpbase = .;
*(.based) *(.based.*) *(.gnu.linkonce.based.*)
/* Assert maximum size */
__assert_based_size = ASSERT ((. - __tpbase) <= 0x80,
"based section overflow");
} >RAM /* DATA-section */
.bss :
{
__bss_start = .;
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
_end = .;
PROVIDE (end = .);
} >RAM /* DATA-section */
/* Sections to be placed in the code.m area. */
.init :
{
KEEP (*(.init))
} >RAM /* CODE-section */
.plt : { *(.plt) } >RAM /* DATA-section */
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} >RAM /* CODE-section */ =0
.vtext ALIGN(8) :
{
*(.vtext)
} >RAM /* CODE-section */
.fini :
{
KEEP (*(.fini))
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
} >RAM /* CODE-section */ =0
/* Sections to be placed in the romdata.m area. */
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } >RAM /* DATA-section */
.rodata1 : { *(.rodata1) } >RAM /* DATA-section */
/* Sections to be placed in the code.l area. */
.ftext : { *(.ftext) *(.ftext.*) *(.gnu.linkonce.ft.*) } >RAM /* CODE-section */
.vftext ALIGN(8) :
{
*(.vftext) *(.vftext.*) *(.gnu.linkonce.vf.*)
} >RAM /* CODE-section */
/* Sections to be placed in the romdata.l area. */
.frodata :
{
*(.frodata) *(.frodata.*) *(.gnu.linkonce.frd.*)
__assert_near_size = ASSERT (. <= 0x1000000, "near section overflow");
} >RAM /* DATA-section */
/* Sections to be placed in the data.l area. */
.far : { *(.far) *(.far.*) *(.gnu.linkonce.far.*) } >RAM /* DATA-section */
.farbss :
{ PROVIDE (__farbss_start = .);
*(.farbss) *(.farbss.*)
PROVIDE (__farbss_end = .);
} >RAM /* DATA-section */
/* END-mep-sections */
/* begin-stack-table */
__stack0 = (__stack - (0 * (__stack_size / 1)) + 15) / 16 * 16;
.rostacktab :
{
/* Emit a table describing the location of the different stacks.
Only 1 processor in the default configuration. */
. = ALIGN(4);
__stack_table = .;
LONG (__stack0);
__stack_end = .;
} >RAM
/* end-stack-table */
/* begin-heap */
/* End of DATA is 0x00800000 + 0x00800000. That's where the heap will end. */
__heap_end = 0x00800000 + 0x00800000 - 1;
/* end-heap */
/* Default stack size is 1M. That's where the heap will start if there's
room. If there's not enough room, allocate half of the remaining space
for stack and half for heap. Align the heap on a 16 byte boundary. */
__stack_size = (__stack_end + 0x100000 <= __heap_end + 1
? 0x100000
: ((__heap_end + 1 - __stack_end) / 2));
__heap = (__stack_end + __stack_size + 15) / 16 * 16;
/* Leave 16 bytes between the stack and the heap. */
__stack = __heap - 0x10;
/* 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) }
.debug_ranges 0 : { *(.debug_ranges) }
/* 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) }
/* These must appear regardless of . */
}

26
libgloss/mep/h_reset.c Normal file
View File

@ -0,0 +1,26 @@
/* h_reset.c -- Setup default reset handler.
*
* Copyright (c) 2004 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
#pragma weak _handler_RESET
void _handler_RESET(void) __attribute__((section(".hwinit")));
extern void _start(void);
void
_handler_RESET(void)
{
mep_di();
goto *(&_start);
}

297
libgloss/mep/handlers.c Normal file
View File

@ -0,0 +1,297 @@
/* handlers.c -- Setup default handlers.
*
* Copyright (c) 2004 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
#pragma weak _handler_NMI
void __interrupt
_handler_NMI ()
{
}
#pragma weak _handler_RI
void __interrupt
_handler_RI ()
{
}
#pragma weak _handler_ZDIV
void __interrupt
_handler_ZDIV ()
{
}
#pragma weak _handler_BRK
void __interrupt
_handler_BRK ()
{
}
#pragma weak _handler_SWI
void __interrupt
_handler_SWI ()
{
}
#pragma weak _handler_DEBUG
void __interrupt
_handler_DEBUG ()
{
}
#pragma weak _handler_DSP
void __interrupt
_handler_DSP ()
{
}
#pragma weak _handler_COP
void __interrupt
_handler_COP ()
{
}
/* hardware interrupt */
#pragma weak _handler_INT0
void __interrupt
_handler_INT0 ()
{
}
#pragma weak _handler_INT1
void __interrupt
_handler_INT1 ()
{
}
#pragma weak _handler_INT2
void __interrupt
_handler_INT2 ()
{
}
#pragma weak _handler_INT3
void __interrupt
_handler_INT3 ()
{
}
#pragma weak _handler_INT4
void __interrupt
_handler_INT4 ()
{
}
#pragma weak _handler_INT5
void __interrupt
_handler_INT5 ()
{
}
#pragma weak _handler_INT6
void __interrupt
_handler_INT6 ()
{
}
#pragma weak _handler_INT7
void __interrupt
_handler_INT7 ()
{
}
#pragma weak _handler_INT8
void __interrupt
_handler_INT8 ()
{
}
#pragma weak _handler_INT9
void __interrupt
_handler_INT9 ()
{
}
#pragma weak _handler_INT10
void __interrupt
_handler_INT10 ()
{
}
#pragma weak _handler_INT11
void __interrupt
_handler_INT11 ()
{
}
#pragma weak _handler_INT12
void __interrupt
_handler_INT12 ()
{
}
#pragma weak _handler_INT13
void __interrupt
_handler_INT13 ()
{
}
#pragma weak _handler_INT14
void __interrupt
_handler_INT14 ()
{
}
#pragma weak _handler_INT15
void __interrupt
_handler_INT15 ()
{
}
#pragma weak _handler_INT16
void __interrupt
_handler_INT16 ()
{
}
#pragma weak _handler_INT17
void __interrupt
_handler_INT17 ()
{
}
#pragma weak _handler_INT18
void __interrupt
_handler_INT18 ()
{
}
#pragma weak _handler_INT19
void __interrupt
_handler_INT19 ()
{
}
#pragma weak _handler_INT20
void __interrupt
_handler_INT20 ()
{
}
#pragma weak _handler_INT21
void __interrupt
_handler_INT21 ()
{
}
#pragma weak _handler_INT22
void __interrupt
_handler_INT22 ()
{
}
#pragma weak _handler_INT23
void __interrupt
_handler_INT23 ()
{
}
#pragma weak _handler_INT24
void __interrupt
_handler_INT24 ()
{
}
#pragma weak _handler_INT25
void __interrupt
_handler_INT25 ()
{
}
#pragma weak _handler_INT26
void __interrupt
_handler_INT26 ()
{
}
#pragma weak _handler_INT27
void __interrupt
_handler_INT27 ()
{
}
#pragma weak _handler_INT28
void __interrupt
_handler_INT28 ()
{
}
#pragma weak _handler_INT29
void __interrupt
_handler_INT29 ()
{
}
#pragma weak _handler_INT30
void __interrupt
_handler_INT30 ()
{
}
#pragma weak _handler_INT31
void __interrupt
_handler_INT31 ()
{
}

19
libgloss/mep/isatty.c Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2004 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
isatty (fd)
int fd;
{
return 1;
}

1071
libgloss/mep/mep-bb.c Normal file

File diff suppressed because it is too large Load Diff

411
libgloss/mep/mep-gmon.c Normal file
View File

@ -0,0 +1,411 @@
/*-
* Copyright (c) 1991, 1998, 2001 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
#endif /* not lint */
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define GMON_PTR_SIZE 4
struct phdr
{
char *lpc; /* base pc address of sample buffer */
char *hpc; /* max pc address of sampled buffer */
int ncnt; /* size of sample buffer (plus this header) */
char version[4]; /* version number */
char profrate[4]; /* profiling clock rate */
char spare[3*4]; /* reserved */
};
#define GMONVERSION 0x00051879
/*
* Histogram counters are unsigned shorts:
*/
#define HISTCOUNTER unsigned short
/*
* Fraction of text space to allocate for histogram counters here, 1/2:
*/
#define HISTFRACTION 2
/*
* Fraction of text space to allocate for from hash buckets. The
* value of HASHFRACTION is based on the minimum number of bytes of
* separation between two subroutine call points in the object code.
* Given MIN_SUBR_SEPARATION bytes of separation the value of
* HASHFRACTION is calculated as:
*
* HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
*
* For the VAX, the shortest two call sequence is:
*
* calls $0,(r0)
* calls $0,(r0)
*
* which is separated by only three bytes, thus HASHFRACTION is
* calculated as:
*
* HASHFRACTION = 3 / (2 * 2 - 1) = 1
*
* Note that the division above rounds down, thus if MIN_SUBR_FRACTION
* is less than three, this algorithm will not work!
*/
#define HASHFRACTION 1
/*
* Percent of text space to allocate for tostructs with a minimum:
*/
#define ARCDENSITY 2
#define MINARCS 50
struct tostruct
{
char *selfpc;
int count;
unsigned short link;
};
/*
* A raw arc, with pointers to the calling site and the called site
* and a count. Everything is defined in terms of characters so
* as to get a packed representation (otherwise, different compilers
* might introduce different padding):
*/
struct rawarc
{
unsigned long raw_frompc;
unsigned long raw_selfpc;
int raw_count;
};
/*
* General rounding functions:
*/
#define ROUNDDOWN(x,y) (((x)/(y))*(y))
#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
#ifdef __alpha
extern char *sbrk ();
#endif
/*
* froms is actually a bunch of unsigned shorts indexing tos
*/
static int profiling = 3;
static unsigned short *froms;
static struct tostruct *tos = 0;
static long tolimit = 0;
static char *s_lowpc = 0;
static char *s_highpc = 0;
static unsigned long s_textsize = 0;
static int ssiz;
static char *sbuf;
static int s_scale;
/* see profil(2) where this is describe (incorrectly) */
#define SCALE_1_TO_1 0x10000L
#define MSG "No space for profiling buffer(s)\n"
#ifndef O_BINARY
#define O_BINARY 0
#endif
static void
moncleanup ()
{
int fd;
int fromindex;
int endfrom;
char *frompc;
int toindex;
struct rawarc rawarc;
profiling = 1;
fd = open ("gmon.out", O_WRONLY|O_TRUNC|O_CREAT|O_BINARY, 0666);
if (fd < 0)
{
perror ("mcount: gmon.out");
return;
}
#ifdef DEBUG
fprintf (stderr, "[mcleanup] sbuf 0x%x ssiz %d\n", sbuf, ssiz);
#endif /* DEBUG */
write (fd, sbuf, ssiz);
endfrom = s_textsize / (HASHFRACTION * sizeof (*froms));
for (fromindex = 0; fromindex < endfrom; fromindex++)
{
if (froms[fromindex] == 0)
{
continue;
}
frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof (*froms));
for (toindex = froms[fromindex]; toindex != 0;
toindex = tos[toindex].link)
{
#ifdef DEBUG
fprintf (stderr,
"[mcleanup] frompc 0x%x selfpc 0x%x count %d\n",
frompc, tos[toindex].selfpc, tos[toindex].count);
#endif /* DEBUG */
rawarc.raw_frompc = (unsigned long) frompc;
rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
rawarc.raw_count = tos[toindex].count;
write (fd, &rawarc, sizeof rawarc);
}
}
close (fd);
}
static void
monstartup (lowpc, highpc)
char *lowpc;
char *highpc;
{
int monsize;
char *buffer;
register int o;
atexit (moncleanup);
/*
* round lowpc and highpc to multiples of the density we're using
* so the rest of the scaling (here and in gprof) stays in ints.
*/
lowpc = (char *)
ROUNDDOWN ((unsigned) lowpc, HISTFRACTION * sizeof (HISTCOUNTER));
s_lowpc = lowpc;
highpc = (char *)
ROUNDUP ((unsigned) highpc, HISTFRACTION * sizeof (HISTCOUNTER));
s_highpc = highpc;
s_textsize = highpc - lowpc;
monsize = (s_textsize / HISTFRACTION) + sizeof (struct phdr);
buffer = sbrk (monsize);
if (buffer == (char *) -1)
{
write (2, MSG, sizeof (MSG));
return;
}
froms = (unsigned short *) sbrk (s_textsize / HASHFRACTION);
if (froms == (unsigned short *) -1)
{
write (2, MSG, sizeof (MSG));
froms = 0;
return;
}
tolimit = s_textsize * ARCDENSITY / 100;
if (tolimit < MINARCS)
{
tolimit = MINARCS;
}
else if (tolimit > 65534)
{
tolimit = 65534;
}
tos = (struct tostruct *) sbrk (tolimit * sizeof (struct tostruct));
if (tos == (struct tostruct *) -1)
{
write (2, MSG, sizeof (MSG));
froms = 0;
tos = 0;
return;
}
tos[0].link = 0;
sbuf = buffer;
ssiz = monsize;
((struct phdr *) buffer)->lpc = lowpc;
((struct phdr *) buffer)->hpc = highpc;
((struct phdr *) buffer)->ncnt = ssiz;
monsize -= sizeof (struct phdr);
if (monsize <= 0)
return;
o = highpc - lowpc;
if (monsize < o)
#if 0
s_scale = ((float) monsize / o) * SCALE_1_TO_1;
#else /* avoid floating point */
{
int quot = o / monsize;
if (quot >= 0x10000)
s_scale = 1;
else if (quot >= 0x100)
s_scale = 0x10000 / quot;
else if (o >= 0x800000)
s_scale = 0x1000000 / (o / (monsize >> 8));
else
s_scale = 0x1000000 / ((o << 8) / monsize);
}
#endif
else
s_scale = SCALE_1_TO_1;
profiling = 0;
}
/* These happen to be in the right place because of how crt0 works */
extern char __attribute__((far)) _start;
extern char __attribute__((far)) _etext;
void
__mep_mcount_2 (selfpc, frompcindex)
char *selfpc;
unsigned short *frompcindex;
{
struct tostruct *top;
struct tostruct *prevtop;
long toindex;
static int initialized = 0;
if (!initialized)
{
initialized = 1;
monstartup (&_start, &_etext);
}
/*
* check that we are profiling
* and that we aren't recursively invoked.
*/
if (profiling)
{
goto out;
}
profiling++;
/*
* check that frompcindex is a reasonable pc value.
* for example: signal catchers get called from the stack,
* not from text space. too bad.
*/
frompcindex = (unsigned short *) ((long) frompcindex - (long) s_lowpc);
if ((unsigned long) frompcindex > s_textsize)
{
goto done;
}
frompcindex =
&froms[((long) frompcindex) / (HASHFRACTION * sizeof (*froms))];
toindex = *frompcindex;
if (toindex == 0)
{
/*
* first time traversing this arc
*/
toindex = ++tos[0].link;
if (toindex >= tolimit)
{
goto overflow;
}
*frompcindex = toindex;
top = &tos[toindex];
top->selfpc = selfpc;
top->count = 1;
top->link = 0;
goto done;
}
top = &tos[toindex];
if (top->selfpc == selfpc)
{
/*
* arc at front of chain; usual case.
*/
top->count++;
goto done;
}
/*
* have to go looking down chain for it.
* top points to what we are looking at,
* prevtop points to previous top.
* we know it is not at the head of the chain.
*/
for (; /* goto done */ ;)
{
if (top->link == 0)
{
/*
* top is end of the chain and none of the chain
* had top->selfpc == selfpc.
* so we allocate a new tostruct
* and link it to the head of the chain.
*/
toindex = ++tos[0].link;
if (toindex >= tolimit)
{
goto overflow;
}
top = &tos[toindex];
top->selfpc = selfpc;
top->count = 1;
top->link = *frompcindex;
*frompcindex = toindex;
goto done;
}
/*
* otherwise, check the next arc on the chain.
*/
prevtop = top;
top = &tos[top->link];
if (top->selfpc == selfpc)
{
/*
* there it is.
* increment its count
* move it to the head of the chain.
*/
top->count++;
toindex = prevtop->link;
prevtop->link = top->link;
top->link = *frompcindex;
*frompcindex = toindex;
goto done;
}
}
done:
profiling--;
/* and fall through */
out:
return; /* normal return restores saved registers */
overflow:
profiling++; /* halt further profiling */
# define TOLIMIT "mcount: tos overflow\n"
write (2, TOLIMIT, sizeof (TOLIMIT));
goto out;
}

196
libgloss/mep/min.ld Normal file
View File

@ -0,0 +1,196 @@
/*
* Copyright (c) 2000 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
OUTPUT_FORMAT("elf32-mep", "elf32-mep",
"elf32-mep")
OUTPUT_ARCH(mep)
ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0x0080000;
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.init :
{
KEEP (*(.init))
} =0
.plt : { *(.plt) }
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
*(.ftext) *(.ftext.*) *(.gnu.linkonce.ft.*)
. = ALIGN(8);
*(.vftext) *(.vftext.*) *(.gnu.linkonce.vf.*)
*(.frodata) *(.frodata.*) *(.gnu.linkonce.frd.*)
} =0
.fini :
{
KEEP (*(.fini))
} =0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
__stack_size = 0x100000;
__stack0 = (__stack - (0 * (__stack_size / 1)) + 15) / 16 * 16;
.rostacktab :
{
/* Emit a table describing the location of the different stacks.
Only 1 processor in the default configuration. */
. = ALIGN(4);
__stack_table = .;
LONG (__stack0);
}
.sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
.sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
/* 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(256) + (. & (256 - 1));
.data :
{
__data_start = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
.eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table) }
. = ALIGN(4);
__tpbase = .;
.based : { *(.based) *(.based.*) *(.gnu.linkonce.based.*) }
.far : { *(.far) *(.far.*) *(.gnu.linkonce.far.*) }
.dynamic : { *(.dynamic) }
.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. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
. = ALIGN(4);
__sdabase = . + 0x8000;
.got : { *(.got.plt) *(.got) }
/* 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. */
.srodata : { *(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*) }
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
}
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
}
.bss :
{
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
}
.farbss : { PROVIDE (__farbss_start = .); *(.farbss) *(.farbss.*) PROVIDE (__farbss_end = .); }
. = ALIGN(32 / 8);
_end = .;
PROVIDE (end = .);
__stack = 0x00effff0;
PROVIDE (__heap = 0x00f00000);
/* 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) }
.debug_ranges 0 : { *(.debug_ranges) }
/* 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) }
/* These must appear regardless of . */
}

36
libgloss/mep/read.c Normal file
View File

@ -0,0 +1,36 @@
/* read.c -- read characters from file, with hook.
*
* Copyright (c) 2003 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
extern int __mep_read(int, unsigned char *, int);
extern int _ioIn(void) __attribute__((weak));
int
read(int fd, unsigned char *buf, int count)
{
if (fd == 0 && &_ioIn)
{
int c = 0;
while (c < count)
{
int ch = _ioIn();
*buf++ = ch;
if (ch == -1)
break;
c ++;
}
return c;
}
return __mep_read(fd, buf, count);
}

59
libgloss/mep/sbrk.c Normal file
View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2003 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
#include <errno.h>
extern int __heap __far; /* beginning of heap */
extern int __heap_end __far; /* if at address 0, use stack pointer as limit */
static char *the_break = (char *)(& __heap);
int
is_addr_0 (int address)
{
return address ? 0 : 1;
}
void *
sbrk(int inc)
{
char *current_heap_limit = (char *) (& __heap_end);
/* is_addr_0 avoids optimizing out this block. */
if (is_addr_0 ((int) current_heap_limit))
{
int something;
int margin = 4096;
current_heap_limit = (char *) (& something) - margin;
}
if ((the_break + inc) < current_heap_limit)
{
void *rv = (void *) the_break;
the_break += inc;
return rv;
}
else
{
errno = ENOMEM;
return (void *) -1;
}
}
int
brk (void *ptr)
{
the_break = ptr;
return 0;
}

21
libgloss/mep/sdram-crt0.S Normal file
View File

@ -0,0 +1,21 @@
# Copyright (c) 2003 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
# of this license is available at http://www.opensource.org/licenses. Any
# Red Hat trademarks that are incorporated in the source code or documentation
# are not subject to the BSD License and may only be used or replicated with
# the express permission of Red Hat, Inc.
#
# Toshiba Media Processor startup file (crt0.S)
#
# Designed for user programs running in the 0-2Mb startup section
# which put interrupt/exception vectors in sdram.
#
#define NOSIM
#define UseSDRAM
#include "sim-crt0.S"

496
libgloss/mep/sim-crt0.S Normal file
View File

@ -0,0 +1,496 @@
# Copyright (c) 2003 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of
# this license is available at http://www.opensource.org/licenses. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
# subject to the BSD License and may only be used or replicated with the express
# permission of Red Hat, Inc.
#
# Toshiba Media Processor startup file (crt0.S)
#
# Designed for user programs running in the 0-2Mb startup section.
# Designed for the simulator by default.
#
# Exception/Interrupt Handler Locations
# CFG.EVM CFG.EVA CFG.IVA Exception INTn
## 0 - - 0x0000_0000 0x0000_0030 rom
## 1 0 0 0x0020_0000 0x0020_0030 local RAM / local RAM
## 1 1 0 0x0080_0000 0x0020_0000 ext RAM / local RAM
## 1 0 1 0x0020_0000 0x0080_0000 local RAM / ext RAM
## 1 1 1 0x0080_0000 0x0080_0030 ext RAM / ext RAM
#
# Exceptions
# Reset 0x0000_0000
# NMI 0x0000_0000+4
# RI (Base Address) +0x08
# ZDIV (Base Address) +0x0C
# BRK (Base Address) +0x10
# SWI (Base Address) +0x14
# DSP (Base Address) +0x1C
# COP (Base Address) +0x20
.set _local_ram_base, 0x00200000
.set _ext_ram_base, 0x00800000
.set _int_base_offset, 0x30
#include "syscall.h"
.macro if_bitfield_zero reg, start, length, label
ldc $0, \reg
srl $0, \start
and3 $0, $0, (1 << \length) - 1
beqz $0,\label
.endm
.macro if_bitfield_notN reg, start, length, N, label
ldc $0, \reg
srl $0, \start
and3 $0, $0, (1 << \length) - 1
bnei $0,\N, \label
.endm
.macro if_bitfield_eqN reg, start, length, N, label
ldc $0, \reg
srl $0, \start
and3 $0, $0, (1 << \length) - 1
beqi $0,\N, \label
.endm
.macro if_bitfield_ltN reg, start, length, N, label
ldc $0, \reg
srl $0, \start
and3 $0, $0, (1 << \length) - 1
blti $0,\N, \label
.endm
.section .hwinit, "ax"
# CCFG.ICSZ
if_bitfield_zero reg=$ccfg, start=16, length=7, label=.Lend_enable_icache
__enable_icache:
# set ICE(cfg[1])
ldc $1,$cfg
or3 $1,$1,2
stc $1,$cfg
nop
nop
nop
nop
nop
.Lend_enable_icache:
ret
__enable_dcache:
# CCFG.DCSZ
if_bitfield_zero reg=$ccfg, start=0, length=7, label=.Lend_enable_dcache
# set DCE(cfg[0])
ldc $1,$cfg
or3 $1,$1,1
stc $1,$cfg
nop
nop
nop
nop
nop
ret
.Lend_enable_dcache:
.text
#ifdef NOVEC
.global _reset
_reset:
#endif
.global _start
_start:
mov $fp, 0 # for unwinding
# $sp set
movh $sp, %uhi(__stack_table)
or3 $sp, $sp, %lo(__stack_table)
#ifndef NOVEC
# copy exception vector table
# RCFG.IRSZ
if_bitfield_zero reg=$rcfg, start=16, length=7, label=.Lend_ev_imem
# handle imem
movh $11,%uhi(_local_ram_base)
or3 $11,$11,%lo(_local_ram_base)
# clear CFG.EVA ([23])
ldc $0,$cfg
movh $1, %uhi(0xff7fffff)
or3 $1, $1, %lo(0xff7fffff)
and $0,$1
stc $0,$cfg
bra .Ldo_repeat_ev
.Lend_ev_imem:
#ifdef UseSDRAM
movh $11,%uhi(_ext_ram_base)
or3 $11,$11,%lo(_ext_ram_base)
# set CFG.EVA ([23])
ldc $0,$cfg
movh $1,%uhi(1<<23)
or3 $1,$1,%lo(1<<23)
or $0,$1
stc $0,$cfg
#else
# handle ROM
bra .Lend_ev
#endif
.Ldo_repeat_ev:
# set CFG.EVM ([4])
ldc $0,$cfg
or3 $0,$0,(1<<4)
stc $0,$cfg
# copy _exception_table to $11
movh $12,%uhi(_exception_table)
or3 $12,$12,%lo(_exception_table)
mov $13,8
repeat $13,.Lrepeat_ev
lw $1,0($12)
add $12,4
.Lrepeat_ev:
sw $1,0($11)
add $11,4
.Lend_ev:
# copy interrupt vector table
# RCFG.IRSZ
if_bitfield_zero reg=$rcfg, start=16, length=7, label=.Lend_iv_imem
# handle imem
movh $11,%uhi(_local_ram_base)
or3 $11,$11,%lo(_int_base_offset)
# clear CFG.IVA ([22])
ldc $0,$cfg
movh $1,%uhi(0xffbfffff) # ~(1<<22)
or3 $1,$1,%lo(0xffbfffff)
and $0,$1
stc $0,$cfg
bra .Ldo_repeat_iv
.Lend_iv_imem:
#ifdef UseSDRAM
movh $11,%uhi(_ext_ram_base)
or3 $11,$11,%lo(_int_base_offset)
# set CFG. IVA ([22])
ldc $0,$cfg
movh $1,%uhi(1<<22)
or3 $1,$1,%lo(1<<22)
or $0,$1
stc $0,$cfg
#else
# handle ROM
bra .Lend_iv
#endif
.Ldo_repeat_iv:
# set CFG.IVM ([3])
ldc $0,$cfg
or3 $0,$0,(1<<3)
stc $0,$cfg
# copy _interrupt_table to $11
movh $12,%uhi(_interrupt_table)
or3 $12,$12,%lo(_interrupt_table)
mov $13,32
add $13,-1
and3 $13,$13,127
repeat $13,.Lrepeat_iv
lw $1,0($12)
add $12,4
.Lrepeat_iv:
sw $1,0($11)
add $11,4
.Lend_iv:
# initialize instruction cache
# Icache Size CCFG.ICSZ ([22..16]) KByte
if_bitfield_zero reg=$ccfg, start=16, length=7, label=.Lend_ic
mov $3,$0 # cache size in KB
# ID.ID
if_bitfield_ltN reg=$ID, start=8, length=8, N=3, label=.Lend_mepc3_ic
# Line Size CCFG.ICSZ ([26..24]) Byte
if_bitfield_ltN reg=$ccfg, start=24, length=3, N=2, label=.Lend_ic
bgei $0,5,.Lend_ic
add3 $1,$0,3 # bit width of line size
mov $0,$3
# clear tag
mov $2,10
sub $2,$1
sll $0,$2 # *KByte/(line size)
add $0,-1
mov $2,1
sll $2,$1 # line size
bra .Ldo_repeat_icache
.Lend_mepc3_ic:
# ICache: $0 KByte
mov $0,$3
# clear tag
sll $0,(10-5) # *KByte/(32byte=linesize)
add $0,-1
mov $2,32
.Ldo_repeat_icache:
mov $1,0
bra 0f
# Align this code on an 8 byte boundary in order to keep the repeat
# loop entirely within the instruction fetch buffer.
.p2align 3
0:
movh $3,%hi(0x00310000) # for tag
repeat $0,.Lrepeat_icache
add $0,-1
.Lrepeat_icache:
sw $1,0($3)
add3 $3,$3,$2
.Lenable_icache:
movh $1,%hi(__enable_icache)
add3 $1,$1,%lo(__enable_icache)
jsr $1
.Lend_ic:
# initialize data cache
# Dcache Size CCFG.DCSZ ([6..0]) KByte
if_bitfield_zero reg=$ccfg, start=0, length=7, label=.Lend_dc
mov $3,$0 # cache size in KB
# ID.ID
if_bitfield_ltN reg=$ID, start=8, length=8, N=3, label=.Lend_mepc3_dc
# Line Size CCFG.DCSZ ([10..8]) Byte
if_bitfield_ltN reg=$ccfg, start=8, length=3, N=2, label=.Lend_dc
bgei $0,5,.Lend_dc
add3 $1,$0,3 # bit width of line size
mov $0,$3
# clear tag
mov $2,10
sub $2,$1
sll $0,$2 # *KByte/(line size)
add $0,-1
mov $2,1
sll $2,$1 # line size
bra .Ldo_repeat_dcache
.Lend_mepc3_dc:
# DCache: $0 KByte
mov $0,$3
# clear tag
sll $0,(10-5) # *KByte/(32byte=linesize)
add $0,-1
mov $2,32
.Ldo_repeat_dcache:
mov $1,0
movh $3,%hi(0x00330000) # for tag
repeat $0,.Lrepeat_dcache
add $0,-1
.Lrepeat_dcache:
sw $1,0($3)
add3 $3,$3,$2
.Lenable_dcache:
movh $1,%hi(__enable_dcache)
add3 $1,$1,%lo(__enable_dcache)
jsr $1
.Lend_dc:
# NOVEC
#endif
# initialize sp, gp, tp
# get CPU ID
ldc $0, $id
srl $0, 16
# load ID-specific stack pointer
sl2ad3 $0, $0, $sp # $0 = ($0 << 2) + $sp
lw $sp,($0) # $sp = *($0)
mov $0, 0
movh $gp, %uhi(__sdabase)
or3 $gp, $gp, %lo(__sdabase)
movh $tp, %uhi(__tpbase)
or3 $tp, $tp, %lo(__tpbase)
# zero out BSS
movh $1, %uhi(__bss_start)
or3 $1, $1, %lo(__bss_start)
mov $2, 0
movh $3, %uhi(_end)
or3 $3, $3, %lo(_end)
sub $3, $1
bsr memset
movh $1, %uhi(__sbss_start)
or3 $1, $1, %lo(__sbss_start)
mov $2, 0
movh $3, %uhi(__sbss_end)
or3 $3, $3, %lo(__sbss_end)
sub $3, $1
bsr memset
movh $1, %uhi(__farbss_start)
or3 $1, $1, %lo(__farbss_start)
mov $2, 0
movh $3, %uhi(__farbss_end)
or3 $3, $3, %lo(__farbss_end)
sub $3, $1
bsr memset
# enable interrupts
ei
# construct global class variables
bsr __invoke_init_section
# invoke main
mov $1, 0 # argc, argv, envp
mov $2, 0
mov $3, 0
bsr main
mov $1, $0
bsr exit
.global _exit
_exit:
# Prevent _exit recursion
movh $3, %uhi(_exit_in_progress)
or3 $3, $3, %lo(_exit_in_progress)
lw $5, ($3)
bnez $5, _skip_fini
mov $5, 1
sw $5, ($3)
# We don't need to preserve $5 because we're going to exit anyway.
mov $5,$1
# destruct global class variables
bsr __invoke_fini_section
mov $1,$5
_skip_fini:
#ifdef NOSIM
_exit_loop:
bra _exit_loop
#else
.2byte 0x7800 | ((SYS_exit & 0xe) << 7) | ((SYS_exit & 1) << 4)
ret
#endif
.data
_exit_in_progress: .word 0
# For these two, the epilogue is in crtn.S
.section .init
__invoke_init_section:
add $sp, -4
ldc $0, $lp
sw $0, ($sp)
.section .fini
__invoke_fini_section:
add $sp, -4
ldc $0, $lp
sw $0, ($sp)
#ifndef NOVEC
.section .vec, "ax"
.core
.org 0x0, 0
.global _exception_table
.type _exception_table,@function
_exception_table:
.p2align 2
.org 0x0000, 0
.global _reset
_reset:
jmp _handler_RESET
.org 0x0004, 0
jmp _handler_NMI
.org 0x0008, 0
jmp _handler_RI
.org 0x000c, 0
jmp _handler_ZDIV
.org 0x0010, 0
jmp _handler_BRK
.org 0x0014, 0
jmp _handler_SWI
.org 0x0018, 0
jmp _handler_DEBUG
.org 0x001c, 0
jmp _handler_DSP
.org 0x0020, 0
jmp _handler_COP
.org 0x30, 0
.global _interrupt_table
.type _interrupt_table,@function
_interrupt_table:
.org 0x0030
jmp _handler_INT0
.org 0x0034
jmp _handler_INT1
.org 0x0038
jmp _handler_INT2
.org 0x003c
jmp _handler_INT3
.org 0x0040
jmp _handler_INT4
.org 0x0044
jmp _handler_INT5
.org 0x0048
jmp _handler_INT6
.org 0x004c
jmp _handler_INT7
.org 0x0050
jmp _handler_INT8
.org 0x0054
jmp _handler_INT9
.org 0x0058
jmp _handler_INT10
.org 0x005c
jmp _handler_INT11
.org 0x0060
jmp _handler_INT12
.org 0x0064
jmp _handler_INT13
.org 0x0068
jmp _handler_INT14
.org 0x006c
jmp _handler_INT15
.org 0x0070
jmp _handler_INT16
.org 0x0074
jmp _handler_INT17
.org 0x0078
jmp _handler_INT18
.org 0x007c
jmp _handler_INT19
.org 0x0080
jmp _handler_INT20
.org 0x0084
jmp _handler_INT21
.org 0x0088
jmp _handler_INT22
.org 0x008c
jmp _handler_INT23
.org 0x0090
jmp _handler_INT24
.org 0x0094
jmp _handler_INT25
.org 0x0098
jmp _handler_INT26
.org 0x009c
jmp _handler_INT27
.org 0x00a0
jmp _handler_INT28
.org 0x00a4
jmp _handler_INT29
.org 0x00a8
jmp _handler_INT30
.org 0x00ac
jmp _handler_INT31
# NOVEC
#endif

23
libgloss/mep/sim-crtn.S Normal file
View File

@ -0,0 +1,23 @@
# Copyright (c) 2003 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of
# this license is available at http://www.opensource.org/licenses. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
# subject to the BSD License and may only be used or replicated with the express
# permission of Red Hat, Inc.
.section .init
lw $1, ($sp)
stc $1, $lp
add $sp, 4
ret
.section .fini
lw $1, ($sp)
stc $1, $lp
add $sp, 4
ret

View File

@ -0,0 +1,19 @@
# Copyright (c) 2003 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
# of this license is available at http://www.opensource.org/licenses. Any
# Red Hat trademarks that are incorporated in the source code or documentation
# are not subject to the BSD License and may only be used or replicated with
# the express permission of Red Hat, Inc.
#
# Toshiba Media Processor startup file (simnovec-crt0.S)
#
# Designed for user programs which create their own interrupt/exception vectors.
#
#define NOVEC
#include "sim-crt0.S"

279
libgloss/mep/simple.ld Normal file
View File

@ -0,0 +1,279 @@
/******************************************************************************
begin-header
DO NOT EDIT. THIS FILE IS MACHINE-GENERATED
FROM THE TEMPLATE FILE gmap_default.ld.
ALL EDITS WILL BE ERASED WITH NEXT MeP-Integrator RUN.
Custom linker script for the MeP Module simple.
end-header
*******************************************************************************/
OUTPUT_FORMAT("elf32-mep", "elf32-mep",
"elf32-mep")
OUTPUT_ARCH(mep)
ENTRY(_reset)
MEMORY
{
/* begin-memory */
VEC (r) : ORIGIN = 0x00000000, LENGTH = 0x000000b8
VEC_WARM (w) : ORIGIN = 0x00800000, LENGTH = 0x000000b8
HWINIT (r) : ORIGIN = 0x000000b8, LENGTH = 0x00000148
ROM (r) : ORIGIN = 0x00000200, LENGTH = 0x001ffe00
RAM1 (w) : ORIGIN = 0x008000b8, LENGTH = 0x007fff48
/*RAM2 (w) : ORIGIN = 0x80800000, LENGTH = 0x00800000 */
/* end-memory */
}
SECTIONS
{
/* Sections to be placed in the vec area. */
.vec : { *(.vec) } >VEC /* VEC-section */
/* Sections to be placed in the HWINIT area. */
.hwinit : { *(.hwinit) } >HWINIT /* HWINIT-section */
/* Sections to be placed in the ROM area. */
.gnu.version : { *(.gnu.version) } >ROM /* ROM-section */
.gnu.version_d : { *(.gnu.version_d) } >ROM /* ROM-section */
.gnu.version_r : { *(.gnu.version_r) } >ROM /* ROM-section */
/* Sections to be placed in the romdata.s area. */
.srodata :
{
__sdabase = . + 0x8000;
*(.srodata) *(.srodata.*) *(.gnu.linkonce.srd.*)
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.s area. */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
} >RAM1 /* DATA-section */
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon)
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
/* Assert maximum size */
__assert_tiny_size = ASSERT ((. < __sdabase) || ((. - __sdabase) <= 0x8000),
"tiny section overflow");
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.m area. */
.data :
{
__data_start = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} >RAM1 /* DATA-section */
.data1 : { *(.data1) } >RAM1 /* DATA-section */
.eh_frame : { KEEP (*(.eh_frame))} >RAM1 /* DATA-section */
.gcc_except_table : { *(.gcc_except_table) } >RAM1 /* DATA-section */
.dynamic : { *(.dynamic) } >RAM1 /* DATA-section */
.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. */
KEEP (*crtbegin.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >RAM1 /* DATA-section */
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >RAM1 /* DATA-section */
.jcr :
{
. = ALIGN(4);
*(.jcr)
} >RAM1 /* DATA-section */
.got :
{
*(.got.plt) *(.got)
_edata = .;
PROVIDE (edata = .);
} >RAM1 /* DATA-section */
.based :
{
__tpbase = .;
*(.based) *(.based.*) *(.gnu.linkonce.based.*)
/* Assert maximum size */
__assert_based_size = ASSERT ((. - __tpbase) <= 0x80,
"based section overflow");
} >RAM1 /* DATA-section */
.bss :
{
__bss_start = .;
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(32 / 8);
_end = .;
PROVIDE (end = .);
} >RAM1 /* DATA-section */
/* Sections to be placed in the code.m area. */
.init :
{
KEEP (*(.init))
} >RAM1 /* CODE-section */
.plt : { *(.plt) } >RAM1 /* DATA-section */
.text :
{
*(.text)
*(.text.*)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t.*)
} >RAM1 /* CODE-section */ =0
.vtext ALIGN(8) :
{
*(.vtext)
} >RAM1 /* CODE-section */
.fini :
{
KEEP (*(.fini))
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
} >RAM1 /* CODE-section */ =0
/* Sections to be placed in the romdata.m area. */
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } >RAM1 /* DATA-section */
.rodata1 : { *(.rodata1) } >RAM1 /* DATA-section */
/* Sections to be placed in the code.l area. */
.ftext : { *(.ftext) *(.ftext.*) *(.gnu.linkonce.ft.*) } >RAM1 /* CODE-section */
.vftext ALIGN(8) :
{
*(.vftext) *(.vftext.*) *(.gnu.linkonce.vf.*)
} >RAM1 /* CODE-section */
/* Sections to be placed in the romdata.l area. */
.frodata :
{
*(.frodata) *(.frodata.*) *(.gnu.linkonce.frd.*)
__assert_near_size = ASSERT (. <= 0x1000000, "near section overflow");
} >RAM1 /* DATA-section */
/* Sections to be placed in the data.l area. */
.far : { *(.far) *(.far.*) *(.gnu.linkonce.far.*) } >RAM1 /* DATA-section */
.farbss :
{ PROVIDE (__farbss_start = .);
*(.farbss) *(.farbss.*)
PROVIDE (__farbss_end = .);
} >RAM1 /* DATA-section */
/* END-mep-sections */
.vec_warm :
{
/* vec_warm is a place for the startup code to write the interrupt
vectors. Allow 0xb8 bytes of space aligned on a 4 byte boundary. */
. = ALIGN(4);
vec_warm = .;
. += 0xb8;
} >VEC_WARM
/* begin-stack-table */
__stack1 = (__stack - (0 * (__stack_size / 2)) + 15) / 16 * 16;
__stack2 = (__stack - (1 * (__stack_size / 2)) + 15) / 16 * 16;
.rostacktab :
{
/* Emit a table describing the location of the different stacks. */
. = ALIGN(4);
__stack_table = .;
LONG (__stack2);
LONG (__stack1);
LONG (__stack2);
__stack_end = .;
} >RAM1
/* end-stack-table */
/* begin-heap */
/* End of DATA is 0x008000b8 + 0x007fff48. That's where the heap will end. */
__heap_end = 0x008000b8 + 0x007fff48 - 1;
/* end-heap */
/* Default stack size is 1M. That's where the heap will start if there's
room. If there's not enough room, allocate half of the remaining space
for stack and half for heap. Align the heap on a 16 byte boundary. */
__stack_size = (__stack_end + 0x100000 <= __heap_end + 1
? 0x100000
: ((__heap_end + 1 - __stack_end) / 2));
__heap = (__stack_end + __stack_size + 15) / 16 * 16;
/* Leave 16 bytes between the stack and the heap. */
__stack = __heap - 0x10;
/* 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) }
.debug_ranges 0 : { *(.debug_ranges) }
/* 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) }
/* These must appear regardless of . */
}

View File

@ -0,0 +1,19 @@
# Copyright (c) 2003 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
# of this license is available at http://www.opensource.org/licenses. Any
# Red Hat trademarks that are incorporated in the source code or documentation
# are not subject to the BSD License and may only be used or replicated with
# the express permission of Red Hat, Inc.
#
# Toshiba Media Processor startup file (simsdram-crt0.S)
#
# Designed for user programs which put interrupt/exception vectors in sdram.
#
#define UseSDRAM
#include "sim-crt0.S"

66
libgloss/mep/syscalls.S Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2003 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
#include "syscall.h"
/* Return ABI: $1 is errno, $0 is return value. */
#define S(n) \
.global n ; .weak n ; n: ; \
.2byte 0x7800 | ((SYS_##n & 0xe) << 7) | ((SYS_##n & 1) << 4) ; bra sysret
.text
#define SYS___mep_write SYS_write
#define SYS___mep_read SYS_read
#define SYS__Sid_config SYS_reconfig
S(open)
S(close)
S(__mep_read)
S(__mep_write)
S(lseek)
S(unlink)
S(getpid)
S(kill)
S(fstat)
/* ARGV support. */
S(argvlen)
S(argv)
/* These are extras added for one reason or another. */
S(chdir)
S(stat)
S(chmod)
S(utime)
S(time)
S(gettimeofday)
S(times)
S(link)
S(_Sid_config)
sysret:
add3 $sp, $sp, -12
sw $0, 0($sp)
sw $1, 4($sp)
ldc $2, $lp
sw $2, 8($sp)
bsr __errno
lw $1, 4($sp)
sw $1, ($0)
lw $0, 0($sp)
lw $2, 8($sp)
stc $2, $lp
add3 $sp, $sp, 12
ret

33
libgloss/mep/write.c Normal file
View File

@ -0,0 +1,33 @@
/* write.c -- write characters to file, with hook.
*
* Copyright (c) 2003 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the BSD
* License. This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY expressed or implied, including the implied
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy
* of this license is available at http://www.opensource.org/licenses. Any
* Red Hat trademarks that are incorporated in the source code or documentation
* are not subject to the BSD License and may only be used or replicated with
* the express permission of Red Hat, Inc.
*/
extern int __mep_write(int, unsigned char *, int);
extern void _ioOut(int) __attribute__((weak));
int
write(int fd, unsigned char *buf, int count)
{
if ((fd == 1 || fd == 2) && &_ioOut)
{
int c = count;
while (c > 0)
{
c --;
_ioOut(*buf++);
}
return count;
}
return __mep_write(fd, buf, count);
}