summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@gcc.gnu.org>2002-04-03 12:13:50 -0800
committerDavid S. Miller <davem@gcc.gnu.org>2002-04-03 12:13:50 -0800
commita261e0cc7b3a22d2343a7c06dc3c9d1c4153a133 (patch)
tree2f5a43a3fb6ddeffa532f4dfb75179057a205bac
parent68c17f30462516324d741c9d00ea729813fae657 (diff)
downloadgcc-a261e0cc7b3a22d2343a7c06dc3c9d1c4153a133.tar.gz
crtfastmath.c: New file.
2002-04-03 David S. Miller <davem@redhat.com> * config/sparc/crtfastmath.c: New file. * config/sparc/t-crtfm: New file. * config/sparc/linux.h (ENDFILE_SPEC): Use crtfastmath.o * config/sparc/linux64.h (ENDFILE_SPEC): Likewise. * config/sparc/sol2.h (ENDFILE_SPEC): Likewise. * config/sparc/sp64-elf.h (ENDFILE_SPEC): Likewise. * config/sparc/elf.h (ENDFILE_SPEC): Likewise. * config.gcc (sparc*-*-{elf*,linux*,solaris2*}): Add sparc/t-crtfm to tmake_file. * config/sparc/sparc-protos.h (sparc_emitting_epilogue): Add. From-SVN: r51808
-rw-r--r--gcc/config.gcc12
-rw-r--r--gcc/config/sparc/crtfastmath.c54
-rw-r--r--gcc/config/sparc/elf.h4
-rw-r--r--gcc/config/sparc/linux.h3
-rw-r--r--gcc/config/sparc/linux64.h11
-rw-r--r--gcc/config/sparc/sol2.h4
-rw-r--r--gcc/config/sparc/sp64-elf.h4
-rw-r--r--gcc/config/sparc/t-crtfm4
8 files changed, 83 insertions, 13 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6ce8daa839d..818dfbe8c6a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3018,7 +3018,7 @@ sparc-*-chorusos*)
;;
sparc-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/elf.h"
- tmake_file=sparc/t-elf
+ tmake_file="sparc/t-elf sparc/t-crtfm"
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
#float_format=i128
float_format=i64
@@ -3029,14 +3029,14 @@ sparc-*-linux*aout*) # Sparc's running GNU/Linux, a.out
;;
sparc-*-linux*libc1*) # Sparc's running GNU/Linux, libc5
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
- tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1"
+ tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 sparc/t-crtfm"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
gnu_ld=yes
float_format=sparc
;;
sparc-*-linux*) # Sparc's running GNU/Linux, libc6
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
- tmake_file="t-slibgcc-elf-ver t-linux"
+ tmake_file="t-slibgcc-elf-ver t-linux sparc/t-crtfm"
extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
gnu_ld=yes
if test x$enable_threads = xyes; then
@@ -3080,7 +3080,7 @@ sparcv9-*-solaris2* | sparc64-*-solaris2*)
tm_file=sparc/sol2-sld-64.h
fi
xm_defines=POSIX
- tmake_file="sparc/t-sol2 sparc/t-sol2-64"
+ tmake_file="sparc/t-sol2 sparc/t-sol2-64 sparc/t-crtfm"
if test x$gnu_ld = xyes; then
tmake_file="$tmake_file t-slibgcc-elf-ver"
else
@@ -3105,7 +3105,7 @@ sparcv9-*-solaris2* | sparc64-*-solaris2*)
sparc-hal-solaris2*)
xm_defines=POSIX
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/hal.h"
- tmake_file="sparc/t-halos sparc/t-sol2"
+ tmake_file="sparc/t-halos sparc/t-sol2 sparc/t-crtfm"
if test x$gnu_ld = xyes; then
tmake_file="$tmake_file t-slibgcc-elf-ver"
else
@@ -3130,7 +3130,7 @@ sparc-*-solaris2*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/sol2-sld.h"
fi
xm_defines=POSIX
- tmake_file=sparc/t-sol2
+ tmake_file="sparc/t-sol2 sparc/t-crtfm"
if test x$gnu_ld = xyes; then
tmake_file="$tmake_file t-slibgcc-elf-ver"
else
diff --git a/gcc/config/sparc/crtfastmath.c b/gcc/config/sparc/crtfastmath.c
new file mode 100644
index 00000000000..a0824a19733
--- /dev/null
+++ b/gcc/config/sparc/crtfastmath.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ * Contributed by David S. Miller (davem@redhat.com)
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file. (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * As a special exception, if you link this library with files
+ * compiled with GCC to produce an executable, this does not cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+#define FPRS_NS (1 << 22) /* Non-Standard fpu results */
+
+static void __attribute__((constructor))
+set_fast_math (void)
+{
+ unsigned long fsr;
+
+ /* This works for the 64-bit case because, even if 32-bit ld/st of
+ the fsr register modified the upper 32-bit, the only thing up there
+ are the 3 other condition codes which are "do not care" at the time
+ that this runs. */
+
+ __asm__("st %%fsr, %0"
+ : "=m" (fsr));
+
+ fsr |= FPRS_NS;
+
+ __asm__("ld %0, %%fsr"
+ : : "m" (fsr));
+}
diff --git a/gcc/config/sparc/elf.h b/gcc/config/sparc/elf.h
index 20bea820951..d2d3a0b74d3 100644
--- a/gcc/config/sparc/elf.h
+++ b/gcc/config/sparc/elf.h
@@ -26,7 +26,9 @@ Boston, MA 02111-1307, USA. */
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+#define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ crtend.o%s crtn.o%s"
/* Use the default. */
#undef LINK_SPEC
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index bc94de56020..1fb604e2a03 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -64,7 +64,8 @@ Boston, MA 02111-1307, USA. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
/* This is for -profile to use -lc_p instead of -lc. */
#undef CC1_SPEC
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index dee22e5f6fb..aa83342fc44 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -104,23 +104,28 @@ Boston, MA 02111-1307, USA. */
#define ENDFILE_SPEC64 \
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s"
+#define ENDFILE_SPEC_COMMON \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+
#ifdef SPARC_BI_ARCH
#if DEFAULT_ARCH32_P
#define ENDFILE_SPEC "\
%{m32:" ENDFILE_SPEC32 "} \
%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC32 "}}"
+%{!m32:%{!m64:" ENDFILE_SPEC32 "}} " \
+ENDFILE_SPEC_COMMON
#else
#define ENDFILE_SPEC "\
%{m32:" ENDFILE_SPEC32 "} \
%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC64 "}}"
+%{!m32:%{!m64:" ENDFILE_SPEC64 "}} " \
+ENDFILE_SPEC_COMMON
#endif
#else
-#define ENDFILE_SPEC ENDFILE_SPEC64
+#define ENDFILE_SPEC ENDFILE_SPEC64 " " ENDFILE_SPEC_COMMON
#endif
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
index 3541cace14c..305129b6b6e 100644
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -160,7 +160,9 @@ Boston, MA 02111-1307, USA. */
%{p|pg:-ldl} -lc}}"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+#define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ crtend.o%s crtn.o%s"
/* This should be the same as in svr4.h, except with -R added. */
#undef LINK_SPEC
diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h
index 2574c1ee423..caf944b33ff 100644
--- a/gcc/config/sparc/sp64-elf.h
+++ b/gcc/config/sparc/sp64-elf.h
@@ -71,7 +71,9 @@ crtbegin.o%s \
"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s"
+#define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ crtend.o%s"
/* Use the default (for now). */
#undef LIB_SPEC
diff --git a/gcc/config/sparc/t-crtfm b/gcc/config/sparc/t-crtfm
new file mode 100644
index 00000000000..744537db3bd
--- /dev/null
+++ b/gcc/config/sparc/t-crtfm
@@ -0,0 +1,4 @@
+EXTRA_PARTS += crtfastmath.o
+
+crtfastmath.o: $(srcdir)/config/sparc/crtfastmath.c $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtfastmath.o $(srcdir)/config/sparc/crtfastmath.c