Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)

- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
2013-12-06 12:04:52 +01:00
parent ff10274392
commit 84d9c625bf
4655 changed files with 379317 additions and 151059 deletions

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.189 2012/09/16 13:47:41 rmind Exp $
# $NetBSD: Makefile,v 1.209 2013/11/28 12:08:56 mrg Exp $
# from: @(#)Makefile 5.25.1.1 (Berkeley) 5/7/91
.include <bsd.own.mk>
@@ -29,6 +29,46 @@ SUBDIR+= .WAIT
SUBDIR+= libc
SUBDIR+= .WAIT
.if defined(__MINIX)
SUBDIR+= libasyn \
libaudiodriver \
libbdev \
libblockdriver \
libchardriver \
libcompat_minix \
libddekit \
libdevman \
libexec \
libfetch \
libinputdriver \
libminc \
libminixfs \
libmthread \
libnetdriver \
libsffs \
libtimers \
libusb \
libvtreefs
.if (${MKLWIP} == "yes")
SUBDIR+= liblwip \
libnetsock
.endif
.if (${MACHINE_ARCH} == "i386")
SUBDIR+= libhgfs \
libvassert \
libvboxfs \
libvirtio
.endif
.if (${MACHINE_ARCH} == "earm")
SUBDIR+= libclkconf \
libgpio \
libi2cdriver
.endif
.endif # defined(__MINIX)
#
# The SUBDIRs above are included here for completeness but should be built
# and installed prior to make(dependall) in this file, as libraries listed
@@ -37,26 +77,25 @@ SUBDIR+= .WAIT
#SUBDIR+= i18n_module
SUBDIR+= libcompat_minix libblockdriver libchardriver \
libnetdriver libm libtimers libutil \
libz libfetch libvtreefs libaudiodriver libmthread \
libexec libdevman libusb libasyn librmt \
libddekit libminixfs libbdev libelf libminc libcrypt libterminfo \
libutil libbz2 libprop \
libpuffs libsffs libinputdriver
SUBDIR+= \
libbz2 \
libcrypt \
libm \
libprop \
libpuffs librmt \
libterminfo \
libutil libz
.if (${MKLWIP} == "yes")
SUBDIR += liblwip libnetsock
.if !defined(BSD_MK_COMPAT_FILE)
#SUBDIR+= libkern
.endif
.if (${MACHINE_ARCH} == "i386")
SUBDIR += libvassert libhgfs libvboxfs libvirtio
.if (${MACHINE_CPU} == "arm")
LIBC_MACHINE_ARCH?=${MACHINE_ARCH}
.if empty(LIBC_MACHINE_ARCH:M*hf*)
SUBDIR+= libc_vfp
.endif
.if (${MACHINE_ARCH} == "earm")
SUBDIR += libclkconf libgpio libi2cdriver
.endif
.if (${MKRUMP} != "no")
SUBDIR+= librumpclient
.endif
@@ -64,10 +103,6 @@ SUBDIR+= librumpclient
SUBDIR+= libskey
.endif
.if (${MKCRYPTO} != "no")
SUBDIR+= ../crypto/external/bsd/netpgp/libmj
.endif
.if (${MKMDNS} != "no")
SUBDIR+= ../external/apache2/mDNSResponder/lib
.endif
@@ -76,13 +111,10 @@ SUBDIR+= ../external/apache2/mDNSResponder/lib
SUBDIR+= ../external/bsd/flex/lib
#SUBDIR+= ../external/bsd/tre/lib
#SUBDIR+= ../external/bsd/libdwarf/lib
#SUBDIR+= ../external/bsd/libelf/lib
#SUBDIR+= ../external/bsd/libevent/lib
SUBDIR+= ../external/bsd/libelf/lib
#SUBDIR+= ../external/bsd/liblzf/lib
#SUBDIR+= ../external/bsd/libpcap/lib
SUBDIR+= ../external/mit/lua/lib
#SUBDIR+= ../external/mit/expat/lib
SUBDIR+= ../external/public-domain/sqlite/lib
@@ -94,18 +126,20 @@ SUBDIR+= ../external/public-domain/xz/lib
. if ${HAVE_GCC} == 4
#SUBDIR+= ../gnu/lib/libobjc4
. else
#SUBDIR+= ../external/gpl3/gcc/lib/libobjc
#SUBDIR+= ../external/gpl3/gcc/lib/libgomp
. if !defined(__MINIX) || ${MKGCCCMDS} == "yes"
SUBDIR+= ../external/gpl3/gcc/lib/libobjc
SUBDIR+= ../external/gpl3/gcc/lib/libgomp
. endif # !defined(__MINIX) || ${MKGCCCMDS} == "yes"
. endif
# LSC: Replaced __MINIX test with MKGCCCMDS, as we do not want gcc by default
# nor the libraries, but we still want toretain the possibility of
# nor the libraries, but we still want to retain the possibility of
# installing GCC from the base system.
. if ${HAVE_GCC} >= 45 && !defined(MLIBDIR) && ${MKGCCCMDS} == "yes"
# Should probably move GMP, MPFR and MPC builds into the GCC >= 4.5
# specific build area, but we get better parallelism this way.
SUBDIR+= ../external/lgpl3/gmp/lib/libgmp
SUBDIR+= ../external/lgpl3/mpfr/lib/libmpfr
SUBDIR+= ../external/lgpl2/mpc/lib/libmpc
SUBDIR+= ../external/lgpl3/mpc/lib/libmpc
. endif
.endif
@@ -116,14 +150,22 @@ SUBDIR+= ../external/lgpl2/mpc/lib/libmpc
#==================== 1st library dependency barrier ====================
SUBDIR+= .WAIT
.if (${MKCRYPTO} != "no")
SUBDIR+= ../crypto/external/bsd/netpgp/libmj
SUBDIR+= ../crypto/external/bsd/netpgp/lib/verify # depends on libz
.endif
#SUBDIR+= ../external/bsd/libdwarf/lib # depends on libelf
SUBDIR+= ../external/mit/lua/lib # depends on libm
SUBDIR+= libcurses # depends on libterminfo
#SUBDIR+= libdm # depends on libprop
SUBDIR+= libedit # depends on libterminfo
#SUBDIR+= libexecinfo # depends on libelf
SUBDIR+= libexecinfo # depends on libelf
#SUBDIR+= libppath # depends on libprop
#SUBDIR+= libperfuse # depends on libpuffs
#SUBDIR+= libquota # depends on libprop and librpcsvc
SUBDIR+= librefuse # depends on libpuffs
#SUBDIR+= libisns # depends on libpthread
.if (${MKRUMP} != "no")
SUBDIR+= librumpuser # depends on libpthread
SUBDIR+= librumphijack # depends on librumpclient and libpthread
@@ -131,7 +173,6 @@ SUBDIR+= librumphijack # depends on librumpclient and libpthread
.if (${MKNPF} != "no")
SUBDIR+= libnpf # depends on libprop
#SUBDIR+= npf
.endif
.if (${MKCRYPTO} != "no")
@@ -154,7 +195,11 @@ SUBDIR+= ../external/gpl2/lvm2/lib # depends on libprop
SUBDIR+= ../external/gpl3/binutils/lib # libbfd depends on libz
.endif
.if (${MKGCC} != "no" && ${MKCXX} != "no")
.if (${MKLIBCXX} != "no")
SUBDIR+= ../external/bsd/libc++
.endif
.if (${MKGCC} != "no" && ${MKCXX} != "no" && ${MKLIBSTDCXX} != "no")
.if (defined(__MINIX) && ${MKGCCCMDS} == "yes")
. if ${HAVE_GCC} == 4
SUBDIR+= ../gnu/lib/libstdc++-v3_4 # depends on libm
@@ -169,7 +214,10 @@ SUBDIR+= ../external/gpl3/gcc/lib/libsupc++
#==================== 2nd library dependency barrier ====================
SUBDIR+= .WAIT
.if (defined(__MINIX) && ${MKGCCCMDS} == "yes")
.if (${MKNPF} != "no")
SUBDIR+= npf # depends on libnpf
.endif
.if (${MKATF} != "no")
SUBDIR+= ../external/bsd/atf/lib # depends on libstdc++
.endif
@@ -177,7 +225,6 @@ SUBDIR+= ../external/bsd/atf/lib # depends on libstdc++
.if (${MKKYUA} != "no")
SUBDIR+= ../external/bsd/lutok/lib # depends on lua and libstdc++
.endif
.endif # (defined(__MINIX) && ${MKGCCCMDS} == "yes")
SUBDIR+= libform # depends on libcurses
SUBDIR+= libmenu # depends on libcurses
@@ -196,7 +243,7 @@ SUBDIR+= ../crypto/external/bsd/openssh/lib # depends on libcrypto, libz
SUBDIR+= ../crypto/external/bsd/netpgp/lib # depends on libcrypto, ...
.endif
#SUBDIR+= ../external/bsd/bind/lib # depends on libcrypto
#SUBDIR+= ../external/bsd/libevent/lib # depends on libcrypto
#SUBDIR+= ../external/bsd/fetch/lib # depends on libssl
.if (${MKLDAP} != "no")
@@ -206,6 +253,8 @@ SUBDIR+= ../external/bsd/openldap/lib # depends on libcrypto, ...
#==================== 3rd library dependency barrier ====================
SUBDIR+= .WAIT
#SUBDIR+= ../external/bsd/bind/lib # depends on heimdal, libcrypto
.if (${MKRUMP} != "no")
SUBDIR+= librumpdev # depends on librump
SUBDIR+= librumpnet # depends on librump
@@ -220,7 +269,13 @@ SUBDIR+= libpam # depends on heimdal
SUBDIR+= ../crypto/external/bsd/libsaslc # depends on heimdal, openssl
.endif
#SUBDIR+= ../external/bsd/mdocml/lib
.if ${MKSLJIT} != "no"
SUBDIR+= ../external/bsd/sljit/lib
SUBDIR+= .WAIT
SUBDIR+= libbpfjit
.endif
SUBDIR+= ../external/bsd/mdocml/lib
.if (${MKRUMP} != "no")
#==================== 4th library dependency barrier ====================
@@ -228,11 +283,19 @@ SUBDIR+= .WAIT
SUBDIR+= libukfs # depends on librumpvfs, librump
.if (${MKTPM} != "no")
SUBDIR+= ../crypto/external/cpl/trousers/lib
.endif
#==================== 5th library dependency barrier ====================
SUBDIR+= .WAIT
SUBDIR+= libp2k # depends on libukfs, librumpvfs, libpuffs
.if (${MKTPM} != "no")
SUBDIR+= ../crypto/external/cpl/tpm-tools/lib # depends on trousers
.endif
.if !defined(BSD_MK_COMPAT_FILE)
SUBDIR+= ../sys/rump/dev/lib
SUBDIR+= ../sys/rump/fs/lib
@@ -242,32 +305,7 @@ SUBDIR+= ../sys/rump/net/lib
.endif
# Lua bindings come last, they might depend on anything
#SUBDIR+= lua
#
# build_install logic for src/Makefile.
# Compute a list of subdirectories delimited by .WAIT.
# Run "make dependall && make install" for all subdirectories in a group
# concurrently, but wait after each group.
#
SUBDIR_GROUPS= 1
CUR_GROUP:= 1
.for dir in ${SUBDIR}
. if ${dir} == ".WAIT"
CUR_GROUP:= ${CUR_GROUP}1
SUBDIR_GROUPS:= ${SUBDIR_GROUPS} ${CUR_GROUP}
. else
SUBDIR_GROUP.${CUR_GROUP}+= ${dir}
.endif
.endfor
build_install:
.for group in ${SUBDIR_GROUPS}
. if !empty(SUBDIR_GROUP.${group})
${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/dependall-/}
${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/install-/}
. endif
.endfor
SUBDIR+= lua
.include <bsd.buildinstall.mk>
.include <bsd.subdir.mk>

View File

@@ -1,3 +1,3 @@
# $NetBSD: Makefile.inc,v 1.7 2012/03/21 05:39:21 matt Exp $
#WARNS?= 5
WARNS?= 5

127
lib/bumpversion Executable file
View File

@@ -0,0 +1,127 @@
#!/bin/sh
# $NetBSD: bumpversion,v 1.10 2003/07/26 19:24:24 salo Exp $
#
# Copyright (c) 1993 Christopher G. Demetriou
# 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. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed for the
# NetBSD Project. See http://www.NetBSD.org/ for
# information about NetBSD.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR 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.
#
# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
while :
do case "$1" in
# -c says to create new shlib_version files
-c)
create=TRUE
shift ;;
# -n sets 'do nothing mode'
-n)
donothing=TRUE
shift ;;
# -m says to bump major number, rather than minor number
-m)
bumpmajor=TRUE
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo "usage: $0 [-c] [-m] [-n] dir ..."
exit 2
fi
TMP=/tmp/bump$$
error=0
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
for dir in $@ ; do
versf=$dir/shlib_version
if [ "X$create" != "X" ] ; then
if [ ! -d $dir ] ; then
echo $0: $dir is not a directory 1>&2
error=1
continue
fi
if [ -e $versf ] ; then
echo $0: $versf exists\; not replacing 1>&2
error=1
continue
fi
else
if [ ! -e $versf ] ; then
echo $0: $versf does not exist 1>&2
error=1
continue
fi
if [ ! -f $versf ] ; then
echo $0: $versf is not a regular file 1>&2
error=1
continue
fi
if [ ! -r $versf ] ; then
echo $0: $versf is not readable 1>&2
error=1
continue
fi
if [ ! -w $versf ] ; then
echo $0: $versf is not a writable 1>&2
error=1
continue
fi
. $versf
fi
if [ "X$create" != "X" ] ; then
nmajor=0
nminor=0
elif [ "X$bumpmajor" != "X" ] ; then
nmajor=`expr $major + 1`
nminor=0
else
nmajor=$major
nminor=`expr $minor + 1`
fi
if [ "X$donothing" = "X" ] ; then
echo major=$nmajor > $TMP
echo minor=$nminor >> $TMP
mv $TMP $versf
else
echo "$0: $versf -> $nmajor.$nminor"
fi
done
exit $error

155
lib/checkoldver Executable file
View File

@@ -0,0 +1,155 @@
#!/bin/sh
# $NetBSD: checkoldver,v 1.3 2008/04/30 13:10:50 martin Exp $
#
# Copyright (c) 2002 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Christos Zoulas.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
# checkoldver [dir ...]
#
# Looks in the given directories for old shared libraries and lists them
# Useful for: 'checkoldver /usr/lib | xargs rm -f'
delete() {
obsol="$1.so"
if [ ! -z "$2" ]
then
obsol="$obsol.$2"
fi
if [ ! -z "$3" ]
then
obsol="$obsol.$3"
fi
if [ ! -z "$4" ]
then
obsol="$obsol.$4"
fi
echo $PWD/$obsol
}
comparelib() {
OIFS="$IFS"
IFS="$IFS."
set -- $1
IFS="$OIFS"
if [ "$3" = "[0-9]*" ]
then
return
fi
if [ -z "$libmajor" ]
then
libname="$1"
libmajor="$3"
libminor="$4"
libtiny="$5"
return
fi
if [ "$libmajor" -lt "$3" ]
then
delete "$libname" "$libmajor" "$libminor" "$libtiny"
libmajor="$3"
libminor="$4"
libtiny="$5"
return
elif [ "$3" -lt "$libmajor" ]
then
delete "$libname" "$3" "$4" "$5"
return
fi
if [ -z "$libminor" ]
then
return
fi
if [ "$libminor" -lt "$4" ]
then
delete "$libname" "$libmajor" "$libminor" "$libtiny"
libmajor="$3"
libminor="$4"
libtiny="$5"
return
elif [ "$4" -lt "$libminor" ]
then
delete "$libname" "$3" "$4" "$5"
return
fi
if [ -z "$libtiny" ]
then
return
fi
if [ "$libtiny" -lt "$5" ]
then
delete "$libname" "$libmajor" "$libminor" "$libtiny"
libmajor="$3"
libminor="$4"
libtiny="$5"
return
elif [ "$5" -lt "$libminor" ]
then
delete "$libname" "$3" "$4" "$5"
return
fi
}
processonedir() {
cd "$1"
for lib in lib*.so
do
lib="${lib#lib}"
lib="${lib%.so}"
libmajor=
libminor=
libtiny=
for link in lib$lib.so.[0-9]*.[0-9]*.[0-9]*
do
comparelib "$link"
done
libmajor=
libminor=
libtiny=
for link in lib$lib.so.[0-9]*.[0-9]*
do
comparelib "$link"
done
libmajor=
libminor=
libtiny=
for link in lib$lib.so.[0-9]*
do
comparelib "$link"
done
done
}
for i
do
processonedir "$i"
done

232
lib/checkver Executable file
View File

@@ -0,0 +1,232 @@
#!/bin/sh
# $NetBSD: checkver,v 1.16 2013/02/17 02:36:21 christos Exp $
#
# Copyright (c) 1998 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Eric Haszlakiewicz.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
#--------------------------------------------------------------------#
# checkver -
# Check for libraries that appear to be newer than the
# one we're about to install.
#
# checkver [-q] [-v shlib_version_file] -d [installedlibdir [library name]]"
# checkver [-q] [-v shlib_version_file] -s [setlistdir [library name]]"
# checkver [-q] [-v shlib_version_file] -f liblistfile [library name]"
#
# One of -d, -s or -f must be specified.
#
# all: If library name is not specified it is assumed to
# be the name of the current directory.
#
# -d: Checks the version against the installed libraries.
# If no further arguments are given "/usr/lib" is
# used as the location of installed libraries.
#
# -s: Checks the version against the sets. If no argument
# follows the sets directory defaults to "/usr/src/distrib/sets/lists".
# The directory may be specified as either the top of the
# source tree or as the lists directory.
#
# -f: Checks the version against the provided list. A filename
# must be supplied.
#
# -v: Specify the filename of the shlib_version file. Defaults
# to "./shlib_version".
#
# This script produces no output if all library version are not
# large than the source version. If an installed library with a
# version greater than the source is found, checkver prints a
# header and a list of the names of the offending installed libraries.
#
# The header may be supressed by passing "-q" as the first argument.
#
TMP=/tmp/checkver.$$
PROG="$(basename "$0")"
# Can't trap 11 (SEGV) in the Real Bourne Shell, since it uses it for
# internal malloc!
trap "exit 2" 1 2 3 4 5 6 7 8 10 12 13 14 15
trap "[ -d $TMP ] && rm -rf $TMP" 0
Usage() {
cat << EOF 1>&2
Usage: $PROG [-q] [-v version_file] -d [installedlibdir [library name]]
$PROG [-q] [-v version_file] -s [setlistdir [library name]]
$PROG [-q] [-v version_file] -f liblistfile [library name]
$PROG is a script that looks for installed libraries with
versions greater than that in the version file.
For more information, read the comments.
EOF
exit 1
}
basedir=/usr/src
setsdir=$basedir/distrib/sets/lists
libdir=/usr/lib
shlib_version=./shlib_version
error=0
quiet=0
usedir=0
usefile=0
usesets=0
CWD=$(pwd)
fixone() {
local instmajor=$(basename $1 | awk 'BEGIN { FS="." } { print $3 }')
local instminor=$(basename $1 | awk 'BEGIN { FS="." } { print $4 }')
local instteeny=$(basename $1 | awk 'BEGIN { FS="." } { print $5 + 0 }')
local ms="The following libraries have versions greater than the source"
# If they're greater than the source, complain.
if [ "0$major" -eq "0$instmajor" ]; then
if [ "0$minor" -eq "0$instminor" ]; then
if [ "0$teeny" -lt "0$instteeny" ]; then
if [ $error -eq 0 -a $quiet -eq 0 ]; then
echo "$ms" 1>&2
fi
echo $1 1>&2
error=1
fi
elif [ "0$minor" -lt "0$instminor" ]; then
if [ $error -eq 0 -a $quiet -eq 0 ]; then
echo "$ms" 1>&2
fi
echo $1 1>&2
error=1
fi
elif [ "0$major" -lt "0$instmajor" ]; then
if [ $error -eq 0 -a $quiet -eq 0 ]; then
echo "$ms" 1>&2
fi
echo $1 1>&2
error=1
fi
}
while getopts df:shqv: f; do
case $f in
d) usedir=1
if [ $usefile -eq 1 -o $usesets -eq 1 ]; then
Usage
fi;;
f) usefile=1; arg1=$OPTARG
if [ $usedir -eq 1 -o $usesets -eq 1 ]; then
Usage
fi;;
s) usesets=1
if [ $usedir -eq 1 -o $usefile -eq 1 ]; then
Usage
fi;;
v) shlib_version=$OPTARG;;
q) quiet=1;;
*) Usage;;
esac
done
shift $(($OPTIND - 1))
if [ $usedir -eq 0 -a $usefile -eq 0 -a $usesets -eq 0 ]; then
Usage
fi
if [ $usefile -eq 1 ]; then
LIBLIST="$arg1"
else
if ! mkdir -m 0700 $TMP; then
echo "$PROG: Unable to create temp directory." 1>&2
exit 2
fi
LIBLIST=$TMP/libs.lst
fi
# Build list from the installed libraries.
if [ $usedir -eq 1 ]; then
if [ -n "$1" ]; then
libdir="$1"
fi
for f in $libdir; do
ls $f/lib*.so.*.*
done > $LIBLIST 2> /dev/null
fi
# Build list from set lists. Parameter may be either
# the "lists" directory or the top of the source tree.
if [ $usesets -eq 1 ]; then
if [ -n "$1" ]; then
setsdir="$1"
if [ -d "$setsdir/distrib/sets/lists" ]; then
setsdir="$setsdir/distrib/sets/lists"
fi
fi
(cd $setsdir;
cat */[a-z]* |
grep '^./usr/lib/lib.*\.so\.[0-9][0-9]*\.[0-9][0-9]*' |
sort -u > $LIBLIST)
fi
#
# The file $LIBLIST now contains a list of libraries.
#
if [ -z "$2" ]; then
makefile=$CWD/Makefile
libname=$(grep '^LIB=' $makefile | sed -e 's/^LIB=[[:space:]]*//')
# Assume the library name is the name of the current directory.
if [ -z "$libname" ]; then
libname=$(basename $CWD)
fi
else
libname="$2"
fi
echo $libname | grep "^lib" 1>&2 2> /dev/null
if [ $? != 0 ]; then
libname="lib$libname"
fi
if [ ! -f $shlib_version ]; then
echo "$PROG: unable to find $shlib_version" 1>&2
exit 2
fi
# Grab major and minor numbers from the source.
. $shlib_version
if [ -z "$minor" -o -z "$major" ]; then
echo "$PROG: $shlib_version doesn't contain the version." 1>&2
exit 2
fi
# Find every shared object library with the same base name.
for instlib in $(grep $libname.so "$LIBLIST"); do
# Grab the major and minor from the installed library.
fixone "$instlib"
done
exit $error

210
lib/checkvers Executable file
View File

@@ -0,0 +1,210 @@
#!/bin/ksh
# $NetBSD: checkvers,v 1.7 2008/04/30 13:10:50 martin Exp $
#
# Copyright (c) 1998 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Eric Haszlakiewicz.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
#--------------------------------------------------------------------#
# checkvers [-q] [systemlibdir [library name]]
#
# This is a wrapper script around checkver. It will find
# all directories withing the current directory containing
# a shlib_version file and call checkver for each.
#
# As with checkver, a list of directories of installed libraries
# may be specified. This will replace the default of "/usr/lib"
# and search there instead.
#
# A library name may also be specified. However, this script
# will not work correctly if it finds shlib_version files
# corresponding to a different library.
#
# This script produces no output if all library version are ok.
# If the versions aren't ok the header will be displayed once
# followed by a list of problematic libraries.
#
# checkvers:
# if "-s", build list, pass with -f to checkver.
# if "-d", build list, pass with -f to checkver.
# if "-f", pass with -f to checkver.
# Cleanup on exit.
TMP=/tmp/checkvers.$$
trap "exit 2" 1 2 3 4 5 6 7 8 10 11 12 13 14 15
trap "rm -rf $TMP" 0
Usage ( ) {
echo "Usage: $1 [-q] -d [installedlibdir [library name]]"
echo " $1 [-q] -s [setlistdir [library name]]"
echo " $1 [-q] -f liblistfile [library name]"
}
basedir=/usr/src
setsdir=$basedir/distrib/sets/lists
libdir=/usr/lib
error=0
quiet=0
usedir=0
usefile=0
usesets=0
CWD=`pwd`
args=`getopt "df:shq" "$@"`
if [ $? -ne 0 ] ; then
Usage $0
exit 0
fi
set -- $args
while . ; do
case "$1" in
-d) usedir=1 ; shift
if [ $usefile -eq 1 -o $usesets -eq 1 ]; then
Usage $0 ; exit 2
fi;;
-f) usefile=1 ; arg1=$2 ; shift ; shift
if [ $usedir -eq 1 -o $usesets -eq 1 ]; then
Usage $0 ; exit 2
fi;;
-s) usesets=1 ; shift
if [ $usedir -eq 1 -o $usefile -eq 1 ]; then
Usage $0 ; exit 2
fi;;
-h) Usage $0 ; exit 0;;
-q) quiet=1 ; shift;;
--) shift ; break;;
esac
done
if [ $usedir -eq 0 -a $usefile -eq 0 -a $usesets -eq 0 ] ; then
Usage $0 ; exit 2
fi
if [ $usefile -eq 0 -a $# -gt 2 ] ; then
Usage $0 ; exit 2
fi
if [ $usefile -eq 1 -a $# -gt 1 ] ; then
Usage $0 ; exit 2
fi
#-------------------------#
QUIET=
LIBNAME=
# Supress header.
if [ quiet -eq 1 ] ; then
QUIET="-q"
fi
if ! mkdir -m 700 $TMP ; then
echo "$0: Unable to create temp directory."
exit 2
fi
if [ $usefile -eq 1 ] ; then
# Just pass the file name to checkver.
LIBLIST="$arg1"
else
LIBLIST=$TMP/libs.lst
fi
# Build list from the installed libraries.
if [ $usedir -eq 1 ] ; then
if [ "X$1" != "X" ] ; then
libdir="$1"
fi
for f in $libdir ; do
ls $f/lib*.so.*.*
done > $LIBLIST 2> /dev/null
fi
# Build list from set lists. Parameter may be either
# the "lists" directory or the top of the source tree.
if [ $usesets -eq 1 ] ; then
if [ "X$1" != "X" ] ; then
setsdir="$1"
if [ -d "$setsdir/distrib/sets/lists" ] ; then
setsdir="$setsdir/distrib/sets/lists"
fi
fi
(cd $setsdir ;
cat */[a-z]* | grep '^./usr/lib/lib.*\.so\.[0-9][0-9]*\.[0-9][0-9]*' \
| sort -u > $LIBLIST
)
fi
if [ "X$2" != "X" ] ; then
LIBNAME="$2"
fi
EXECDIR=`eval "(cd \`dirname $0\` ; pwd)"`
CWD=`pwd`
VERFILES=`find $CWD -name shlib_version -print`
for f in $VERFILES ; do
# Call checkver. We always have a list of libraries
# here, whether given to us or built, so always
# pass the -f flag.
(cd `dirname $f` ;
"sh $EXECDIR"/checkver $QUIET -f "$LIBLIST" "$LIBNAME" ;
exit $?)
ERR=$?
if [ $ERR -eq 2 ] ; then
echo "$0: checkver failed. LIBLIST=$LIBLIST $LIBNAME=$LIBNAME"
exit 2
fi
if [ $ERR -ne 0 ] ; then
QUIET="-q"
error=1
fi
if [ "X$LIBNAME" = "X" ] ; then
# Build the library name from the directory it's in.
libname=`dirname $f`
libname=`basename $libname`
if ! echo $libname | grep -q "^lib" ; then
libname="lib$libname"
fi
else
libname="$LIBNAME"
fi
if [ -e $TMP/$libname ] ; then
echo "Warning: $libname sources encountered multiple times."
echo " Previous location: `cat $TMP/$libname`"
echo " Current location: `dirname $f`"
fi
echo "`dirname $f`" > $TMP/$libname
done
exit $error

View File

@@ -1,24 +1,21 @@
# $NetBSD: Makefile,v 1.31 2012/06/16 19:19:14 joerg Exp $
# $NetBSD: Makefile,v 1.33 2013/09/10 16:45:33 matt Exp $
.include <bsd.own.mk>
LD+= ${${HAVE_GOLD:Uno} != "no":? --script ${LDS_RELOC}:}
.if ${USE_COMPILERCRTSTUFF} != "yes"
.if defined(CSU_MACHINE_ARCH)
. if !exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
. error CSU_MACHINE_ARCH (${CSU_MACHINE_ARCH}) is unsupported
. endif
.elif exists(${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc)
CSU_MACHINE_ARCH= ${MACHINE_ARCH}
CSU_MACHINE_ARCH?= ${MACHINE_ARCH}
.if !empty(CSU_MACHINE_ARCH:Mearm*)
ARCHDIR:= ${.CURDIR}/arch/earm
.elif exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
ARCHDIR:= ${.CURDIR}/arch/${CSU_MACHINE_ARCH}
.elif exists(${.CURDIR}/arch/${MACHINE_CPU}/Makefile.inc)
CSU_MACHINE_ARCH= ${MACHINE_CPU}
ARCHDIR:= ${.CURDIR}/arch/${MACHINE_CPU}
.else
.error Architecture (${MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
.error Architecture (${CSU_MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
.endif
ARCHDIR:= ${.CURDIR}/arch/${CSU_MACHINE_ARCH}
.PATH: ${ARCHDIR}
. include "${ARCHDIR}/Makefile.inc"

View File

@@ -1,3 +1,26 @@
Introduction
This document covers the native NetBSD compiler runtime. The full support
for the native runtime is enabled by setting USE_COMPILERCRTSTUFF to no
in bsd.own.mk.
Machine independent sources can be found in common. The crtbegin.c in
that directory is a useful template for deriving compact assembler
versions. That is preferable to decouple the result from changes in the
compiler logic.
A new platform should provide the following content in
arch/${MACHINE_ARCH} or arch/${MACHINE_CPU}:
- Makefile.inc: provides ELFSIZE corresponding to 32/64bit file format.
If using the common C code instead of crtbegin.S also provide a -I option
to find crtbegin.h in your arch subdir.
- crt0.S: provides setup code and the call to ___start.
- crtbegin.S or crtbegin.h: see below
- crtend.S: see below, most likely just a copy of an existing architecture
- crti.S: prefix part of .init/.fini sections, i.e. to ensure stack alignment
- crtn.S: suffix part of the .init/.fini sections, i.e. return to caller.
Overview of the common runtime support
The common runtime support contains two modules, crtbegin and crtend.
@@ -61,3 +84,10 @@ Deinitialisation (called from .fini):
Call the pointers as void (*)(void) functions.
5. If __deregister_frame_info is NULL, return.
6. Call __deregister_frame_info with the start of .eh_frame as the argument.
Since most of this can easily be done in C code, instead of providing a
crtbegin.S you can also chose to use the generic C implementation. Provide
a crtbegin.h file instead of crtbegin.S. In there put inline assembler
stubs (mostly copied from some other arch) and implement calls to the
helper functions __do_global_ctors_aux/__do_global_dtors_aux.

View File

@@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2013/07/11 16:40:27 matt Exp $
CPPFLAGS+= -I${ARCHDIR} -DELFSIZE=64

54
lib/csu/arch/alpha/crt0.S Normal file
View File

@@ -0,0 +1,54 @@
/* $NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <alpha/asm.h>
RCSID("$NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
STRONG_ALIAS(_start,__start)
/*
* Assumes kernel (or ld_elf.so) passes the following parameters to
* user-space in registers:
*
* a0 stack pointer
* a1 cleanup
* a2 Obj_Entry
* a3 ps_strings
*/
LEAF(__start, 4)
LDGP(pv)
mov a1, a0 /* cleanup */
mov a2, a1 /* Obj_Entry */
mov a3, a2 /* ps_strings */
CALL(___start)
END(__start)

View File

@@ -0,0 +1,50 @@
/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 16:40:27 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#include <alpha/asm.h>
/* Assume we need to reload our GP. */
__asm( ".pushsection .init"
"\n\t" "br $29, 1f"
"\n\t" "1: ldgp $29, 0($29)"
"\n\t" "unop"
"\n\t" "jsr $26, __do_global_ctors_aux"
"\n\t" ".p2align 3"
"\n\t" ".popsection");
/* Assume we need to reload our GP. */
__asm( ".pushsection .fini"
"\n\t" "br $29, 1f"
"\n\t" "1: ldgp $29, 0($29)"
"\n\t" "unop"
"\n\t" "jsr $26, __do_global_dtors_aux"
"\n\t" ".p2align 3"
"\n\t" ".popsection");

View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <alpha/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 3
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.word 0
.section .dtors, "aw", @progbits
.p2align 3
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.word 0
.section .eh_frame, "a", @progbits
.p2align 3
.word 0
.section .jcr, "aw", @progbits
.p2align 3
.word 0

View File

@@ -0,0 +1,68 @@
/* $NetBSD: crtfm.c,v 1.1 2013/08/05 13:38:35 matt Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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.
*/
/*
* Support for the GCC "-ffast-math" option on the Alpha.
*/
#include <sys/types.h>
#include <machine/fpu.h>
#include <machine/sysarch.h>
/*
* Must provide this wrapper around sysarch(2) so that statically-linked
* programs work properly.
*/
extern void __alpha_sysarch(int, void *);
__asm(".ent __alpha_sysarch 0 ;\n"
"__alpha_sysarch: ;\n"
" ldiq $0, 165 ;\n" /* v0 = SYS_sysarch */
" call_pal 0x0083 ;\n" /* PAL_OSF1_callsys */
" ret $31,($26),1 ;\n"
".end __alpha_sysarch");
static void __attribute__((__constructor__))
__alpha_set_fast_math(void)
{
struct alpha_fp_c_args args;
args.fp_c = IEEE_MAP_DMZ|IEEE_MAP_UMZ;
__alpha_sysarch(ALPHA_SET_FP_C, &args);
}

55
lib/csu/arch/alpha/crti.S Normal file
View File

@@ -0,0 +1,55 @@
/* $NetBSD: crti.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <alpha/asm.h>
RCSID("$NetBSD: crti.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
#include "sysident.S"
.section ".init", "ax", @progbits
.global _init
.type _init, @function
_init:
LDGP(pv)
lda sp, -32(sp)
stq ra, 0(sp)
stq gp, 8(sp)
.p2align 5
.section ".fini", "ax", @progbits
.global _fini
.type _fini, @function
_fini:
LDGP(pv)
lda sp, -32(sp)
stq ra, 0(sp)
stq gp, 8(sp)
.p2align 5

45
lib/csu/arch/alpha/crtn.S Normal file
View File

@@ -0,0 +1,45 @@
/* $NetBSD: crtn.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <alpha/asm.h>
RCSID("$NetBSD: crtn.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
.section ".init", "ax", @progbits
ldq gp, 8(sp)
ldq ra, 0(sp)
lda sp, 32(sp)
RET
.section ".fini", "ax", @progbits
ldq gp, 8(sp)
ldq ra, 0(sp)
lda sp, 32(sp)
RET

View File

@@ -1,3 +1,7 @@
# $NetBSD: Makefile.inc,v 1.2 2012/09/16 13:46:49 skrll Exp $
# $NetBSD: Makefile.inc,v 1.7 2013/09/10 22:00:01 matt Exp $
CPPFLAGS+= -DELFSIZE=32
CPPFLAGS+= -I${ARCHDIR}
.if (!empty(CPUFLAGS) && ${CPUFLAGS:M-mabi=aapcs*} != "")
CPPFLAGS+= -DHAVE_INITFINI_ARRAY
.endif
CPPFLAGS+= -DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

View File

@@ -1,293 +0,0 @@
/* $NetBSD: crtbegin.S,v 1.4 2012/08/25 15:39:05 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arm/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.4 2012/08/25 15:39:05 matt Exp $")
.section .ctors, "aw", %progbits
.p2align 2
__CTOR_LIST__:
.word -1
.section .dtors, "aw", %progbits
.p2align 2
__DTOR_LIST__:
.word -1
.section .eh_frame, "a", %progbits
.p2align 2
__EH_FRAME_LIST__:
.section .jcr, "aw", %progbits
.p2align 2
__JCR_LIST__:
.section .data.rel, "aw", %progbits
.p2align 2
.type __dso_handle, %object
.size __dso_handle, 4
.globl __dso_handle
.hidden __dso_handle
__dso_handle:
#ifdef SHARED
.word __dso_handle
#else
.word 0
#endif
.local __dwarf_eh_object
.comm __dwarf_eh_object,24
.local __initialized
.comm __initialized,1
.local __finished
.comm __finished,1
.text
/*
* All variables are local to this DSO so we can skip using GOT references
* and instead use PCREL references to access them. We do this regardless
* of being PIC since it isn't any additional overhead to do so.
*
* We don't setup a TOC since all of ours calls are indirect so it isn't
* needed.
*/
.type __do_global_dtors_aux, %function
__do_global_dtors_aux:
GOT_INIT(r3, .Ldtors_got, .Ldtors) /* use r3 temporarily */
ldr r1, .L__finished
#ifdef PIC
ldrb r0, [r1, r3]!
#else
ldrb r0, [r1]
#endif
cmp r0, #0 /* done this already? */
RETc(ne)
mov r0, #1
strb r0, [r1] /* mark it as done */
mov ip, sp
stmfd sp!, {r4, r5, r6, r7, fp, ip, lr, pc}
sub fp, ip, #4
mov r7, r3 /* now that r7 is saved ... */
#ifdef SHARED
GOT_GET(ip, r7, .L__cxa_finalize)
cmp ip, #0
ldrne r2, .L__dso_handle /* GOTOFF */
ldrne r0, [r2, r7] /* load relative to GOT */
#ifdef _ARM_ARCH_4T
blxne ip
#else
movne lr, pc
movne pc, ip
#endif
#endif /* SHARED */
/*
* We know the first entry is -1 so skip it. We use load with
* preincrement to advance the pointer along.
*/
ldr r4, .L__DTOR_LIST__
ldr r5, .L__DTOR_LIST_END__
#ifdef PIC
add r4, r4, r7 /* addr = offset + got */
add r5, r5, r7 /* addr = offset + got */
#endif
add r4, r4, #4 /* skip first entry */
1:
cmp r4, r5 /* end of list */
ldrne ip, [r4], #4 /* ip = *r4++; */
#ifndef SHARED
ldmeqfd sp, {r4, r5, r6, r7, fp, sp, pc} /* restore and return */
#endif
adrne lr, 1b /* set up to return to loop start */
#ifdef _ARM_ARCH_4T
bxne ip /* call it */
#else
movne pc, ip /* call entry */
#endif
#ifdef SHARED
/*
* if (__deregister_frame_info)
* __deregister_frame_info(&__EH_FRAME_LIST__[0]);
*/
GOT_GET(ip, r7, .L__deregister_frame_info)
cmp ip, #0
ldmeqfd sp, {r4-r7, fp, sp, pc} /* restore and return */
ldr r1, .L__EH_FRAME_LIST__
#ifdef PIC
add r0, r1, r7 /* add offset to GOT addr */
#endif
ldmfd sp, {r4-r7, fp, sp, lr} /* restore everthing */
#ifdef _ARM_ARCH_4T
bx ip /* tail call it */
#else
mov pc, ip /* tail call it */
#endif
#endif /* SHARED */
.weak __deregister_frame_info
.weak __cxa_finalize
.hidden _C_LABEL(__DTOR_LIST_END__)
.align 2
GOT_INITSYM(.Ldtors_got, .Ldtors)
#ifdef SHARED
.L__deregister_frame_info:
.word PIC_SYM(_C_LABEL(__deregister_frame_info), GOT)
.L__cxa_finalize:
.word PIC_SYM(_C_LABEL(__cxa_finalize), GOT)
.L__dso_handle:
.word PIC_SYM(_C_LABEL(__dso_handle), GOTOFF)
#endif
.L__finished:
.word PIC_SYM(_C_LABEL(__finished), GOTOFF)
.L__DTOR_LIST__:
.word PIC_SYM(_C_LABEL(__DTOR_LIST__), GOTOFF)
.L__DTOR_LIST_END__:
.word PIC_SYM(_C_LABEL(__DTOR_LIST_END__), GOTOFF)
.L__EH_FRAME_LIST__:
.word PIC_SYM(_C_LABEL(__EH_FRAME_LIST__), GOTOFF)
.weak __register_frame_info
.weak _Jv_RegisterClasses
.type __do_global_ctors_aux, %function
__do_global_ctors_aux:
GOT_INIT(r3, .Lctors_got, .Lctors)
ldr r1, .L__initialized
#ifdef PIC
ldrb r0, [r1, r3]!
#else
ldrb r0, [r1]
#endif
cmp r0, #0 /* done this already? */
RETc(ne)
mov r0, #1
strb r0, [r1] /* mark it as done */
mov ip, sp
stmfd sp!, {r4, r5, r6, r7, fp, ip, lr, pc}
sub fp, ip, #4
mov r7, r3 /* now that r7 is saved ... */
/*
* if (__register_frame_info)
* __register_frame_info(&__EH_FRAME_LIST__[0], &__dwarf_eh_object)
*/
GOT_GET(ip, r7, .L__register_frame_info)
cmp ip, #0
beq 1f
ldr r0, .L__EH_FRAME_LIST__
ldr r1, .L__dwarf_eh_object
#ifdef PIC
add r0, r0, r7 /* object addr = got addr + offset */
add r1, r1, r7 /* object addr = got addr + offset */
#endif
#ifdef _ARM_ARCH_4T
blx ip
#else
mov lr, pc
mov pc, ip
#endif
1:
/*
* if (_Jv_RegisterClasses && __JCR_LIST__[0])
* _Jv_RegisterClasses(&__JCR_LIST__[0]);
*/
GOT_GET(ip, r7, .L_Jv_RegisterClasses)
cmp ip, #0
ldrne r0, .L__JCR_LIST__
#ifdef PIC
ldrne r2, [r0, r7]! /* load 1st one, make r0 point to it */
#else
ldrne r2, [r0] /* load 1st one */
#endif
cmpne r2, #0
#ifdef _ARM_ARCH_4T
blxne ip
#else
movne lr, pc
movne pc, ip
#endif
/*
* Get the start and end of the CTOR list.
*/
ldr r4, .L__CTOR_LIST__
ldr r5, .L__CTOR_LIST_END__
#ifdef PIC
add r4, r4, r7 /* object addr = got addr + offset */
add r5, r5, r7 /* object addr = got addr + offset */
#endif
sub r5, r5, #4 /* ignore first entry */
3:
cmp r4, r5 /* at first entry? */
ldmeqfd sp, {r4-r7, fp, sp, pc} /* then return */
adr lr, 3b /* return to start of loop */
ldr ip, [r5], #-4 /* get entry */
#ifdef _ARM_ARCH_4T
bx ip
#else
mov pc, ip /* get entry */
#endif
.hidden _C_LABEL(__CTOR_LIST_END__)
.align 2
GOT_INITSYM(.Lctors_got, .Lctors)
.L_Jv_RegisterClasses:
.word PIC_SYM(_C_LABEL(_Jv_RegisterClasses), GOT)
.L__register_frame_info:
.word PIC_SYM(_C_LABEL(__register_frame_info), GOT)
.L__initialized:
.word PIC_SYM(_C_LABEL(__initialized), GOTOFF)
.L__CTOR_LIST__:
.word PIC_SYM(_C_LABEL(__CTOR_LIST__), GOTOFF)
.L__CTOR_LIST_END__:
.word PIC_SYM(_C_LABEL(__CTOR_LIST_END__), GOTOFF)
.L__dwarf_eh_object:
.word PIC_SYM(_C_LABEL(__dwarf_eh_object), GOTOFF)
.L__JCR_LIST__:
.word PIC_SYM(_C_LABEL(__JCR_LIST__), GOTOFF)
.section .init, "ax", %progbits
bl __do_global_ctors_aux
.section .fini, "ax", %progbits
bl __do_global_dtors_aux

View File

@@ -0,0 +1,38 @@
/* $NetBSD: crtbegin.h,v 1.1 2013/06/27 21:24:39 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm(
".pushsection .init, \"ax\", %progbits"
"\n\t" "bl __do_global_ctors_aux"
"\n\t" ".popsection");
__asm(
".pushsection .fini, \"ax\", %progbits"
"\n\t" "bl __do_global_dtors_aux"
"\n\t" ".popsection");

View File

@@ -1,5 +1,5 @@
# $NetBSD: Makefile.inc,v 1.1 2012/08/13 02:49:04 matt Exp $
# $NetBSD: Makefile.inc,v 1.3 2013/09/10 16:45:33 matt Exp $
CPPFLAGS+= -DELFSIZE=32
CPPFLAGS+= -I${ARCHDIR}
CPPFLAGS+= -DHAVE_INITFINI_ARRAY
CPPFLAGS+= -DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crt0.S,v 1.1 2012/08/13 02:49:04 matt Exp $ */
/* $NetBSD: crt0.S,v 1.3 2013/09/05 00:27:38 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <arm/asm.h>
RCSID("$NetBSD: crt0.S,v 1.1 2012/08/13 02:49:04 matt Exp $")
RCSID("$NetBSD: crt0.S,v 1.3 2013/09/05 00:27:38 matt Exp $")
STRONG_ALIAS(_start,__start)
@@ -44,7 +44,14 @@ _ENTRY(__start)
mov r2, ip /* tmp -> ps_strings */
/* Ensure the stack is properly aligned before calling C code. */
#if !defined(__thumb__)
bic sp, sp, #7
#else
movs r6, #7
mov r7, sp
bics r7, r7, r6
mov sp, r7
#endif
/*
* void ___start(void (*cleanup)(void),

View File

@@ -1,216 +0,0 @@
/* $NetBSD: crtbegin.S,v 1.1 2012/08/13 02:49:04 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arm/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.1 2012/08/13 02:49:04 matt Exp $")
.section .eh_frame, "a", %progbits
.p2align 2
__EH_FRAME_LIST__:
.section .jcr, "aw", %progbits
.p2align 2
__JCR_LIST__:
.section .data.rel, "aw", %progbits
.p2align 2
.type __dso_handle, %object
.size __dso_handle, 4
.globl __dso_handle
.hidden __dso_handle
__dso_handle:
#ifdef SHARED
.word __dso_handle
#else
.word 0
#endif
.text
#ifdef SHARED
/*
* If we aren't shared, all we do is set finished
* to 1 if it isn't 1 already. So why bother do that at all?
*/
.type __do_global_dtors_aux, %function
__do_global_dtors_aux:
GOT_INIT(r3, .Ldtors_got, .Ldtors) /* use r3 temporarily */
ldr r1, .L__finished /* GOTOFF */
ldrb r0, [r1, r3]!
cmp r0, #0 /* done this already? */
RETc(ne)
mov r0, #1
strb r0, [r1] /* mark it as done */
GOT_GET(ip, r3, .L__cxa_finalize)
cmp ip, #0
RETc(eq)
ldr r0, .L__dso_handle /* GOTOFF */
ldr r0, [r0, r3] /* load relative to got */
#if defined(_ARM_ARCH_4T)
bx ip /* tail call */
#else
mov pc, ip
#endif
#if 0 /* not used */
/*
* if (__deregister_frame_info)
* __deregister_frame_info(&__EH_FRAME_LIST__[0]);
*/
GOT_GET(ip, r3, .L__deregister_frame_info)
cmp ip, #0
ldmeqfd sp, {r4, r5, fp, sp, pc} /* restore and return */
ldr r1, .L__EH_FRAME_LIST__ /* GOTOFF */
add r1, r1, r4 /* add got addr */
ldmfd sp, {r4, r5, fp, sp, lr} /* restore everthing */
#if !defined(_ARM_ARCH_4T)
bx ip /* tail call it */
#else
mov pc, ip /* tail call it */
#endif
#endif /* notused */
.weak __cxa_finalize
.weak __deregister_frame_info
.align 2
GOT_INITSYM(.Ldtors_got, .Ldtors)
.L__cxa_finalize:
.word PIC_SYM(_C_LABEL(__cxa_finalize), GOT)
#if 0
.L__deregister_frame_info:
.word PIC_SYM(_C_LABEL(__deregister_frame_info), GOT)
#endif
.L__finished:
.word PIC_SYM(_C_LABEL(__finished), GOTOFF)
.L__dso_handle:
.word PIC_SYM(_C_LABEL(__dso_handle), GOTOFF)
.pushsection .fini_array,"aw",%fini_array
.p2align 2
.word __do_global_dtors_aux
.popsection
#endif /* SHARED */
.local __finished
.comm __finished,1,1
.weak __register_frame_info
.weak _Jv_RegisterClasses
.type __do_global_ctors_aux, %function
__do_global_ctors_aux:
GOT_INIT(r3, .Lctors_got, .Lctors)
ldr r1, .L__initialized /* GOTOFF if PIC */
#ifdef PIC
ldrb r0, [r1, r3]! /* r1 = r1 + got */
#else
ldrb r0, [r1]
#endif
cmp r0, #0 /* done this already? */
RETc(ne)
mov r0, #1
strb r0, [r1] /* mark it as done */
mov ip, sp
stmfd sp!, {r4, r5, fp, ip, lr, pc}
sub fp, ip, #4
mov r4, r3 /* now that r4 is saved ... */
/*
* if (__register_frame_info)
* __register_frame_info(&__EH_FRAME_LIST__[0], &__dwarf_eh_object)
*/
GOT_GET(ip, r4, .L__register_frame_info)
cmp ip, #0
beq 1f
ldr r0, .L__EH_FRAME_LIST__
ldr r1, .L__dwarf_eh_object
#ifdef PIC
add r0, r0, r4
add r1, r1, r4
#endif
#if defined(_ARM_ARCH_4T)
blx ip
#else
mov lr, pc
mov pc, ip
#endif
1:
/*
* if (_Jv_RegisterClasses && __JCR_LIST__[0])
* _Jv_RegisterClasses(&__JCR_LIST__[0]);
*/
GOT_GET(ip, r4, .L_Jv_RegisterClasses)
cmp ip, #0
ldmeqfd sp, {r4, r5, fp, sp, pc} /* return if null */
ldr r0, .L__JCR_LIST__
#ifdef PIC
ldr r2, [r0, r4]! /* GOTOFF + got == address */
#else
ldr r2, [r0]
#endif
cmp r2, #0
ldmfd sp, {r4, r5, fp, sp, lr} /* restore everything */
RETc(eq) /* return if null */
#if defined(_ARM_ARCH_4T)
bx ip /* return or tail call */
#else
mov pc, ip /* return or tail call */
#endif
.p2align 2
GOT_INITSYM(.Lctors_got, .Lctors)
.L__register_frame_info:
.word PIC_SYM(_C_LABEL(__register_frame_info), GOT)
.L_Jv_RegisterClasses:
.word PIC_SYM(_C_LABEL(_Jv_RegisterClasses), GOT)
.L__initialized:
.word PIC_SYM(_C_LABEL(__initialized), GOTOFF)
.L__EH_FRAME_LIST__:
.word PIC_SYM(_C_LABEL(__EH_FRAME_LIST__), GOTOFF)
.L__dwarf_eh_object:
.word PIC_SYM(_C_LABEL(__dwarf_eh_object), GOTOFF)
.L__JCR_LIST__:
.word PIC_SYM(_C_LABEL(__JCR_LIST__), GOTOFF)
.local __initialized
.comm __initialized,1,1
.local __dwarf_eh_object
.comm __dwarf_eh_object,24,4
.section .init_array,"aw",%init_array
.p2align 2
.word __do_global_ctors_aux

View File

@@ -0,0 +1,50 @@
/* $NetBSD: crtbegin.h,v 1.1 2013/06/27 21:24:39 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
static void __do_global_ctors_aux(void) __attribute__((__constructor__)) __used;
#ifdef SHARED
static void __do_global_dtors_aux(void) __attribute__((__destructor__)) __used;
#endif
#ifndef SHARED
static const void *find_exidx(void *, int *) __used;
static const void *
find_exidx(void * pc, int * pcount)
{
extern __dso_hidden const char __exidx_start[];
extern __dso_hidden const char __exidx_end[];
*pcount = (__exidx_end - __exidx_start) / 8;
return __exidx_start;
}
__weak_alias(__gnu_Uwind_find_exidx,find_exidx)
#endif /* !SHARED */

View File

@@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2013/07/13 18:52:35 skrll Exp $
CPPFLAGS+= -DELFSIZE=32 -I${ARCHDIR}

67
lib/csu/arch/hppa/crt0.S Normal file
View File

@@ -0,0 +1,67 @@
/* $NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nick Hudson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
.import _GLOBAL_OFFSET_TABLE_
.hidden ___start
STRONG_ALIAS(__start,_start)
/*
* void _start(struct ps_strings *ps_strings,
* void (*cleanup)(void),
* const Obj_Entry *obj);
*/
_ENTRY(_start)
.callinfo frame=0, calls
.entry
bl L$lpc, %r27
depi 0, 31, 2, %r27
L$lpc: addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8), %r27
ldo R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%r1),%r27
copy %r27, %r19
/*
* void ___start(void (*cleanup)(void),
* const Obj_Entry *obj,
* struct ps_strings *ps_strings);
*/
copy %arg0, %arg3 ; ps_strings -> tmp
copy %arg1, %arg0 ; cleanup -> arg0
copy %arg2, %arg1 ; obj -> arg1
b ___start
copy %arg3, %arg2 ; ps_strings (tmp) -> arg2
EXIT(_start)

View File

@@ -0,0 +1,43 @@
/* $NetBSD*/
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nick Hudson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( "\n\t"
".pushsection .init, \"ax\", @progbits" "\n\t"
"bl __do_global_ctors_aux, %rp" "\n\t"
" nop" "\n\t"
".popsection");
__asm( "\n\t"
".pushsection .fini, \"ax\", @progbits" "\n\t"
"bl __do_global_dtors_aux, %rp" "\n\t"
" nop" "\n\t"
".popsection");

View File

@@ -0,0 +1,56 @@
/* $NetBSD: crtend.S,v 1.1 2013/07/13 18:52:35 skrll Exp $ */
/*-
* Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
.section .ctors, "aw", @progbits
.align 4
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.long 0
.section .dtors, "aw", @progbits
.align 4
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.long 0
.section .eh_frame, "a", @progbits
.align 4
.long 0
.section .jcr, "aw", @progbits
.align 4
.long 0

55
lib/csu/arch/hppa/crti.S Normal file
View File

@@ -0,0 +1,55 @@
/* $NetBSD: crti.S,v 1.1 2013/07/13 18:52:35 skrll Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nick Hudson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crti.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
#include "sysident.S"
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
.section sect,"ax",@progbits ! \
.global entry_pt ! \
.proc ! \
.callinfo frame=HPPA_FRAME_SIZE, calls, save_rp, save_sp, entry_gr=3 ! \
.entry ! \
entry_pt: ! \
stw %rp, HPPA_FRAME_CRP(%sp) ! \
copy %r3, %r1 ! \
copy %sp, %r3 ! \
stw,ma %r1, HPPA_FRAME_SIZE(%sp) ! \
/* fall thru */ ! \
.exit ! \
.procend ! \
.previous
MD_SECTION_PROLOGUE(.init, _init)
MD_SECTION_PROLOGUE(.fini, _fini)

46
lib/csu/arch/hppa/crtn.S Normal file
View File

@@ -0,0 +1,46 @@
/* $NetBSD: crtn.S,v 1.1 2013/07/13 18:52:35 skrll Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nick Hudson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtn.S,v 1.1 2013/07/13 18:52:35 skrll Exp $")
#define MD_SECTION_EPILOGUE(sect) \
.section #sect,"ax",@progbits ! \
ldw HPPA_FRAME_CRP(%r3) ,%rp ! \
ldo HPPA_FRAME_SIZE(%r3), %sp ! \
ldw,mb -HPPA_FRAME_SIZE(%sp), %r3 ! \
bv,n %r0(%rp) ! \
.previous
MD_SECTION_EPILOGUE(.init)
MD_SECTION_EPILOGUE(.fini)

View File

@@ -1,5 +1,5 @@
# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
# $NetBSD: Makefile.inc,v 1.2 2013/07/11 17:07:35 matt Exp $
CPPFLAGS+= -DELFSIZE=32
CPPFLAGS+= -I${ARCHDIR} -DELFSIZE=32

View File

@@ -35,18 +35,14 @@
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
RCSID("$NetBSD: crt0.S,v 1.4 2013/07/26 19:49:19 matt Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
movl (%sp),%d0
movl %a2,-(%sp) | ps_strings
movl %a0,-(%sp) | obj
movl %a1,-(%sp) | cleanup
movl %d0,%d1
lsll #2,%d1
pea (16+4)(%sp,%d1.l) | envp = &argv[argc + 1]
pea 20(%sp) | argv
movl %d0,-(%sp) | argc
jsr ___start
| call: ___start(cleanup, obj, ps_strings)
jbsr ___start
END(__start)

View File

@@ -0,0 +1,45 @@
/* $NetBSD: crtbegin.h,v 1.4 2013/07/27 13:07:06 martin Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( ".pushsection .init"
#ifdef __pic__
"\n\t" "bsrl __do_global_ctors_aux"
#else
"\n\t" "jsr __do_global_ctors_aux"
#endif
"\n\t" ".popsection");
__asm( ".pushsection .fini"
#ifdef __pic__
"\n\t" "bsrl __do_global_dtors_aux"
#else
"\n\t" "jsr __do_global_dtors_aux"
#endif
"\n\t" ".popsection");

View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.1 2013/07/11 17:07:35 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <m68k/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 17:07:35 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 2
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.long 0
.section .dtors, "aw", @progbits
.p2align 2
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.long 0
.section .eh_frame, "a", @progbits
.p2align 2
.long 0
.section .jcr, "aw", @progbits
.p2align 2
.long 0

View File

@@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.2 2013/07/10 15:05:46 matt Exp $
CPPFLAGS+= -I${ARCHDIR} -DELFSIZE=_MIPS_SZPTR

58
lib/csu/arch/mips/crt0.S Normal file
View File

@@ -0,0 +1,58 @@
/* $NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mips/asm.h>
RCSID("$NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $")
STRONG_ALIAS(_start,__start)
/*
* Assumes kernel (or ld_elf.so) passes the following parameters to
* user-space in registers:
*
* a0 stack pointer (0 if setregs didn't fill this in)
* a1 cleanup
* a2 Obj_Entry
* a3 ps_strings
*
* XXX Does this violate the ABI?
* as well as the usual registers (pc, sp, and t9 == pc for ABI).
*/
NESTED_NOPROFILE(__start, CALLFRAME_SIZ, ra)
SETUP_GP
SETUP_GP64(t3, __start)
move a0, a1 /* cleanup */
move a1, a2 /* Obj_Entry */
move a2, a3 /* ps_strings */
j _C_LABEL(___start)
END(__start)

View File

@@ -0,0 +1,66 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( "\n\t"
".pushsection .init, \"ax\", @progbits" "\n\t"
#ifdef __mips_o32
".set noreorder" "\n\t"
".set nomacro" "\n\t"
"move $28,$16" "\n\t"
"lw $25,%got(__do_global_ctors_aux)($28)" "\n\t"
"nop" "\n\t"
"addiu $25,$25,%lo(__do_global_ctors_aux)" "\n\t"
".reloc 1f,R_MIPS_JALR,__do_global_ctors_aux" "\n\t"
"1: jalr $25" "\n\t"
"nop" "\n\t"
".set macro" "\n\t"
".set reorder" "\n\t"
#else
"jal __do_global_ctors_aux" "\n\t"
#endif
".popsection");
__asm( "\n\t"
".pushsection .fini, \"ax\", @progbits" "\n\t"
#ifdef __mips_o32
".set noreorder" "\n\t"
".set nomacro" "\n\t"
"move $28,$16" "\n\t"
"lw $25,%got(__do_global_dtors_aux)($28)" "\n\t"
"nop" "\n\t"
"addiu $25,$25,%lo(__do_global_dtors_aux)" "\n\t"
".reloc 1f,R_MIPS_JALR,__do_global_dtors_aux" "\n\t"
"1: jalr $25" "\n\t"
"nop" "\n\t"
".set macro" "\n\t"
".set reorder" "\n\t"
#else
"jal __do_global_dtors_aux" "\n\t"
#endif
".popsection");

View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mips/asm.h>
RCSID("$NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $")
.section .ctors, "aw", @progbits
.p2align PTR_SCALESHIFT
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.word 0
.section .dtors, "aw", @progbits
.p2align PTR_SCALESHIFT
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.word 0
.section .eh_frame, "aw", @progbits
.p2align PTR_SCALESHIFT
.space _MIPS_SZPTR / 8
.section .jcr, "aw", @progbits
.p2align PTR_SCALESHIFT
.space _MIPS_SZPTR / 8

60
lib/csu/arch/mips/crti.S Normal file
View File

@@ -0,0 +1,60 @@
/* $NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mips/asm.h>
RCSID("$NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $")
#include "sysident.S"
.section ".init", "ax", @progbits
NESTED_NOPROFILE(_init, CALLFRAME_SIZ, ra)
SETUP_GP
PTR_SUBU sp, sp, CALLFRAME_SIZ # allocate stack frame
REG_S ra, CALLFRAME_RA(sp) # save RA
#ifdef __mips_o32
REG_S s0, CALLFRAME_S0(sp) # save s0
move s0, gp
#endif
SETUP_GP64(CALLFRAME_GP, _init)
END(_init)
.section ".fini", "ax", @progbits
NESTED_NOPROFILE(_fini, CALLFRAME_SIZ, ra)
SETUP_GP
PTR_SUBU sp, sp, CALLFRAME_SIZ # allocate stack frame
REG_S ra, CALLFRAME_RA(sp) # save RA
#ifdef __mips_o32
REG_S s0, CALLFRAME_S0(sp) # save s0
move s0, gp
#endif
SETUP_GP64(CALLFRAME_GP, _fini)
END(_fini)

52
lib/csu/arch/mips/crtn.S Normal file
View File

@@ -0,0 +1,52 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mips/asm.h>
RCSID("$NetBSD: crtn.S,v 1.2 2013/06/30 08:00:34 matt Exp $")
.section ".init", "ax", @progbits
REG_L ra, CALLFRAME_RA(sp)
#if defined(__mips_o32) || defined(__mips_o64)
REG_L s0, CALLFRAME_S0(sp)
#else
REG_L gp, CALLFRAME_GP(sp)
#endif
PTR_ADDU sp, sp, CALLFRAME_SIZ
jr ra
.section ".fini", "ax", @progbits
REG_L ra, CALLFRAME_RA(sp)
#ifdef __mips_o32
REG_L s0, CALLFRAME_S0(sp)
#else
REG_L gp, CALLFRAME_GP(sp)
#endif
PTR_ADDU sp, sp, CALLFRAME_SIZ
jr ra

View File

@@ -1,5 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2011/02/08 02:02:25 matt Exp $
CPPFLAGS+= -DELFSIZE=32
# $NetBSD: Makefile.inc,v 1.2 2013/06/27 21:24:39 matt Exp $
CPPFLAGS+= -I${ARCHDIR}

View File

@@ -1,268 +0,0 @@
/* $NetBSD: crtbegin.S,v 1.2 2011/07/04 21:55:09 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <powerpc/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.2 2011/07/04 21:55:09 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 2
__CTOR_LIST__:
.long -1
.section .dtors, "aw", @progbits
.p2align 2
__DTOR_LIST__:
.long -1
.section .eh_frame, "a", @progbits
.p2align 2
__EH_FRAME_LIST__:
.section .jcr, "aw", @progbits
.p2align 2
__JCR_LIST__:
.section ".got2","aw", @progbits
.LCTOC = . + 32768
.section .data.rel, "aw", @progbits
.p2align 2
.type __dso_handle, @object
.size __dso_handle, 4
.globl __dso_handle
.hidden __dso_handle
__dso_handle:
#ifdef SHARED
.long __dso_handle
#else
.long 0
#endif
.lcomm __dwarf_eh_object,8*SZREG,SZREG
.lcomm __initialized,1,1
.lcomm __finished,1,1
.text
.weak __cxa_finalize
.weak __deregister_frame_info
.weak __register_frame_info
.weak _Jv_RegisterClasses
/*
* All variables are local to this DSO so we can skip using GOT references
* and instead use PCREL references to access them. We do this regardless
* of being PIC since it isn't any additional overhead to do so.
*
* We don't setup a TOC since all of ours calls are indirect so it isn't
* needed.
*/
__do_global_dtors_aux:
mflr %r7 /* save return address */
bcl 20,31,1f /* find out what address */
1: mflr %r3 /* we are at */
mtlr %r7 /* restore return address */
addis %r4,%r3,__finished-1b@ha /* PCREL ref (upper) */
lbzu %r0,__finished-1b@l(%r4) /* PCREL ref (lower) & load */
cmpwi %r0,0 /* done this already? */
bnelr /* yep, return */
li %r0, 1
stb %r0, 0(%r4) /* remember we've done this */
stw %r7,(1*SZREG)(%r1) /* save LR */
stwu %r1,-(8*SZREG)(%r1) /* alloc our stack frame */
stw %r31,(7*SZREG)(%r1) /* save some registers */
stw %r30,(6*SZREG)(%r1)
stw %r29,(5*SZREG)(%r1)
stw %r28,(4*SZREG)(%r1)
mr %r29,%r3 /* move this to a safe place */
/*
* Get a reference to our TOC.
*/
addis %r30,%r29,.LCTOC-1b@ha
addi %r30,%r30,.LCTOC-1b@l
/*
* Get a reference to the GOT.
*/
addis %r31,%r29,_GLOBAL_OFFSET_TABLE_-1b@ha /* pcrel (hi) */
addi %r31,%r31,_GLOBAL_OFFSET_TABLE_-1b@l /* pcrel (lo) */
#ifdef SHARED
/*
* if (__cxa_finalize)
* __cxa_finalize(&__dso_handle);
*/
lwz %r0, __cxa_finalize@got(%r31)
cmpwi %r0, 0
beq 2f
addis %r3,%r29,__dso_handle-1b@ha /* get &__dso_handle (pcrel) */
addi %r3,%r3,__dso_handle-1b@l
mtctr %r0 /* setup for indirect branch */
bctrl /* and call the routine */
2:
#endif
addis %r28,%r29,__DTOR_LIST__-1b@ha /* get &__DTOR_LIST__ */
addi %r28,%r28,__DTOR_LIST__-1b@l
/*
* We know the first entry is -1 so skip it. We use load with update
* to advance the pointer along.
*/
3:
lwzu %r0, 4(%r28) /* get entry */
cmpwi %r0, 0 /* end of list? */
beq 4f /* yep. */
mtctr %r0 /* setup for indirect branch */
bctrl /* and call the routine */
b 3b /* do it again */
4:
/*
* if (__deregister_frame_info)
* __deregister_frame_info(&__EH_FRAME_LIST__[0]);
*/
lwz %r0,__deregister_frame_info@got(%r31)
cmpwi %r0, 0 /* routine actually exist? */
beq 5f /* nope, skip call */
addis %r3,%r29,__EH_FRAME_LIST__-1b@ha
addi %r3,%r3,__EH_FRAME_LIST__-1b@l
mtctr %r0 /* setup for indirect branch */
bctrl /* and call the routine */
5:
lwz %r28,(4*SZREG)(%r1) /* restore registers */
lwz %r29,(5*SZREG)(%r1)
lwz %r30,(6*SZREG)(%r1)
lwz %r31,(7*SZREG)(%r1)
addi %r1,%r1,8*SZREG /* adjust stack */
lwz %r0,(1*SZREG)(%r1) /* get return addr */
mtlr %r0
blr /* and return */
__do_global_ctors_aux:
mflr %r7 /* save return address */
bcl 20,31,1f /* find out what address */
1: mflr %r3 /* we are at */
mtlr %r7 /* restore return address */
addis %r4,%r3,__initialized-1b@ha /* pcrel (hi) */
lbzu %r0,__initialized-1b@l(%r4) /* pcrel (lo) load+update */
cmpwi %r0,0 /* have we already done this? */
bnelr /* yep, return */
li %r0,1
stb %r0,0(%r4) /* remember we've been here */
stw %r7,(1*SZREG)(%r1) /* save LR */
stwu %r1,-(8*SZREG)(%r1) /* alloc our stack frame */
stw %r31,(7*SZREG)(%r1) /* save some registers */
stw %r30,(6*SZREG)(%r1)
stw %r29,(5*SZREG)(%r1)
stw %r28,(4*SZREG)(%r1)
mr %r29,%r3 /* move this to a safe place */
/*
* Get a reference to our TOC.
*/
addis %r30,%r29,.LCTOC-1b@ha
addi %r30,%r30,.LCTOC-1b@l
/*
* Get a reference to the GOT.
*/
addis %r31,%r29,_GLOBAL_OFFSET_TABLE_-1b@ha /* pcrel (hi) */
addi %r31,%r31,_GLOBAL_OFFSET_TABLE_-1b@l /* pcrel (lo) */
/*
* if (__register_frame_info)
* __register_frame_info(&__EH_FRAME_LIST__[0], &__dwarf_eh_object)
*/
lwz %r0, __register_frame_info@got(%r31)
cmpwi %r0, 0
beq 2f
addis %r3,%r29,__EH_FRAME_LIST__-1b@ha /* pcrel (hi) */
addi %r3,%r3,__EH_FRAME_LIST__-1b@l /* pcrel (lo) */
addis %r4,%r29,__dwarf_eh_object-1b@ha /* pcrel (hi) */
addi %r4,%r4,__dwarf_eh_object-1b@l /* pcrel (lo) */
mtctr %r0 /* setup for indirect branch */
bctrl /* and call the routine */
2:
/*
* if (_Jv_RegisterClasses && __JCR_LIST__[0])
* _Jv_RegisterClasses(&__JCR_LIST__[0]);
*/
lwz %r0, _Jv_RegisterClasses@got(%r31)
cmpwi %r0, 0
beq 3f
mtctr %r0 /* setup for indirect branch */
addis %r3, %r29, __JCR_LIST__-1b@ha /* pcrel (hi) */
addi %r3, %r3, __JCR_LIST__-1b@l /* pcrel (lo) */
lwz %r4, 0(%r3) /* load first entry */
cmpwi %r4, 0 /* is the list empty? */
bnectrl /* call the routine if not */
3:
/*
* Get end of list of CTOR list.
*/
addis %r28,%r29,__CTOR_LIST_END__-1b@ha
addi %r28,%r28,__CTOR_LIST_END__-1b@l
4:
lwzu %r0, -4(%r28) /* get entry */
cmpwi %r0, -1 /* first entry? */
beq 5f /* yes, we're done */
mtctr %r0 /* setup for indirect branch */
bctrl /* call the routine */
b 4b /* do it again */
5:
lwz %r28,(4*SZREG)(%r1) /* restore registers */
lwz %r29,(5*SZREG)(%r1)
lwz %r30,(6*SZREG)(%r1)
lwz %r31,(7*SZREG)(%r1)
addi %r1,%r1,8*SZREG /* adjust stack */
lwz %r0,(1*SZREG)(%r1) /* get return addr */
mtlr %r0
blr /* and return */
.section .init, "ax", @progbits
bl __do_global_ctors_aux
.section .fini, "ax", @progbits
bl __do_global_dtors_aux

View File

@@ -0,0 +1,36 @@
/* $NetBSD: crtbegin.h,v 1.1 2013/06/27 21:24:39 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( ".pushsection .init, \"ax\", @progbits"
"\n\t" "bl __do_global_ctors_aux"
"\n\t" ".popsection");
__asm( ".pushsection .fini, \"ax\", @progbits"
"\n\t" "bl __do_global_dtors_aux"
"\n\t" ".popsection");

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crtend.S,v 1.1 2011/02/08 02:02:25 matt Exp $ */
/* $NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -30,7 +30,7 @@
#include <powerpc/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2011/02/08 02:02:25 matt Exp $")
RCSID("$NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 2
@@ -41,6 +41,9 @@ __CTOR_LIST_END__:
.section .dtors, "aw", @progbits
.p2align 2
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.long 0
.section .eh_frame, "a", @progbits

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crtbegin.S,v 1.2 2012/06/02 22:15:15 uwe Exp $ */
/* $NetBSD: crtbegin.S,v 1.3 2013/09/12 15:36:14 joerg Exp $ */
/*-
* Copyright (c) 2012 Valeriy E. Ushakov
* All rights reserved.
@@ -30,7 +30,7 @@
#include <machine/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.2 2012/06/02 22:15:15 uwe Exp $")
RCSID("$NetBSD: crtbegin.S,v 1.3 2013/09/12 15:36:14 joerg Exp $")
.section .ctors, "aw", @progbits
.p2align 2
@@ -84,7 +84,7 @@ __finished:
* address and only r0 can be used in @(r0, Rm) addressing mode, so we
* always load variable address to r0.
*/
#ifdef PIC
#ifdef __PIC__
#define VAR_DATUM(var) var@GOTOFF
#define FUNC_DATUM(f) f@GOT
#define R0VAR (r0, r12)
@@ -98,7 +98,7 @@ __finished:
__do_global_ctors_aux:
mov.l r8, @-sp
mov.l r9, @-sp
#ifdef PIC
#ifdef __PIC__
mov.l r12, @-sp
mov.l .Lc_got, r12
mova .Lc_got, r0
@@ -121,7 +121,7 @@ __do_global_ctors_aux:
!! if (__register_frame_info)
!! __register_frame_info(&__EH_FRAME_LIST__[0], &__dwarf_eh_object)
#ifdef PIC
#ifdef __PIC__
mov.l .Lc___register_frame_info_GOT, r0
mov.l @R0VAR, r1
tst r1, r1
@@ -146,7 +146,7 @@ __do_global_ctors_aux:
!! if (_Jv_RegisterClasses && __JCR_LIST__[0])
!! _Jv_RegisterClasses(&__JCR_LIST__[0]);
#ifdef PIC
#ifdef __PIC__
mov.l .Lc__Jv_RegisterClasses_GOT, r0
mov.l @R0VAR, r1
tst r1, r1
@@ -183,7 +183,7 @@ __do_global_ctors_aux:
!! call all constructors on __CTOR_LIST__ in reverse order
mov.l .Lc___CTOR_LIST_END__, r8
#ifdef PIC
#ifdef __PIC__
add r12, r8
#endif
add #-4, r8
@@ -203,7 +203,7 @@ __do_global_ctors_aux:
mov r14, sp
lds.l @sp+, pr
mov.l @sp+, r14
#ifdef PIC
#ifdef __PIC__
mov.l @sp+, r12
#endif
mov.l @sp+, r9
@@ -215,7 +215,7 @@ __do_global_ctors_aux:
PIC_GOT_DATUM
.Lc___initialized:
.long VAR_DATUM(__initialized)
#ifdef PIC
#ifdef __PIC__
.Lc___register_frame_info_GOT:
.long __register_frame_info@GOT
#endif
@@ -225,7 +225,7 @@ __do_global_ctors_aux:
.long VAR_DATUM(__EH_FRAME_LIST__)
.Lc___dwarf_eh_object:
.long VAR_DATUM(__dwarf_eh_object)
#ifdef PIC
#ifdef __PIC__
.Lc__Jv_RegisterClasses_GOT:
.long _Jv_RegisterClasses@GOT
#endif
@@ -240,7 +240,7 @@ __do_global_ctors_aux:
__do_global_dtors_aux:
mov.l r8, @-sp
mov.l r9, @-sp
#ifdef PIC
#ifdef __PIC__
mov.l r12, @-sp
mov.l .Ld_got, r12
mova .Ld_got, r0
@@ -277,7 +277,7 @@ __do_global_dtors_aux:
!! call all destructors on __DTOR_LIST__
mov.l .Ld___DTOR_LIST__, r8
#ifdef PIC
#ifdef __PIC__
add r12, r8
#endif
add #4, r8 ! skip first entry that we know to be -1
@@ -293,7 +293,7 @@ __do_global_dtors_aux:
!! if (__deregister_frame_info)
!! __deregister_frame_info(&__EH_FRAME_LIST__[0]);
#ifdef PIC
#ifdef __PIC__
mov.l .Ld___deregister_frame_info_GOT, r0
mov.l @R0VAR, r1
tst r1, r1
@@ -317,7 +317,7 @@ __do_global_dtors_aux:
mov r14, sp
lds.l @sp+, pr
mov.l @sp+, r14
#ifdef PIC
#ifdef __PIC__
mov.l @sp+, r12
#endif
mov.l @sp+, r9
@@ -339,7 +339,7 @@ __do_global_dtors_aux:
#endif
.Ld___DTOR_LIST__:
.long VAR_DATUM(__DTOR_LIST__)
#ifdef PIC
#ifdef __PIC__
.Ld___deregister_frame_info_GOT:
.long __deregister_frame_info@GOT
#endif

View File

@@ -1,5 +1,5 @@
# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
# $NetBSD: Makefile.inc,v 1.2 2013/07/11 06:57:15 martin Exp $
CPPFLAGS+= -DELFSIZE=32
CPPFLAGS+= -DELFSIZE=32 -I${ARCHDIR}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
/* $NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -37,20 +37,21 @@
#include <machine/asm.h>
RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
RCSID("$NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $")
STRONG_ALIAS(_start,__start)
! called with:
! %g3 = cleanup
! %g2 = obj
! %g1 = ps_strings
! call: ___start(cleanup, obj, ps_strings)
_ENTRY(__start)
mov 0, %fp
ld [%sp + 64], %o0 ! get argc
add %sp, 68, %o1 ! get argv
sll %o0, 2, %o2 !
add %o2, 4, %o2 ! envp = argv + (argc << 2) + 4
add %o1, %o2, %o2 !
andn %sp, 7, %sp ! align
andn %sp, 7, %sp ! align stack
sub %sp, 24, %sp ! expand to standard stack frame size
mov %g3, %o3
mov %g2, %o4
mov %g3, %o0
mov %g2, %o1
call ___start
mov %g1, %o5
mov %g1, %o2

View File

@@ -0,0 +1,40 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( "\n\t"
".pushsection .init, \"ax\", @progbits" "\n\t"
"call __do_global_ctors_aux" "\n\t"
" nop" "\n\t"
".popsection");
__asm( "\n\t"
".pushsection .fini, \"ax\", @progbits" "\n\t"
"call __do_global_dtors_aux" "\n\t"
" nop" "\n\t"
".popsection");

View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
/*-
* Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
.section .ctors, "aw", @progbits
.align 4
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.long 0
.section .dtors, "aw", @progbits
.align 4
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.long 0
.section .eh_frame, "a", @progbits
.align 4
.long 0
.section .jcr, "aw", @progbits
.align 4
.long 0

View File

@@ -0,0 +1,5 @@
# $NetBSD: Makefile.inc,v 1.1 2013/07/11 06:57:15 martin Exp $
CPPFLAGS+= -DELFSIZE=64 -I${ARCHDIR}

View File

@@ -1,7 +1,8 @@
/* $NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $ */
/* $NetBSD: crt0.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
/*
* Copyright (c) 2001 Christopher G. Demetriou
* Copyright (c) 1998 Christos Zoulas
* Copyright (c) 1995 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,66 +35,26 @@
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
#include "namespace.h"
RCSID("$NetBSD: crt0.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
#include <stdlib.h>
#include <string.h>
STRONG_ALIAS(_start,__start)
#ifdef __weak_alias
__weak_alias(getprogname, _getprogname)
__weak_alias(setprogname, _setprogname)
#endif
.align 4
.register %g3,#scratch
.register %g2,#scratch
#if defined(__ELF__)
extern const char *__progname;
! called with:
! %g3 = cleanup
! %g2 = obj
! %g1 = ps_strings
! call: ___start(cleanup, obj, ps_strings)
_ENTRY(__start)
clr %fp
clr %g4 ! data base for some memory models
mov %g3, %o0
mov %g2, %o1
ba,pt %icc,___start
mov %g1, %o2
const char *
getprogname(void)
{
return (__progname);
}
void
setprogname(const char *progname)
{
const char *p;
p = strrchr(progname, '/');
if (p != NULL)
__progname = p + 1;
else
__progname = progname;
}
#else
static const char *theprogname = NULL;
extern const char **__prognamep; /* Copy of argv[]. */
extern int __argc; /* Copy of argc. */
const char *
getprogname(void)
{
const char *pn = NULL, *component;
if(theprogname)
return theprogname;
if(__argc > 0 && __prognamep)
pn = __prognamep[0];
else
return NULL;
if((component=strrchr(pn, '/')))
return component+1;
return pn;
}
void
setprogname(const char *newprogname)
{
theprogname = newprogname;
}
#endif

View File

@@ -0,0 +1,40 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( "\n\t"
".pushsection .init, \"ax\", @progbits" "\n\t"
"call __do_global_ctors_aux" "\n\t"
" nop" "\n\t"
".popsection");
__asm( "\n\t"
".pushsection .fini, \"ax\", @progbits" "\n\t"
"call __do_global_dtors_aux" "\n\t"
" nop" "\n\t"
".popsection");

View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
/*-
* Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
.section .ctors, "aw", @progbits
.align 8
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.quad 0
.section .dtors, "aw", @progbits
.align 8
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.quad 0
.section .eh_frame, "a", @progbits
.align 8
.quad 0
.section .jcr, "aw", @progbits
.align 8
.quad 0

View File

@@ -1,7 +1,32 @@
/* $NetBSD: dot_init.h,v 1.8 2008/05/10 15:31:04 martin Exp $ */
/* $NetBSD: crti.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
/*
* Copyright (c) 2001 Matthew R. Green
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*/
/*-
* Copyright (c) 2004 Nick Hudson
* Copyright (c) 2001 Ross Harvey
* All rights reserved.
*
@@ -34,36 +59,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
#include <machine/asm.h>
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
__asm ( \
".section "#sect",\"ax\",@progbits \n"\
".global "#entry_pt" \n"\
".proc \n"\
".callinfo frame=64, calls, save_rp, save_sp, entry_gr=3\n"\
".entry \n"\
#entry_pt": \n"\
" stw %rp, -20(%sp) \n"\
" copy %r3, %r1 \n"\
" copy %sp, %r3 \n"\
" stw,ma %r1, 64(%sp) \n"\
" /* fall thru */ \n"\
".exit \n"\
".procend \n"\
".previous")
RCSID("$NetBSD: crti.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
#define MD_SECTION_EPILOGUE(sect) \
__asm ( \
".section "#sect",\"ax\",@progbits \n"\
" ldw -20(%r3) ,%rp \n"\
" ldo 64(%r3), %sp \n"\
" ldw,mb -64(%sp), %r3 \n"\
" bv,n %r0(%rp) \n"\
".previous")
#include "sysident.S"
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini)
.section ".init", "ax", @progbits
.align 4
.globl _init
_init:
save %sp, -176, %sp
#define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
#define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
.section ".fini", "ax", @progbits
.align 4
.globl _fini
_fini:
save %sp, -176, %sp

View File

@@ -1,4 +1,30 @@
/* $NetBSD: dot_init.h,v 1.9 2012/08/05 01:44:43 matt Exp $ */
/* $NetBSD: crtn.S,v 1.1 2013/07/11 06:57:15 martin Exp $ */
/*
* Copyright (c) 2001 Matthew R. Green
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*/
/*-
* Copyright (c) 2001 Ross Harvey
@@ -33,29 +59,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
#include <machine/asm.h>
#define MD_SECTION_PROLOGUE(sect, entry_pt) \
__asm ( \
".section "#sect",\"ax\",%progbits \n"\
".global "#entry_pt" \n"\
" .align 0 \n"\
#entry_pt": \n"\
"mov ip, sp \n"\
"stmfd sp!, {fp, ip, lr, pc} \n"\
"sub fp, ip, #4 \n"\
" /* fall thru */ \n"\
".previous")
RCSID("$NetBSD: crtn.S,v 1.1 2013/07/11 06:57:15 martin Exp $")
#define MD_SECTION_EPILOGUE(sect) \
__asm ( \
".section "#sect",\"ax\",%progbits \n"\
"ldmea fp, {fp, sp, pc} \n"\
".previous")
.section ".init", "ax", @progbits
.align 4
ret
restore
#define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init)
#define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini)
#define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
#define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
.section ".fini", "ax", @progbits
.align 4
ret
restore

View File

@@ -1,5 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
CPPFLAGS+= -DELFSIZE=32
# $NetBSD: Makefile.inc,v 1.3 2013/06/25 00:30:07 matt Exp $
CPPFLAGS+= -I${ARCHDIR}

View File

@@ -1,10 +1,12 @@
/* $NetBSD: crt0.S,v 1.2 2011/07/02 20:14:10 matt Exp $ */
/* $NetBSD: crt0.S,v 1.3 2013/06/21 15:54:08 matt Exp $ */
/*
* Copyright (c) 1999 Matt Thomas
* Copyright (c) 1995 Christopher G. Demetriou
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,37 +15,28 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the
* NetBSD Project. See http://www.NetBSD.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <vax/asm.h>
RCSID("$NetBSD: crt0.S,v 1.2 2011/07/02 20:14:10 matt Exp $")
RCSID("$NetBSD: crt0.S,v 1.3 2013/06/21 15:54:08 matt Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
.word 0x0101
pushl %r9 /* ps_strings */
pushl %r8 /* obj */
_ENTRY(__start, 0x0101)
movq %r8,-(%sp) /* ps_strings / obj */
pushl %r7 /* cleanup */
calls $3,___start
END(__start)

178
lib/csu/arch/vax/crtbegin.S Normal file
View File

@@ -0,0 +1,178 @@
/* $NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <vax/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 2
__CTOR_LIST__: /* symbol is not used */
.long -1
.section .dtors, "aw", @progbits
.p2align 2
__DTOR_LIST__:
.long -1
.section .eh_frame, "a", @progbits
.p2align 2
__EH_FRAME_LIST__:
.section .jcr, "aw", @progbits
.p2align 2
__JCR_LIST__:
.section .data.rel, "aw", @progbits
.p2align 2
.type __dso_handle, @object
.size __dso_handle, 4
.globl __dso_handle
.hidden __dso_handle
__dso_handle:
#ifdef SHARED
.long __dso_handle
#else
.long 0
#endif
.local __dwarf_eh_object
.comm __dwarf_eh_object,32
.local __initialized
.comm __initialized,1
.local __finished
.comm __finished,1
.text
/*
* All variables are local to this DSO so we can skip using GOT references
* and instead use PCREL references to access them. We do this regardless
* of being PIC since it isn't any additional overhead to do so.
*
* We don't setup a TOC since all of ours calls are indirect so it isn't
* needed.
*/
_ENTRY(__do_global_dtors_aux, 0x0100) /* save r8 */
tstb __finished /* done this already? */
bneq 4f
movb $1, __finished /* mark it as done */
#ifdef SHARED
/*
* if (__cxa_finalize)
* __cxa_finalize(&__dso_handle);
*/
movab __cxa_finalize, %r0
beql 1f
pushal __dso_handle
calls $0, (%r0)
1:
#endif /* SHARED */
/*
* We use load with postincrement to advance the pointer along.
* We know the list ends with 0. If we load one, we must be done.
*/
moval __DTOR_LIST__+4, %r8 /* skip first entry */
2: movl (%r8)+, %r0 /* r0 = *r8++; */
beql 3f
calls $0, (%r0)
brb 2b
3:
#ifdef SHARED
/*
* if (__deregister_frame_info)
* __deregister_frame_info(&__EH_FRAME_LIST__[0]);
*/
moval __deregister_frame_info, %r0
beql 4f
pushal __EH_FRAME_LIST__
calls $0, (%r0)
#endif /* SHARED */
4: ret
END(__do_global_dtors_aux)
.weak __deregister_frame_info
.weak __cxa_finalize
.weak __register_frame_info
.weak _Jv_RegisterClasses
_ENTRY(__do_global_ctors_aux, 0x0800)
tstb __initialized
bneq 4f
movb $1, __initialized
/*
* if (__register_frame_info)
* __register_frame_info(&__EH_FRAME_LIST__[0], &__dwarf_eh_object)
*/
movab __register_frame_info, %r0
beql 1f
pushal __dwarf_eh_object
pushal __EH_FRAME_LIST__
calls $0, (%r0)
1:
/*
* if (_Jv_RegisterClasses && __JCR_LIST__[0])
* _Jv_RegisterClasses(&__JCR_LIST__[0]);
*/
movab _Jv_RegisterClasses, %r0
beql 2f
pushal __JCR_LIST__
calls $0, (%r0)
2:
/*
* Get the end of the CTOR list. The first entry is -1 so if we
* load a negative address, we know we are done.
*/
moval __CTOR_LIST_END__, %r8 /* get end of list */
3: movl -(%r8), %r0 /* get function pointer with predec */
blss 4f /* negative? done. */
calls $0, (%r0) /* call it */
brb 3b /* get next one */
4: ret
END(__do_global_ctors_aux)
.hidden _C_LABEL(__CTOR_LIST_END__)
.section .init, "ax", @progbits
calls $0, __do_global_ctors_aux
.section .fini, "ax", @progbits
calls $0, __do_global_dtors_aux

View File

@@ -0,0 +1,36 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
__asm( ".pushsection .init, \"ax\", @progbits" "\n\t"
"calls $0, __do_global_ctors_aux" "\n\t"
".popsection" "\n\t"
".pushsection .fini, \"ax\", @progbits" "\n\t"
"calls $0, __do_global_dtors_aux" "\n\t"
".popsection"
);

55
lib/csu/arch/vax/crtend.S Normal file
View File

@@ -0,0 +1,55 @@
/* $NetBSD: crtend.S,v 1.2 2013/06/25 00:30:07 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <vax/asm.h>
RCSID("$NetBSD: crtend.S,v 1.2 2013/06/25 00:30:07 matt Exp $")
.section .ctors, "aw", @progbits
.p2align 2
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.long 0
.section .dtors, "aw", @progbits
.p2align 2
.global __DTOR_LIST_END__
.hidden __DTOR_LIST_END__
__DTOR_LIST_END__:
.long 0
.section .eh_frame, "a", @progbits
.p2align 2
.space 4
.section .jcr, "aw", @progbits
.p2align 2
.space 4

View File

@@ -1,8 +0,0 @@
# $NetBSD: Makefile,v 1.4 2006/05/19 19:11:12 christos Exp $
CPPFLAGS+= -I${.CURDIR}
# Temporary hack to work around ld problems when linking Thumb applications
# where the linker does not correctly insert an interworking veneer.
CFLAGS+=-mlong-calls
.include "${.CURDIR}/../common_elf/Makefile.inc"

View File

@@ -1,111 +0,0 @@
/* $NetBSD: crt0.c,v 1.10 2012/01/25 13:29:58 he Exp $ */
/*
* Copyright (C) 1997 Mark Brinicombe
* Copyright (C) 1995 Wolfgang Solfrank.
* Copyright (C) 1995 TooLs GmbH.
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#include <sys/param.h>
#include <machine/asm.h>
#include <stdlib.h>
#include "common.h"
extern void _start(void);
void ___start(int, char *[], char *[], struct ps_strings *,
const Obj_Entry *, void (*)(void));
__asm(" .text \n"
" .align 0 \n"
" .globl _start \n"
" .globl __start \n"
"_start: \n"
"__start: \n"
" mov r5, r2 /* cleanup */ \n"
" mov r4, r1 /* obj_main */ \n"
" mov r3, r0 /* ps_strings */ \n"
" /* Get argc, argv, and envp from stack */ \n"
" ldr r0, [sp, #0x0000] \n"
" add r1, sp, #0x0004 \n"
" add r2, r1, r0, lsl #2 \n"
" add r2, r2, #0x0004 \n"
"\n"
" /* Ensure the stack is properly aligned before calling C code. */\n"
" bic sp, sp, #" ___STRING(STACK_ALIGNBYTES) "\n"
" sub sp, sp, #8 \n"
" str r5, [sp, #4] \n"
" str r4, [sp, #0] \n"
"\n"
" b " ___STRING(_C_LABEL(___start)) " ");
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: crt0.c,v 1.10 2012/01/25 13:29:58 he Exp $");
#endif /* LIBC_SCCS and not lint */
void
___start(int argc, char **argv, char **envp, struct ps_strings *ps_strings,
const Obj_Entry *obj, void (*cleanup)(void))
{
char *ap;
environ = envp;
__ps_strings = ps_strings;
if ((ap = argv[0])) {
if ((__progname = _strrchr(ap, '/')) == NULL)
__progname = ap;
else
++__progname;
}
#ifdef DYNAMIC
/* ld(1) convention: if DYNAMIC = 0 then statically linked */
if (&rtld_DYNAMIC)
_rtld_setup(cleanup, obj);
#endif /* DYNAMIC */
_libc_init();
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
#endif /* MCRT0 */
atexit(_fini);
_init();
__asm("__callmain:"); /* Defined for the benefit of debuggers */
exit(main(argc, argv, envp));
}
#include "common.c"

View File

@@ -1,33 +1,62 @@
# $NetBSD: Makefile.inc,v 1.7 2012/03/25 06:55:19 joerg Exp $
# $NetBSD: Makefile.inc,v 1.23 2013/11/17 11:16:09 martin Exp $
.include <bsd.own.mk>
# XXX: FIXME: This is defined in bsd.lib.mk
PICFLAGS ?= -fPIC
COMMON_DIR:= ${.CURDIR}/common
.PATH: ${COMMON_DIR}
CPPFLAGS+= -I${NETBSDSRCDIR}/libexec/ld.elf_so -I${COMMON_DIR} -I.
OBJS+= crt0.o gcrt0.o crti.o crtn.o
OBJS+= crtbegin.o crtbeginS.o crtend.o
OBJS+= crtbegin.o crtend.o
# BJG - for backwards compatability with minix gcc
# which links with crt1.o instead of crt0.o
SYMLINKS+= crt0.o ${LIBDIR}/crt1.o
.if ${MKPIC} == "yes"
OBJS+= crtbeginS.o
CFLAGS.crtbegin.c+= -fPIE
.endif
.if ${MACHINE_ARCH} == "alpha"
OBJS+= crtfm.o
.endif
.if ${CSU_MACHINE_ARCH} == "sparc64"
# create helper objects for the compiler to mark compiler memory models
.for m in medlow medmid medany
sparc_mc${m}.o: compident.S sysident_assym.h
${CC} ${ASFLAGS} -I. -DCONTENT=\"${m}\\0\\0\" -DCONTENTLENGTH=8 -c \
-o $@ ${COMMON_DIR}/compident.S
.endfor
OBJS += sparc_mcmedlow.o sparc_mcmedmid.o sparc_mcmedany.o
.endif
realall: ${OBJS}
.if exists(${ARCHDIR}/crtbegin.S)
crtbegin.o: crtbegin.S
${_MKTARGET_COMPILE}
${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
.else
crtbegin.o: crtbegin.c crtbegin.h
${_MKTARGET_COMPILE}
${COMPILE.c} ${CFLAGS.crtbegin.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
.endif
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
rm -f ${.TARGET}.o
.if ${MKSTRIPIDENT} != "no"
${OBJCOPY} -R .ident ${.TARGET}
.endif
.if exists(${ARCHDIR}/crtbegin.S)
crtbeginS.o: crtbegin.S
${_MKTARGET_COMPILE}
${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
${COMPILE.S} ${PICFLAGS} -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
.else
crtbeginS.o: crtbegin.c crtbegin.h
${_MKTARGET_COMPILE}
${COMPILE.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
.endif
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
rm -f ${.TARGET}.o
.if ${MKSTRIPIDENT} != "no"
@@ -44,15 +73,15 @@ crtend.o: crtend.S
.endif
.if ${MKPIC} != "no"
PICFLAGS= -fPIC
MY_PICFLAGS= ${PICFLAGS}
.else
PICFLAGS=
MY_PICFLAGS=
.endif
crt0.o: crt0.S crt0-common.c
${_MKTARGET_COMPILE}
${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
${COMPILE.c} ${PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
${COMPILE.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
rm -f ${.TARGET}.S.o ${.TARGET}.c.o
.if ${MKSTRIPIDENT} != "no"
@@ -62,14 +91,24 @@ crt0.o: crt0.S crt0-common.c
gcrt0.o: crt0.S crt0-common.c
${_MKTARGET_COMPILE}
${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
${COMPILE.c} ${PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
${COMPILE.c} ${MY_PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
rm -f ${.TARGET}.S.o ${.TARGET}.c.o
.if ${MKSTRIPIDENT} != "no"
${OBJCOPY} -R .ident ${.TARGET}
.endif
sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
.if ${MACHINE_ARCH} == "alpha"
# can't do this in Makefile.inc otherwise it will before realall:
crtfm.o: crtfm.c
${_MKTARGET_COMPILE}
${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
${LD} -x -r -o ${.TARGET} ${.TARGET}.o
rm -f ${.TARGET}.o
.endif
GENASSYM_CONF= ${COMMON_DIR}/sysident_assym.cf
sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} ${NETBSDSRCDIR}/sys/sys/param.h
${_MKTARGET_CREATE}
cat ${COMMON_DIR}/sysident_assym.cf | \
${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
@@ -78,13 +117,16 @@ sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
CLEANFILES+= sysident_assym.h
crti.o: crti.S sysident_assym.h
crti.o: crti.S sysident_assym.h sysident.S
crtn.o: crtn.S
FILES=${OBJS}
FILESDIR=${LIBDIR}
CLEANFILES+=${OBJS}
.if ${MKPIC} == "yes"
SYMLINKS+= crtbegin.o ${LIBDIR}/crtbeginT.o
SYMLINKS+= crtend.o ${LIBDIR}/crtendS.o
.endif
.include <bsd.prog.mk>

View File

@@ -0,0 +1,65 @@
/* $NetBSD: compident.S,v 1.1 2013/11/14 12:19:34 martin Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Martin Husemann <martin@NetBSD.org>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* This file is used to generate a note describing the code model in use by
* the compiler on some architectures where this has consequences for the
* VA layout applied by the kernel. On sparc64 the topdown VA layout can
* only be enabled for processes compiled with -mcmodel=medany or greater,
* but not for processes without this note or -mcmodel=medlow.
*
* The note looks similar to the .note.netbsd.march note used (for example)
* on arm to note the ABI used by the process.
*
* [NOTE HEADER]
* long name size
* long content size
* long note type
*
* [NOTE DATUM]
* string code model (for sparc64: medlow, medmid, medany,
* the embedany model is never PIC, so not used here)
*
* The DATUM fields should be padded out such that their actual (not
* declared) sizes % 4 == 0.
*/
#include "sysident_assym.h"
.section ".note.netbsd.mcmodel", "a"
.p2align 2
.long ELF_NOTE_MCMODEL_NAMESZ
.long CONTENTLENGTH
.long ELF_NOTE_TYPE_MCMODEL_TAG
.ascii "NetBSD\0\0"
.ascii CONTENT

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $ */
/* $NetBSD: crt0-common.c,v 1.13 2013/01/31 22:24:25 matt Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
@@ -36,15 +36,15 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $");
__RCSID("$NetBSD: crt0-common.c,v 1.13 2013/01/31 22:24:25 matt Exp $");
#include <sys/types.h>
#include <sys/exec.h>
#ifndef __minix
#if !defined(__minix)
#include <sys/syscall.h>
#else
#include <string.h>
#endif
#endif /* !defined(__minix) */
#include <machine/profile.h>
#include <stdlib.h>
#include <unistd.h>
@@ -83,11 +83,11 @@ char *__progname = empty_string;
__dead __dso_hidden void ___start(void (*)(void), const Obj_Entry *,
struct ps_strings *);
#ifndef __minix
#if !defined(__minix)
#define write(fd, s, n) __syscall(SYS_write, (fd), (s), (n))
#else
#define write(fd, s, n) /* NO write() from here on minix */
#endif
#endif /* !defined(__minix) */
#define _FATAL(str) \
do { \
@@ -103,10 +103,26 @@ do { \
* Since we don't need .init or .fini sections, just code them in C
* to make life easier.
*/
static const fptr_t init_array_start[] __weak_reference(__init_array_start);
static const fptr_t init_array_end[] __weak_reference(__init_array_end);
static const fptr_t fini_array_start[] __weak_reference(__fini_array_start);
static const fptr_t fini_array_end[] __weak_reference(__fini_array_end);
__weakref_visible const fptr_t preinit_array_start[1]
__weak_reference(__preinit_array_start);
__weakref_visible const fptr_t preinit_array_end[1]
__weak_reference(__preinit_array_end);
__weakref_visible const fptr_t init_array_start[1]
__weak_reference(__init_array_start);
__weakref_visible const fptr_t init_array_end[1]
__weak_reference(__init_array_end);
__weakref_visible const fptr_t fini_array_start[1]
__weak_reference(__fini_array_start);
__weakref_visible const fptr_t fini_array_end[1]
__weak_reference(__fini_array_end);
static inline void
_preinit(void)
{
for (const fptr_t *f = preinit_array_start; f < preinit_array_end; f++) {
(*f)();
}
}
static inline void
_init(void)
@@ -160,6 +176,10 @@ ___start(void (*cleanup)(void), /* from shared loader */
_libc_init();
#ifdef HAVE_INITFINI_ARRAY
_preinit();
#endif
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&__eprol, (u_long)&__etext);

135
lib/csu/common/crtbegin.c Normal file
View File

@@ -0,0 +1,135 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: crtbegin.c,v 1.6 2013/11/29 23:00:48 joerg Exp $");
#include "crtbegin.h"
typedef void (*fptr_t)(void);
__dso_hidden const fptr_t __JCR_LIST__[0] __section(".jcr");
__weakref_visible void Jv_RegisterClasses(const fptr_t *)
__weak_reference(_Jv_RegisterClasses);
#if !defined(HAVE_INITFINI_ARRAY)
__dso_hidden const fptr_t __CTOR_LIST__[] __section(".ctors") = {
(fptr_t) -1,
};
__dso_hidden extern const fptr_t __CTOR_LIST_END__[];
#endif
#ifdef SHARED
__dso_hidden void *__dso_handle = &__dso_handle;
__weakref_visible void cxa_finalize(void *)
__weak_reference(__cxa_finalize);
#else
__dso_hidden void *__dso_handle;
#endif
#if !defined(__ARM_EABI__)
__dso_hidden
#if !defined(__mips__)
const
#endif
long __EH_FRAME_LIST__[0] __section(".eh_frame");
__weakref_visible void register_frame_info(const void *, const void *)
__weak_reference(__register_frame_info);
__weakref_visible void deregister_frame_info(const void *)
__weak_reference(__deregister_frame_info);
static long dwarf_eh_object[8];
#endif
static void __do_global_ctors_aux(void) __used;
static void __section(".text.startup")
__do_global_ctors_aux(void)
{
static unsigned char __initialized;
if (__initialized)
return;
__initialized = 1;
#if !defined(__ARM_EABI__)
if (register_frame_info)
register_frame_info(__EH_FRAME_LIST__, &dwarf_eh_object);
#endif
if (Jv_RegisterClasses && __JCR_LIST__[0] != 0)
Jv_RegisterClasses(__JCR_LIST__);
#if !defined(HAVE_INITFINI_ARRAY)
for (const fptr_t *p = __CTOR_LIST_END__; p > __CTOR_LIST__ + 1; ) {
(*(*--p))();
}
#endif
}
#if !defined(__ARM_EABI__) || defined(SHARED)
#if !defined(HAVE_INITFINI_ARRAY)
__dso_hidden const fptr_t __DTOR_LIST__[] __section(".dtors") = {
(fptr_t) -1,
};
__dso_hidden extern const fptr_t __DTOR_LIST_END__[];
#endif
static void __do_global_dtors_aux(void) __used;
static void __section(".text.exit")
__do_global_dtors_aux(void)
{
static unsigned char __finished;
if (__finished)
return;
__finished = 1;
#ifdef SHARED
if (cxa_finalize)
(*cxa_finalize)(__dso_handle);
#endif
#if !defined(HAVE_INITFINI_ARRAY)
for (const fptr_t *p = __DTOR_LIST__ + 1; p < __DTOR_LIST_END__; ) {
(*(*p++))();
}
#endif
#if !defined(__ARM_EABI__)
if (deregister_frame_info)
deregister_frame_info(__EH_FRAME_LIST__);
#endif
}
#endif /* !__ARM_EABI__ || SHARED */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: sysident.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/* $NetBSD: sysident.S,v 1.2 2013/09/10 16:45:33 matt Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou
@@ -58,25 +58,41 @@
#include "sysident_assym.h"
#ifdef __minix
.section .rodata
.ascii "$MINIX$\0"
#if defined(__minix)
.section ".note.minix.ident", "a"
.p2align 2
.long ELF_NOTE_MINIX_NAMESZ
.long ELF_NOTE_MINIX_DESCSZ
.long ELF_NOTE_TYPE_MINIX_TAG
.ascii "Minix\0\0\0" /* ELF_NOTE_NETBSD_NAME */
.long 300300000 /* Minix versiont as in "%d%03d%03d", MAJ-MIN-TEENY */
#else
.section ".note.netbsd.ident", "a"
.align 4
.p2align 2
.long ELF_NOTE_NETBSD_NAMESZ
.long ELF_NOTE_NETBSD_DESCSZ
.long ELF_NOTE_TYPE_NETBSD_TAG
.ascii "NetBSD\0\0" /* ELF_NOTE_NETBSD_NAME */
.long __NetBSD_Version__
#endif /* defined(__minix) */
.section ".note.netbsd.pax", "a"
.align 4
.p2align 2
.long ELF_NOTE_PAX_NAMESZ
.long ELF_NOTE_PAX_DESCSZ
.long ELF_NOTE_TYPE_PAX_TAG
.ascii "PaX\0" /* ELF_NOTE_PAX_NAME */
.long 0
#ifdef ELF_NOTE_MARCH_DESC
.section ".note.netbsd.march", "a"
.p2align 2
.long ELF_NOTE_MARCH_NAMESZ
.long ELF_NOTE_MARCH_DESCSZ
.long ELF_NOTE_TYPE_MARCH_TAG
.ascii "NetBSD\0\0"
.asciz ELF_NOTE_MARCH_DESC
#endif

View File

@@ -10,3 +10,18 @@ define ELF_NOTE_PAX_NAMESZ ELF_NOTE_PAX_NAMESZ
define ELF_NOTE_PAX_DESCSZ ELF_NOTE_PAX_DESCSZ
define ELF_NOTE_TYPE_PAX_TAG ELF_NOTE_TYPE_PAX_TAG
#define ELF_NOTE_PAX_NAME ELF_NOTE_PAX_NAME
ifdef ELF_NOTE_MARCH_DESC
define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_MARCH_NAMESZ
define ELF_NOTE_MARCH_DESCSZ sizeof(ELF_NOTE_MARCH_DESC)
define ELF_NOTE_TYPE_MARCH_TAG ELF_NOTE_TYPE_MARCH_TAG
#define ELF_NOTE_MARCH_NAME ELF_NOTE_MARCH_NAME
#define ELF_NOTE_MARCH_DESC ELF_NOTE_MARCH_DESC
endif
define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_MCMODEL_NAMESZ
define ELF_NOTE_TYPE_MCMODEL_TAG ELF_NOTE_TYPE_MCMODEL_TAG
define ELF_NOTE_MINIX_NAMESZ ELF_NOTE_MINIX_NAMESZ
define ELF_NOTE_MINIX_DESCSZ ELF_NOTE_MINIX_DESCSZ
define ELF_NOTE_TYPE_MINIX_TAG ELF_NOTE_TYPE_MINIX_TAG

View File

@@ -36,9 +36,9 @@
#include <sys/types.h>
#include <sys/exec.h>
#ifndef __minix
#if !defined(__minix)
#include <sys/syscall.h>
#endif
#endif /* !defined(__minix) */
#include <stdlib.h>
#ifdef DYNAMIC

View File

@@ -1,4 +0,0 @@
# $NetBSD: Makefile,v 1.3 2006/05/19 19:11:12 christos Exp $
CPPFLAGS+= -I${.CURDIR}
.include "${.CURDIR}/../common_elf/Makefile.inc"

View File

@@ -1,139 +0,0 @@
/* $NetBSD: crt0.c,v 1.10 2011/03/07 05:09:10 joerg Exp $ */
/*
* Copyright (c) 2002 Matt Fredette
* Copyright (c) 1999 Klaus Klein
* Copyright (c) 1995 Christopher G. Demetriou
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the
* NetBSD Project. See http://www.NetBSD.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
#include "common.h"
static void ___start(struct ps_strings *,
void (*cleanup)(void), const Obj_Entry *, int)
#ifdef __GNUC__
__attribute__((__used__))
#endif
;
__asm("\n"
" .text \n"
" .align 4 \n"
" .globl _start \n"
" .globl __start \n"
" .type _start,@function \n"
" .type __start,@function \n"
"_start: \n"
"__start: \n"
" .import _GLOBAL_OFFSET_TABLE_ \n"
"\n"
" bl L$lpc, %r27 \n"
" depi 0, 31, 2, %r27 \n"
"L$lpc: addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8), %r27 \n"
" ldo R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%r1),%r27 \n"
" copy %r27, %r19 \n"
" b ___start \n"
" copy %r27, %arg3 \n");
static void
___start(struct ps_strings *ps_strings,
void (*cleanup)(void), /* from shared loader */
const Obj_Entry *obj, /* from shared loader */
int dp)
{
int argc;
char **argv;
int fini_plabel[2];
argc = ps_strings->ps_nargvstr;
argv = ps_strings->ps_argvstr;
environ = ps_strings->ps_envstr;
if ((__progname = argv[0]) != NULL) { /* NULL ptr if argc = 0 */
if ((__progname = _strrchr(__progname, '/')) == NULL)
__progname = argv[0];
else
__progname++;
}
if (ps_strings != (struct ps_strings *)0)
__ps_strings = ps_strings;
#ifdef DYNAMIC
if (&rtld_DYNAMIC != NULL)
_rtld_setup(cleanup, obj);
#endif
_libc_init();
#ifdef MCRT0
atexit(_mcleanup);
monstartup((u_long)&_eprol, (u_long)&_etext);
#endif
/*
* Since crt0.o, crtbegin.o, and crtend.o are always
* compiled PIC, they must have %r19 set correctly on
* entry to any function they contain. However, when
* a program is linked statically, the linker does
* not fill a PLABEL relocation with a pointer to a
* true PLABEL, it just fills it with the offset of the
* function. This shows the linker's assumption that
* when linking statically, *all* of the code has *not*
* been compiled PIC. I guess to assume otherwise
* would be a performance hit, as you would end up
* with unnecessary PLABELs for function pointers.
*
* But here, passing the address of the PIC _fini to
* atexit, we must make sure that we pass a PLABEL.
*/
fini_plabel[0] = (int)_fini;
if (fini_plabel[0] & 2)
/* _fini is already a PLABEL. */
atexit(_fini);
else {
fini_plabel[1] = dp;
atexit((void (*)(void))(((int)fini_plabel) | 2));
}
_init();
exit(main(argc, argv, environ));
}
/*
* NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
*/
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: crt0.c,v 1.10 2011/03/07 05:09:10 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "common.c"

View File

@@ -1,4 +1,6 @@
# Makefile for the common audio framework
NOGCCERROR=yes
NOCLANGERROR=yes
LIB= audiodriver
SRCS= audio_fw.c liveupdate.c

View File

@@ -1,3 +1,6 @@
NOGCCERROR=yes
NOCLANGERROR=yes
# Makefile for libbdev
.include <bsd.own.mk>

View File

@@ -1,3 +1,6 @@
NOGCCERROR=yes
NOCLANGERROR=yes
# Makefile for libblockdriver
.include <bsd.own.mk>

View File

@@ -1,11 +1,6 @@
# $NetBSD: Makefile,v 1.17 2012/05/07 08:51:47 wiz Exp $
.if defined(__MINIX)
# ssp-buffer-size=0, __SSP_FORTIFY_LEVEL=0
USE_FORT=no
.else
USE_FORT?= yes # data driven bugs?
.endif
NOMAN= # defined

View File

@@ -1,2 +1,5 @@
major=0
minor=0
# $NetBSD: shlib_version,v 1.4 2008/03/19 17:10:52 bjs Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=1
minor=1

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.149 2012/01/20 16:31:29 joerg Exp $
# $NetBSD: Makefile,v 1.160 2013/10/14 16:00:17 joerg Exp $
# @(#)Makefile 8.2 (Berkeley) 2/3/94
#
# All library objects contain sccsid strings by default; they may be
@@ -19,6 +19,8 @@
.include "Makefile.inc"
LIBC_MACHINE_ARCH?= ${MACHINE_ARCH} # for MKCOMPAT
LIB= c
CPPFLAGS+= -I${.CURDIR}/include -I${.CURDIR}
@@ -35,22 +37,24 @@ CLEANFILES+= assym.h assym.h.tmp
assym.h: ${ARCHDIR}/genassym.cf
${_MKTARGET_CREATE}
${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,--fatal-warnings} \
${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
mv -f assym.h.tmp assym.h
.endif
# The following controls how to build compatibility code for old NetBSD
# binaries. If BUILDCOLD is yes, then we build a separate library; otherwise
# binaries. If BUILD_LEGACY is yes, then we build a separate library; otherwise
# we include the code in libc.
BUILDCOLD?= no
.if "${BUILDCOLD}" == "yes"
BUILD_LEGACY?= no
.if "${BUILD_LEGACY}" == "yes"
SUBDIR=compat
.include <bsd.subdir.mk>
.else
COMPATDIR=${.CURDIR}/compat
.include "${.CURDIR}/compat/Makefile.inc"
# Marker for compat code that can't be easily isolated
CPPFLAGS+= -D__BUILD_LEGACY
.endif
.if defined(__MINIX)
@@ -64,6 +68,9 @@ SUBDIR+= pkgconfig
.include "${.CURDIR}/db/Makefile.inc"
.include "${.CURDIR}/citrus/Makefile.inc"
.include "${.CURDIR}/compat-43/Makefile.inc"
.if ${HAVE_LIBGCC} == "no"
.include "${.CURDIR}/compiler_rt/Makefile.inc"
.endif
.include "${.CURDIR}/dlfcn/Makefile.inc"
.include "${.CURDIR}/gdtoa/Makefile.inc"
.include "${.CURDIR}/gen/Makefile.inc"
@@ -109,6 +116,9 @@ SUBDIR+= pkgconfig
.include "${.CURDIR}/tls/Makefile.inc"
.endif
.include "${.CURDIR}/sys/Makefile.inc"
.if ${HAVE_LIBGCC} == "no"
.include "${NETBSDSRCDIR}/sys/lib/libunwind/Makefile.inc"
.endif
.include "${.CURDIR}/uuid/Makefile.inc"
.if (${MKYP} != "no")
.include "${.CURDIR}/yp/Makefile.inc"
@@ -167,3 +177,6 @@ CSHLIBFLAGS+= -D_I18N_DYNAMIC
# force the dynamic linker to initialize libc first
SHLIB_SHFLAGS+= -Wl,-z,initfirst
.if ${HAVE_LIBGCC} == "no"
SHLIB_SHFLAGS+= -Wl,-z,defs
.endif

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.14 2012/03/21 14:52:40 christos Exp $
# $NetBSD: Makefile.inc,v 1.16 2013/09/19 21:18:17 christos Exp $
# @(#)Makefile 8.2 (Berkeley) 2/3/94
#
# All library objects contain sccsid strings by default; they may be
@@ -38,9 +38,10 @@ USE_SHLIBDIR= yes
WARNS=5
.if defined(__MINIX)
CPPFLAGS+= -D_LIBC
CPPFLAGS+= -DMLIBDIR=\"${MLIBDIR}\"
.else
CPPFLAGS+= -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
CPPFLAGS+= -D_DIAGNOSTIC
CPPFLAGS+= -D_DIAGNOSTIC -DMLIBDIR=\"${MLIBDIR}\"
.endif
.if (${USE_HESIOD} != "no")
@@ -58,7 +59,7 @@ CPPFLAGS+= -DYP
.endif
# Set lint to exit on warnings
LINTFLAGS+= -w
#LINTFLAGS+= -w
# ignore 'empty translation unit' warnings.
LINTFLAGS+= -X 272

View File

@@ -1,4 +1,4 @@
/* $NetBSD: __longjmp14.c,v 1.5 2008/04/28 20:22:55 martin Exp $ */
/* $NetBSD: __longjmp14.c,v 1.7 2013/03/13 08:05:46 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -74,6 +74,7 @@ __longjmp14(jmp_buf env, int val)
uc.uc_mcontext.__gregs[_REG_S5] = sc->sc_regs[R_S5];
uc.uc_mcontext.__gregs[_REG_S6] = sc->sc_regs[R_S6];
uc.uc_mcontext.__gregs[_REG_RA] = sc->sc_regs[R_RA];
uc.uc_mcontext.__gregs[_REG_GP] = sc->sc_regs[R_GP];
uc.uc_mcontext.__gregs[_REG_SP] = sc->sc_sp;
uc.uc_mcontext.__gregs[_REG_PC] = sc->sc_pc;
uc.uc_mcontext.__gregs[_REG_PS] =

View File

@@ -1,4 +1,4 @@
/* $NetBSD: __setjmp14.S,v 1.5 2011/06/12 05:44:36 matt Exp $ */
/* $NetBSD: __setjmp14.S,v 1.6 2013/03/12 19:38:20 martin Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -55,6 +55,7 @@ LEAF(__setjmp14, 1)
stq s6, (SC_REGS+_REG_S6)(a0)
stq ra, (SC_REGS+_REG_RA)(a0)
stq sp, (SC_REGS+_REG_SP)(a0)
stq gp, (SC_REGS+_REG_GP)(a0)
/*
* get signal information

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fpsetmask.c,v 1.4 2005/06/12 05:21:25 lukem Exp $ */
/* $NetBSD: fpsetmask.c,v 1.5 2013/11/02 23:54:04 christos Exp $ */
/*
* Copyright (c) 1995 Ross Harvey
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetmask.c,v 1.4 2005/06/12 05:21:25 lukem Exp $");
__RCSID("$NetBSD: fpsetmask.c,v 1.5 2013/11/02 23:54:04 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -46,8 +46,7 @@ __weak_alias(fpsetmask,_fpsetmask)
#endif
fp_except
fpsetmask(mask)
fp_except mask;
fpsetmask(fp_except mask)
{
struct alpha_fp_except_args a;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fpsetsticky.c,v 1.4 2005/06/12 05:21:25 lukem Exp $ */
/* $NetBSD: fpsetsticky.c,v 1.5 2013/11/02 23:54:04 christos Exp $ */
/*
* Copyright (c) 1999 Ross Harvey
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetsticky.c,v 1.4 2005/06/12 05:21:25 lukem Exp $");
__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2013/11/02 23:54:04 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -46,8 +46,7 @@ __weak_alias(fpsetsticky,_fpsetsticky)
#endif
fp_except
fpsetsticky(sticky)
fp_except sticky;
fpsetsticky(fp_except sticky)
{
struct alpha_fp_except_args a;

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.16 2012/09/27 11:20:20 skrll Exp $
# $NetBSD: Makefile.inc,v 1.25 2013/09/03 00:30:19 matt Exp $
.include <bsd.own.mk>
@@ -6,23 +6,36 @@
SRCS+= __aeabi_read_tp.S __sigaction14_sigtramp.c __sigtramp2.S
.endif
CPPFLAGS += -I.
CPPFLAGS += -DSOFTFLOAT
.if empty(LIBC_MACHINE_ARCH:Mearmv7*)
AFLAGS+= -marm
.endif
.if ${MACHINE_ARCH} == "earm" || ${MACHINE_ARCH} == "earmeb" || defined(__MINIX)
CPPFLAGS += -I.
.if !empty(LIBC_MACHINE_ARCH:Mearm*)
SRCS+= __aeabi_ldivmod.S __aeabi_uldivmod.S
SRCS+= __aeabi_lcmp.c __aeabi_ulcmp.c
SRCS+= fixunsgen_ieee754.c fixunssfsi_ieee754.c
SRCS+= fixunsgen64_ieee754.c fixunsdfsi_ieee754.c
SRCS+= arm_initfini.c
.endif
.if ${MKSOFTFLOAT} != "no"
CPPFLAGS += -DSOFTFLOAT
# for earm, use the 64-bit softfloat
.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "armeb"
.if ${LIBC_MACHINE_ARCH} == "arm" || ${LIBC_MACHINE_ARCH} == "armeb"
SOFTFLOAT_BITS=32
#SRCS+= floatunsidf_ieee754.c floatunsisf_ieee754.c
.endif
.if defined(__MINIX)
.include "${LIBCDIR}/softfloat/Makefile.inc"
.else
.include <softfloat/Makefile.inc>
.else
.PATH : ${ARCHDIR}/hardfloat
SRCS.hardfloat+= fpgetround.c fpgetsticky.S fpgetmask.S
SRCS.hardfloat+= fpsetround.c fpsetmask.S fpsetsticky.S
.for f in ${SRCS.hardfloat}
CPPFLAGS.${f} += -mfpu=vfp
.endfor
SRCS+= ${SRCS.hardfloat}
.endif

View File

@@ -1,4 +1,4 @@
/* $NetBSD: SYS.h,v 1.10 2011/01/14 06:12:16 matt Exp $ */
/* $NetBSD: SYS.h,v 1.15 2013/08/19 22:13:34 matt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -34,31 +34,63 @@
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
*/
#define _TEXT_SECTION .section .text.hot, "ax"
#include <machine/asm.h>
#include <sys/syscall.h>
#include <arm/swi.h>
#ifdef __STDC__
#define SYSTRAP(x) swi SWI_OS_NETBSD | SYS_ ## x
#else
#define SYSTRAP(x) swi SWI_OS_NETBSD | SYS_/**/x
#ifndef __STDC__
#error __STDC__ not defined
#endif
#ifdef __ELF__
#if !defined(__thumb__)
#define SYSTRAP(x) svc #SWI_OS_NETBSD | SYS_ ## x
#else
.macro emitsvc x
mov ip, r0
.ifeq \x / 256
movs r0, #\x
.else
#if defined(_ARM_ARCH_7)
movw r0, #\x
#else
.ifeq (\x & 3)
movs r0, #(\x / 4)
lsls r0, r0, #3
.else
.ifeq (\x & 1)
movs r0, #(\x / 2)
lsls r0, r0, #1
.else
movs r0, #(\x / 256)
lsls r0, r0, #8
adds r0, r0, #(\x & 255)
.endif
.endif
#endif /* !_ARM_ARCH_7 */
.endif
svc #255
.endm
#define SYSTRAP(x) emitsvc SYS_ ## x
#endif /* __thumb__ */
#define CERROR _C_LABEL(__cerror)
#define CURBRK _C_LABEL(__curbrk)
#else
#define CERROR _ASM_LABEL(cerror)
#define CURBRK _ASM_LABEL(curbrk)
#endif
#define _SYSCALL_NOERROR(x,y) \
ENTRY(x); \
SYSTRAP(y)
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
#define _INVOKE_CERROR() bcs CERROR
#else
#define _INVOKE_CERROR() \
bcc 86f; push {r3,lr}; bl CERROR; pop {r3,pc}; 86:
#endif
#define _SYSCALL(x, y) \
_SYSCALL_NOERROR(x,y); \
bcs CERROR
_INVOKE_CERROR()
#define SYSCALL_NOERROR(x) \
_SYSCALL_NOERROR(x,x)
@@ -69,11 +101,13 @@
#define PSEUDO_NOERROR(x,y) \
_SYSCALL_NOERROR(x,y); \
RET
RET; \
END(x)
#define PSEUDO(x,y) \
_SYSCALL(x,y); \
RET
RET; \
END(x)
#define RSYSCALL_NOERROR(x) \
@@ -91,4 +125,5 @@
PSEUDO(weak,weak)
#endif
.hidden CERROR
.globl CERROR

View File

@@ -1,7 +1,9 @@
# $NetBSD: Makefile.inc,v 1.19 2012/10/10 02:15:03 christos Exp $
# $NetBSD: Makefile.inc,v 1.25 2013/08/21 03:09:39 matt Exp $
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
fabs.c flt_rounds.c modsi3.S umodsi3.S
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divide.S divsi3.S \
fabs.c flt_rounds.c udivsi3.S
CPUFLAGS.divide.S+= -marm
# Common ieee754 constants and functions
SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c
@@ -11,6 +13,13 @@ SRCS+= isinff_ieee754.c isinfd_ieee754.c
SRCS+= isnanf_ieee754.c isnand_ieee754.c
SRCS+= signbitf_ieee754.c signbitd_ieee754.c
.if !empty(LIBC_MACHINE_ARCH:Mearm*)
SRCS+= __aeabi_fcmpun.c __aeabi_dcmpun.c
SRCS+= __aeabi_idiv0.c __aeabi_ldiv0.c
.else
SRCS+= modsi3.S umodsi3.S
.endif
SRCS+= nanf.c
SRCS+= setjmp.S

View File

@@ -0,0 +1,54 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __aeabi_dcmpun.c,v 1.1 2013/01/26 07:04:22 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include <arm/aeabi.h>
#include <arm/ieee.h>
#include <math.h>
/*
* result (1, 0) denotes (?, <=>) [2], use for C99 isunordered()
*/
int
__aeabi_dcmpun(double x, double y)
{
const union ieee_double_u ux = { .dblu_d = x };
const union ieee_double_u uy = { .dblu_d = y };
return (ux.dblu_dbl.dbl_exp == DBL_EXP_INFNAN
&& (ux.dblu_dbl.dbl_frach|ux.dblu_dbl.dbl_fracl) != 0)
|| (uy.dblu_dbl.dbl_exp == DBL_EXP_INFNAN
&& (uy.dblu_dbl.dbl_frach|uy.dblu_dbl.dbl_fracl) != 0);
}

View File

@@ -0,0 +1,54 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __aeabi_fcmpun.c,v 1.1 2013/01/26 07:04:22 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include <arm/aeabi.h>
#include <arm/ieee.h>
#include <math.h>
/*
* result (1, 0) denotes (?, <=>) [2], use for C99 isunordered()
*/
int
__aeabi_fcmpun(float x, float y)
{
const union ieee_single_u ux = { .sngu_f = x };
const union ieee_single_u uy = { .sngu_f = y };
return (ux.sngu_sng.sng_exp == SNG_EXP_INFNAN
&& ux.sngu_sng.sng_frac != 0)
|| (uy.sngu_sng.sng_exp == SNG_EXP_INFNAN
&& uy.sngu_sng.sng_frac != 0);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: _setjmp.S,v 1.7 2012/08/01 06:02:13 matt Exp $ */
/* $NetBSD: _setjmp.S,v 1.16 2013/11/30 20:20:42 joerg Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
@@ -32,6 +32,14 @@
* SUCH DAMAGE.
*/
#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS)
#error FPA is not supported anymore
#endif
#if defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
.fpu vfp
#endif
#include <machine/asm.h>
#include <machine/setjmp.h>
@@ -45,65 +53,142 @@
* The previous signal state is NOT restored.
*
* Note: r0 is the return value
* r1-r3 are scratch registers in functions
* r1-r3,ip are scratch registers in functions
*/
ENTRY(_setjmp)
ldr r1, .L_setjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#elif defined(__VFP_FP__)
#error _setjmp VFP support missing
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /* SOFTFLOAT */
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
ldr r2, .Lfpu_present
#ifdef __PIC__
add r2, r2, pc /* pc = &.LPIC0 */
#endif
ldr r2, [r2]
.LPIC0:
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r2, 1f
#else
cmp r2, #0 /* do we have a FPU? */
beq 1f /* no, don't save VFP registers */
#endif
orrs r1, r1, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
/* change magic to VFP magic */
adds r2, r0, #(_JB_REG_D8 * 4)
vstmia r2, {d8-d15}
vmrs r2, fpscr
str r2, [r0, #(_JB_REG_FPSCR * 4)]
1:
#endif /* __ARM_EABI__ && (_ARM_ARCH_T2 || !__thumb__) */
str r1, [r0]
adds r0, r0, #(_JB_REG_R4 * 4)
/* Store integer registers */
#if !defined(__thumb__) || defined(_ARCH_ARCH_T2)
stmia r0, {r4-r14}
#else
stmia r0!, {r4-r7}
mov r1, r8
mov r2, r9
mov r3, r10
stmia r0!, {r1-r3}
mov r2, r11
mov r3, r12
stmia r0!, {r2-r3}
mov r2, sp
mov r3, lr
stmia r0!, {r2-r3}
#endif
movs r0, #0
RET
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
.align 0
.Lfpu_present:
.word REL_SYM(_libc_arm_fpu_present, .LPIC0)
#endif /* __ARM_EABI__ && (_ARM_ARCH_T2 || !__thumb__) */
END(_setjmp)
ENTRY(_longjmp)
ldr r2, .L_setjmp_magic
ldr r3, [r0], #4
teq r2, r3
bne botch
#ifdef SOFTFLOAT
add r0, r0, #52
#elif defined(__VFP_FP__)
#error _longjmp VFP support missing
ldr r2, [r0] /* get magic from jmp_buf */
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
bics r3, r2, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
/* ignore VFP-ness of magic */
ldr ip, .L_setjmp_magic /* load magic */
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore fpsr */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
ldr r3, .L_setjmp_magic /* load magic */
mov ip, r3
movs r3, #(_JB_MAGIC__SETJMP ^ _JB_MAGIC__SETJMP_VFP)
ands r3, r3, r2
eors r3, r3, r2 /* ignore VFP-ness of magic */
#endif
cmp ip, r3 /* magic correct? */
bne botch /* no, botch */
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
cmp r3, r2 /* did magic change? */
beq 1f /* no, don't restore VFP */
adds r3, r0, #(_JB_REG_D8 * 4)
vldmia r3, {d8-d15}
ldr r3, [r0, #(_JB_REG_FPSCR * 4)]
vmsr fpscr, r3
1:
#endif /* __ARM_EABI__ && (_ARM_ARCH_T2 || !__thumb__) */
adds r0, r0, #(_JB_REG_R4 * 4)
/* Restore integer registers */
ldmia r0, {r4-r14}
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
ldmia r0!, {r4-r12}
#else
ldmia r0!, {r4-r7}
ldmia r0!, {r2-r3}
mov r8, r2
mov r9, r3
ldmia r0!, {r2-r3}
mov r10, r2
mov r1, r3
adds r0, r0, #4 /* skip r12 */
#endif
ldmia r0!, {r2-r3} /* r2 = sp, r3 = lr */
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r2, botch
#else
cmp r2, #0
beq botch
#endif
mov sp, r2
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r3, botch
#else
cmp r3, #0
beq botch
#endif
mov lr, r3
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
movs r0, r1
#ifdef __thumb__
bne 1f
movs r0, #1
1:
#else
moveq r0, #1
#endif
RET
/* validation failed, die die die. */
botch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */
bl PLT_SYM(_C_LABEL(longjmperror))
bl PLT_SYM(_C_LABEL(abort))
1: b 1b /* Cannot get here */
.align 0
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
END(_longjmp)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: alloca.S,v 1.4 2004/08/21 11:20:10 rearnsha Exp $ */
/* $NetBSD: alloca.S,v 1.5 2013/08/17 01:07:45 matt Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@@ -37,8 +37,17 @@
#include <machine/asm.h>
ENTRY(alloca)
add r0, r0, #0x00000007 /* round up to next 8 byte alignment */
bic r0, r0, #0x00000007
sub sp, sp, r0 /* Adjust the stack pointer */
mov r0, sp /* r0 = base of new space */
adds r0, r0, #7 /* round up to next 8 byte alignment */
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
bics r0, r0, #7
sub sp, sp, r0 /* Adjust the stack pointer */
mov r0, sp /* r0 = base of new space */
#else
lsrs r0, r0, #3
lsls r0, r0, #3
mov r1, sp
subs r0, r1, r0 /* Adjust the stack pointer */
mov sp, r0 /* r0 = base of new space */
#endif
RET
END(alloca)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: setjmp.S,v 1.9 2012/08/01 06:02:13 matt Exp $ */
/* $NetBSD: setjmp.S,v 1.17 2013/11/30 20:20:42 joerg Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
@@ -32,6 +32,14 @@
* SUCH DAMAGE.
*/
#if !defined(__SOFTFP__) && !defined(__VFP_FP__) && !defined(__ARM_PCS)
#error FPA is not supported anymore
#endif
#if defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
.fpu vfp
#endif
#include <machine/asm.h>
#include <machine/setjmp.h>
@@ -47,79 +55,174 @@
ENTRY(__setjmp14)
/* Get the signal mask. */
stmfd sp!, {r0-r2, r14}
add r2, r0, #(_JB_SIGMASK * 4)
mov r1, #0x00000000
mov r0, #0x00000000
bl PIC_SYM(_C_LABEL(__sigprocmask14), PLT)
ldmfd sp!, {r0-r2, r14}
push {r0-r2, lr}
#if !defined(__thumb__)
adds r2, r0, #(_JB_SIGMASK * 4)
#else
mov r2, r0
adds r2, r2, #(_JB_SIGMASK * 4)
#endif
movs r1, #0
movs r0, #0
bl PLT_SYM(_C_LABEL(__sigprocmask14))
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
pop {r0-r2, lr}
#else
pop {r0-r3}
mov lr, r3
#endif
ldr r1, .Lsetjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#elif defined(__VFP_FP__)
#error __setjmp14 VFP support missing
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
ldr r2, .Lfpu_present
#ifdef __PIC__
add r2, r2, pc /* pc = &.LPIC0 */
#endif
ldr r2, [r2]
.LPIC0:
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r2, 1f /* don't save if we don't have a FPU */
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /*SOFTFLOAT*/
cmp r2, #0 /* do we have a FPU? */
beq 1f /* no, don't save VFP registers */
#endif
orrs r1, r1, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
/* change magic to VFP magic */
adds r2, r0, #(_JB_REG_D8 * 4)
vstmia r2, {d8-d15}
vmrs r2, fpscr
str r2, [r0, #(_JB_REG_FPSCR * 4)]
1:
#endif /* __ARM_EABI__ && (!__thumb__ || _ARM_ARCH_T2) */
str r1, [r0] /* store magic */
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
RET
.Lsetjmp_magic:
.word _JB_MAGIC_SETJMP
adds r0, r0, #(_JB_REG_R4 * 4)
#if !defined(__thumb__)
stmia r0!, {r4-lr}
#else
stmia r0!, {r4-r7}
mov r2, r8
mov r3, r9
stmia r0!, {r2-r3}
mov r2, r10
mov r3, r11
stmia r0!, {r2-r3}
mov r2, sp
mov r3, lr
str r2, [r0, #4]
str r3, [r0, #8]
#endif
movs r0, #0
RET
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
.align 0
.Lfpu_present:
.word REL_SYM(_libc_arm_fpu_present, .LPIC0)
#endif /* __ARM_EABI__ && (!__thumb__ || _ARM_ARCH_T2) */
END(__setjmp14)
ENTRY(__longjmp14)
ldr r2, .Lsetjmp_magic
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
ldr r2, [r0]
ldr ip, .Lsetjmp_magic
bic r3, r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
#else
ldr r3, .Lsetjmp_magic
mov ip, r3
ldr r3, [r0]
teq r2, r3
movs r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
bics r3, r2
/* r2 is not the magic but we don't need it since we can't do VFP */
#endif
cmp r3, ip
bne .Lbotch
/* Restore the signal mask. */
stmfd sp!, {r0-r2, r14}
mov r2, #0x00000000
add r1, r0, #(_JB_SIGMASK * 4)
mov r0, #3 /* SIG_SETMASK */
bl PIC_SYM(_C_LABEL(__sigprocmask14), PLT)
ldmfd sp!, {r0-r2, r14}
add r0, r0, #4
#ifdef SOFTFLOAT
add r0, r0, #52
#elif defined(__VFP_FP__)
#error __longjmp14 VFP support missing
push {r0-r2, lr}
movs r2, #0
#if !defined(__thumb__)
adds r1, r0, #(_JB_SIGMASK * 4)
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore FPSR */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r4-r14}
mov r1, r0
adds r1, r1, #(_JB_SIGMASK * 4)
#endif
movs r0, #3 /* SIG_SETMASK */
bl PLT_SYM(_C_LABEL(__sigprocmask14))
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
pop {r0-r2, lr}
#else
pop {r0-r3}
mov lr, r3
#endif
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
#if defined(__ARM_EABI__) && (!defined(__thumb__) || defined(_ARM_ARCH_T2))
tst r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
/* is this a VFP magic? */
beq 1f /* no, don't restore VFP */
adds r2, r0, #(_JB_REG_D8 * 4)
vldmia r2, {d8-d15}
ldr r2, [r0, #(_JB_REG_FPSCR * 4)]
vmsr fpscr, r2
1:
#endif /* __ARM_EABI__ && (!__thumb__ || _ARM_ARCH_T2) */
adds r0, r0, #(_JB_REG_R4 * 4)
/* Restore integer registers */
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
ldmia r0!, {r4-r12}
#else
ldmia r0!, {r4-r7}
ldmia r0!, {r2-r3}
mov r8, r2
mov r9, r3
ldmia r0!, {r2-r3}
mov r10, r2
mov r11, r3
adds r0, r0, #4 /* skip ip(r12) */
#endif
ldmia r0!, {r2-r3}
/* Validate sp and lr */
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r2, .Lbotch
#else
cmp r2, #0
beq .Lbotch
#endif
mov sp, r2
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbz r3, .Lbotch
#else
cmp r3, #0
beq .Lbotch
#endif
mov lr, r3
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
movs r0, r1
#if !defined(__thumb__)
moveq r0, #1
#else
bne 1f
movs r0, #1
1:
#endif
RET
/* validation failed, die die die. */
.Lbotch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */
bl PLT_SYM(_C_LABEL(longjmperror))
bl PLT_SYM(_C_LABEL(abort))
1: b 1b /* Cannot get here */
.align 0
.Lsetjmp_magic:
.word _JB_MAGIC_SETJMP
END(__longjmp14)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: sigsetjmp.S,v 1.5 2005/10/16 17:26:24 christos Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.8 2013/11/30 20:20:42 joerg Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
@@ -46,16 +46,50 @@
*/
ENTRY(__sigsetjmp14)
teq r1, #0
beq PIC_SYM(_C_LABEL(_setjmp), PLT)
b PIC_SYM(_C_LABEL(__setjmp14), PLT)
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
#if defined(__thumb__) && defined(_ARM_ARCH_T2)
cbnz r1, 1f
b PLT_SYM(_C_LABEL(_setjmp))
1: b PLT_SYM(_C_LABEL(__setjmp14))
#elif !defined(__thumb__)
cmp r1, #0
beq PLT_SYM(_C_LABEL(_setjmp))
b PLT_SYM(_C_LABEL(__setjmp14))
#else
push {r3, lr}
beq 1f
bl PLT_SYM(_C_LABEL(__setjmp14))
b 2f
1: bl PLT_SYM(_C_LABEL(_setjmp))
2: pop {r3, pc}
#endif
END(__sigsetjmp14)
ENTRY(__siglongjmp14)
ldr r2, .L_setjmp_magic
ldr r3, [r0]
teq r2, r3
beq PIC_SYM(_C_LABEL(_longjmp), PLT)
b PIC_SYM(_C_LABEL(__longjmp14), PLT)
#if !defined(__thumb__)
bics r3, r3, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
#else
movs r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP)
bics r3, r3, r2
#endif
ldr r2, .L_setjmp_magic
cmp r2, r3
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
#ifdef __thumb__
it eq
#endif
beq PLT_SYM(_C_LABEL(_longjmp))
b PLT_SYM(_C_LABEL(__longjmp14))
#else
push {r3, lr}
beq 11f
bl PLT_SYM(_C_LABEL(__longjmp14))
pop {r3, pc}
11: bl PLT_SYM(_C_LABEL(_longjmp))
pop {r3, pc}
#endif
.align 0
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
END(__siglongjmp14)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: swapcontext.S,v 1.8 2012/09/27 11:20:20 skrll Exp $ */
/* $NetBSD: swapcontext.S,v 1.14 2013/11/30 20:20:42 joerg Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,22 +33,63 @@
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.8 2012/09/27 11:20:20 skrll Exp $")
RCSID("$NetBSD: swapcontext.S,v 1.14 2013/11/30 20:20:42 joerg Exp $")
#endif /* LIBC_SCCS && !lint */
ENTRY(swapcontext)
stmfd sp!, {r0-r1, lr} /* Must save oucp, ucp, lr. */
sub sp, #4
bl PIC_SYM(_C_LABEL(_getcontext), PLT) /* getcontext(oucp) */
#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
.fnstart
.cfi_startproc
#endif
push {r0-r2, lr} /* Must save oucp, ucp, lr. */
#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
.save {r0-r2, lr}
.cfi_def_cfa_offset 16
.cfi_offset 14, -4
.cfi_offset 2, -8
.cfi_offset 1, -12
.cfi_offset 0, -16
#endif
bl PLT_SYM(_C_LABEL(_getcontext)) /* getcontext(oucp) */
cmp r0, #0
add sp, #4
ldmfd sp!, {r0-r1, lr}
#if !defined(__thumb__)
pop {r0-r2, lr}
#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
.cfi_def_cfa_offset 0
#endif
RETc(ne)
#else
pop {r0-r3}
beq 1f
#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
.cfi_def_cfa_offset 0
.cfi_register 14, 3
#endif
RETr(r3)
1:
#endif
#if !defined(__thumb__)
str sp, [r0, #_UC_REGS_SP] /* Adjust saved SP. */
str lr, [r0, #_UC_REGS_PC] /* Adjust saved PC. */
str lr, [r0, #_UC_REGS_PC] /* Adjust saved SP. */
#else
mov r2, sp
str r2, [r0, #_UC_REGS_SP] /* Adjust saved SP. */
str r3, [r0, #_UC_REGS_PC] /* Adjust saved PC. */
mov lr, r3
#endif
#ifdef SOFTFLOAT
/* Ahem. */
#endif
mov r0, r1
bl PIC_SYM(_C_LABEL(setcontext), PLT)
RET
#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
b PLT_SYM(_C_LABEL(setcontext))
#else
push {lr}
bl PLT_SYM(_C_LABEL(setcontext))
pop {pc}
#endif
#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
.cfi_endproc
.fnend
#endif
END(swapcontext)

View File

@@ -0,0 +1,40 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arm/asm.h>
RCSID("$NetBSD: fabs.S,v 1.2 2013/11/30 22:39:04 joerg Exp $")
.fpu vfp
ENTRY(fabsl)
ENTRY(fabs)
vabs.f64 d0, d0
RET
END(fabs)

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpgetmask.S,v 1.5 2012/08/01 06:10:21 matt Exp $ */
/* $NetBSD: fpgetmask.S,v 1.7 2013/08/02 02:07:00 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,25 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#ifndef __VFP_FP__
#error FPA is not supported anymore
#endif
#include <arm/asm.h>
#include <arm/vfpreg.h>
/*
* Return the current FP exception enable mask
@@ -41,15 +41,12 @@
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpgetmask, _fpgetmask)
ENTRY(_fpgetmask)
#else
#define fpgetmask _fpgetmask
#endif
ENTRY(fpgetmask)
#endif
#ifdef __VFP_FP__
#error _fpgetmask VFP support missing
#else
rfs r0
mov r0, r0, lsr #16
and r0, r0, #0x1f
vmrs r0, fpscr
mov r0, r0, lsr #8
and r0, r0, #VFP_FPSCR_CSUM
RET
#endif
END(fpgetmask)

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpgetround.c,v 1.5 2012/06/24 15:26:02 christos Exp $ */
/* $NetBSD: fpgetround.c,v 1.6 2013/01/11 13:55:26 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,27 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 __VFP_FP__
#error FPA is not supported anymore
#endif
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpgetround.c,v 1.5 2012/06/24 15:26:02 christos Exp $");
__RCSID("$NetBSD: fpgetround.c,v 1.6 2013/01/11 13:55:26 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -41,32 +43,24 @@ __RCSID("$NetBSD: fpgetround.c,v 1.5 2012/06/24 15:26:02 christos Exp $");
#include <sys/types.h>
#include <ieeefp.h>
#include <arm/vfpreg.h>
#ifdef __weak_alias
__weak_alias(fpgetround,_fpgetround)
#endif
/*
* Return the current FP rounding mode
*
* ok all we need to do is return the current FP rounding mode
*
* HOWEVER:
* The ARM FPA codes the rounding mode into the actual FP instructions
* so there is no such thing as a global rounding mode.
* The default is round to nearest if rounding is not explicitly specified.
* FP instructions generated by GCC will not explicitly specify a rounding
* mode.
*
* So the best we can do it to return the rounding mode FP instructions
* use if rounding is not specified which is round to nearest.
*
* This could change in the future with new floating point emulators or
* soft float FP libraries.
*/
fp_rnd
fpgetround(void)
{
return(FP_RN);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RN, VFP_FPSCR_RMODE) == FP_RN);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RP, VFP_FPSCR_RMODE) == FP_RP);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RM, VFP_FPSCR_RMODE) == FP_RM);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RZ, VFP_FPSCR_RMODE) == FP_RZ);
uint32_t fpscr;
__asm __volatile("vmrs %0, fpscr" : "=r" (fpscr));
return __SHIFTOUT(fpscr, VFP_FPSCR_RMODE);
}

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpgetsticky.S,v 1.5 2012/08/01 06:10:21 matt Exp $ */
/* $NetBSD: fpgetsticky.S,v 1.6 2013/01/11 13:55:26 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,25 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 __VFP_FP__
#error FPA is not supported anymore
#endif
#include <machine/asm.h>
#include <arm/asm.h>
#include <arm/vfpreg.h>
/*
* Return the current FP cumulative flags
@@ -41,14 +41,11 @@
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpgetsticky, _fpgetsticky)
ENTRY(_fpgetsticky)
#else
#define fpgetsticky _fpgetsticky
#endif
ENTRY(fpgetsticky)
#endif
#ifdef __VFP_FP__
#error _fpgetsticky VFP support missing
#else
rfs r0
and r0, r0, #0x1f
vmrs r0, fpscr
and r0, r0, #VFP_FPSCR_CSUM
RET
#endif
END(fpgetsticky)

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpsetmask.S,v 1.5 2012/08/01 06:10:21 matt Exp $ */
/* $NetBSD: fpsetmask.S,v 1.6 2013/01/11 13:55:26 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,26 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#ifndef __VFP_FP__
#error FPA is not supported anymore
#endif
#include <arm/asm.h>
#include <arm/vfpreg.h>
/*
* Set the current FP exception enable mask
@@ -41,18 +42,17 @@
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpsetmask, _fpsetmask)
ENTRY(_fpsetmask)
#else
#define fpsetmask _fpsetmask
#endif
ENTRY(fpsetmask)
#endif
#ifdef __VFP_FP__
#error _fpsetmask VFP support missing
#else
rfs r1
bic r1, r1, #0x001f0000
and r0, r0, #0x0000001f
orr r0, r1, r0, lsl #16
wfs r0
mov r0, r1, lsr #16 /* Return old mask */
and r2, r0, #VFP_FPSCR_CSUM
vmrs r1, fpscr
mov r0, r1, lsr #8 /* Return old mask */
bic r1, r1, #VFP_FPSCR_ESUM
orr r1, r1, r2, lsl #8
vmsr fpscr, r1
mcr p10, 7, r1, c1, c0, 0
and r0, r0, #VFP_FPSCR_CSUM
RET
#endif
END(fpsetmask)

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpsetround.c,v 1.6 2006/02/25 02:28:55 wiz Exp $ */
/* $NetBSD: fpsetround.c,v 1.8 2013/02/03 01:50:54 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,27 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 __VFP_FP__
#error FPA is not supported anymore
#endif
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpsetround.c,v 1.6 2006/02/25 02:28:55 wiz Exp $");
__RCSID("$NetBSD: fpsetround.c,v 1.8 2013/02/03 01:50:54 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -41,30 +43,27 @@ __RCSID("$NetBSD: fpsetround.c,v 1.6 2006/02/25 02:28:55 wiz Exp $");
#include <sys/types.h>
#include <ieeefp.h>
#include <arm/vfpreg.h>
#ifdef __weak_alias
__weak_alias(fpsetround,_fpsetround)
#endif
/*
* Return the current FP rounding mode
*
* ok all we need to do is return the current FP rounding mode
*
* HOWEVER:
* The ARM FPA codes the rounding mode into the actual FP instructions
* so there is no such thing as a global rounding mode.
* The default is round to nearest if rounding is not explicitly specified.
* FP instructions generated by GCC will not explicitly specify a rounding
* mode.
*
* All we can do is abort if they ask for anything else.
*/
fp_rnd
fpsetround(fp_rnd rnd_dir)
fpsetround(fp_rnd new_rnd)
{
if (rnd_dir != FP_RN)
abort();
return (FP_RN);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RN, VFP_FPSCR_RMODE) == FP_RN);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RP, VFP_FPSCR_RMODE) == FP_RP);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RM, VFP_FPSCR_RMODE) == FP_RM);
__CTASSERT(__SHIFTOUT(VFP_FPSCR_RZ, VFP_FPSCR_RMODE) == FP_RZ);
uint32_t fpscr;
__asm __volatile("vmrs %0, fpscr" : "=r" (fpscr));
fp_rnd old_rnd = __SHIFTOUT(fpscr, VFP_FPSCR_RMODE);
fpscr ^= __SHIFTIN(new_rnd ^ old_rnd, VFP_FPSCR_RMODE);
__asm __volatile("vmsr fpscr, %0" :: "r" (fpscr));
return old_rnd;
}

View File

@@ -1,9 +1,12 @@
/* $NetBSD: fpsetsticky.S,v 1.5 2012/08/01 06:10:21 matt Exp $ */
/* $NetBSD: fpsetsticky.S,v 1.6 2013/01/11 13:55:26 matt Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -12,28 +15,26 @@
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#ifndef __VFP_FP__
#error FPA is not supported anymore
#endif
#include <arm/asm.h>
#include <arm/vfpreg.h>
/*
* Set the current FP cumulative flags
@@ -41,18 +42,15 @@
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpsetsticky, _fpsetsticky)
ENTRY(_fpsetsticky)
#else
#define fpsetsticky _fpsetsticky
#endif
ENTRY(fpsetsticky)
#endif
#ifdef __VFP_FP__
#error _fpsetsticky VFP support missing
#else
rfs r1
bic r1, r1, #0x1f
and r0, r0, #0x1f
orr r0, r1, r0
wfs r0
mov r0, r1 /* Return old mask */
and r1, r0, #VFP_FPSCR_CSUM
vmrs r0, fpscr
bic r2, r0, #VFP_FPSCR_CSUM
orr r1, r1, r2
vmsr fpscr, r1
and r0, r0, #VFP_FPSCR_CSUM
RET
#endif
END(fpsetsticky)

View File

@@ -0,0 +1,72 @@
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: arm_initfini.c,v 1.7 2013/09/08 13:15:53 matt Exp $");
#include "namespace.h"
/*
* To properly implement setjmp/longjmp for the ARM AAPCS ABI, it has to be
* aware of whether there is a FPU is present or not. Regardless of whether
* the hard-float ABI is being used, setjmp needs to save D8-D15. But it can
* only do this if those instructions won't cause an exception.
*/
#include <sys/param.h>
#include <sys/sysctl.h>
#include <stdbool.h>
#include <stddef.h>
__dso_hidden int _libc_arm_fpu_present;
#ifndef __ARM_ARCH_EXT_IDIV__
__dso_hidden int _libc_arm_hwdiv_present;
#endif
static bool _libc_aapcs_initialized;
void _libc_aapcs_init(void) __attribute__((__constructor__, __used__));
void __section(".text.startup")
_libc_aapcs_init(void)
{
if (!_libc_aapcs_initialized) {
size_t len = sizeof(_libc_arm_fpu_present);
_libc_aapcs_initialized = true;
#if !defined(__minix)
(void)sysctlbyname("machdep.fpu_present",
&_libc_arm_fpu_present, &len, NULL, 0);
#ifndef __ARM_ARCH_EXT_IDIV__
(void)sysctlbyname("machdep.hwdiv_present",
&_libc_arm_hwdiv_present, &len, NULL, 0);
#endif
#endif /* !defined(__minix) */
}
}

View File

@@ -0,0 +1,23 @@
/* $NetBSD: __aeabi_dcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */
/*
* Written by Ben Harris, 2000. This file is in the Public Domain.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __aeabi_dcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
int __aeabi_dcmpeq(float64, float64);
int
__aeabi_dcmpeq(float64 a, float64 b)
{
return float64_eq(a, b);
}

View File

@@ -0,0 +1,23 @@
/* $NetBSD: __aeabi_dcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $ */
/*
* Written by Ben Harris, 2000. This file is in the Public Domain.
*/
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __aeabi_dcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $");
#endif /* LIBC_SCCS and not lint */
int __aeabi_dcmpge(float64, float64);
int
__aeabi_dcmpge(float64 a, float64 b)
{
return !float64_lt(a, b) && float64_eq(a, a) && float64_eq(b, b);
}

Some files were not shown because too many files have changed in this diff Show More