diff options
author | Andrea Ornstein <andrea.ornstein@st.com> | 2008-04-23 09:26:37 +0000 |
---|---|---|
committer | Andrea Ornstein <andrea.ornstein@st.com> | 2008-04-23 09:26:37 +0000 |
commit | 9d987525d59a182bdc654bdfbf5c0a64d8aaf0ba (patch) | |
tree | 9b1c35ef94f9729b26816f84b7d0bdc1071f231f | |
parent | 8d80e96f95d9af5fb13500ab1a26b81163e97f66 (diff) |
add implementation of new libgcc4net methods (__EndianSelect and Shutdown)
add file libstd-support.c with implementation of low level calls of libstd not present in libc/libm
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli@134585 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libcilsupport/Makefile.am | 2 | ||||
-rw-r--r-- | libcilsupport/Makefile.in | 6 | ||||
-rw-r--r-- | libcilsupport/configure.ac | 2 | ||||
-rw-r--r-- | libcilsupport/gcc4net-support.c | 21 | ||||
-rw-r--r-- | libcilsupport/libstd-support.c | 131 | ||||
-rw-r--r-- | libcilsupport/runtime-support.c | 2 |
6 files changed, 160 insertions, 4 deletions
diff --git a/libcilsupport/Makefile.am b/libcilsupport/Makefile.am index fe0ffe64063..29343888e82 100644 --- a/libcilsupport/Makefile.am +++ b/libcilsupport/Makefile.am @@ -25,7 +25,6 @@ # Andrea C. Ornstein <andrea.ornstein@st.com> # Erven Rohou <erven.rohou@st.com> -AUTOMAKE_OPTIONS = 1.9.5 foreign ACLOCAL_AMFLAGS = -I .. -I ../config # May be used by various substitution variables. @@ -35,6 +34,7 @@ toolexeclib_LTLIBRARIES = libcilsupport.la libcilsupport_la_SOURCES = \ gcc4net-support.c \ + libstd-support.c \ runtime-support.c # No install-html or install-pdf support in automake yet diff --git a/libcilsupport/Makefile.in b/libcilsupport/Makefile.in index dfd0dc6ae4e..2d776e56fb9 100644 --- a/libcilsupport/Makefile.in +++ b/libcilsupport/Makefile.in @@ -91,7 +91,8 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(toolexeclib_LTLIBRARIES) libcilsupport_la_LIBADD = -am_libcilsupport_la_OBJECTS = gcc4net-support.lo runtime-support.lo +am_libcilsupport_la_OBJECTS = gcc4net-support.lo libstd-support.lo \ + runtime-support.lo libcilsupport_la_OBJECTS = $(am_libcilsupport_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/../depcomp @@ -221,7 +222,6 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ -AUTOMAKE_OPTIONS = 1.9.5 foreign ACLOCAL_AMFLAGS = -I .. -I ../config # May be used by various substitution variables. @@ -229,6 +229,7 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) toolexeclib_LTLIBRARIES = libcilsupport.la libcilsupport_la_SOURCES = \ gcc4net-support.c \ + libstd-support.c \ runtime-support.c all: all-am @@ -305,6 +306,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcc4net-support.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd-support.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime-support.Plo@am__quote@ .c.o: diff --git a/libcilsupport/configure.ac b/libcilsupport/configure.ac index 46688385ca3..623b97a2146 100644 --- a/libcilsupport/configure.ac +++ b/libcilsupport/configure.ac @@ -33,7 +33,7 @@ AC_PREREQ(2.59) AC_INIT(clisupport, 0.1) AC_CONFIG_SRCDIR(gcc4net-support.c) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([1.9.5 foreign]) AM_MAINTAINER_MODE AC_EXEEXT diff --git a/libcilsupport/gcc4net-support.c b/libcilsupport/gcc4net-support.c index 81403045763..32b3e31c5ba 100644 --- a/libcilsupport/gcc4net-support.c +++ b/libcilsupport/gcc4net-support.c @@ -1,5 +1,7 @@ /* + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Contributed by STMicroelectronics This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -44,6 +46,12 @@ gcc4net_StartupHelper_Startup_System_Void (void) /* TODO */ } +void +gcc4net_StartupHelper_Shutdown_System_Int32_System_Void (int eval) +{ + /* TODO */ +} + int gcc4net_Crt___isLittleEndian_System_Boolean (void) { @@ -53,3 +61,16 @@ gcc4net_Crt___isLittleEndian_System_Boolean (void) char *b = (char *) &d; return b[0] == 0; } + +void* +gcc4net_Crt___EndianSelect_System_Void__System_Void__System_Void_ (void* a1, void* a2) +{ + // big endian: 3f f0 00 00 00 00 00 00 + // little endian: 00 00 00 00 00 00 f0 3f + double d = 1.0; + char *b = (char *) &d; + if (b[0]==0) + return a1; + else + return a2; +} diff --git a/libcilsupport/libstd-support.c b/libcilsupport/libstd-support.c new file mode 100644 index 00000000000..a13fd4b316b --- /dev/null +++ b/libcilsupport/libstd-support.c @@ -0,0 +1,131 @@ +/* + + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Contributed by STMicroelectronics + + This program 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. + + This program 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; if not, write to the Free Software + Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! + + Author: + Ricardo Fernandez Pascual <ricardof@um.es> + Andrea C. Ornstein <andrea.ornstein@st.com> + + Contact information at STMicroelectronics: + Andrea C. Ornstein <andrea.ornstein@st.com> + Erven Rohou <erven.rohou@st.com> +*/ + +/* These should not be here, they are from stdlib.dll */ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <float.h> + +/* used in stdio.h */ +FILE * +__io_ftable_get_entry (int i) +{ + switch (i) { + case 0: + return stdin; + case 1: + return stdout; + case 2: + return stderr; + default: + abort (); + } +} + +/* used in errno.h */ +int * +__errno__get_ptr (void) +{ + return &errno; +} + +/* used in float.h */ +int +__flt_rounds (void) +{ + return 1; +} +float +__flt_nan (void) +{ + return __builtin_nanf (""); +} +float +__flt_infinity (void) +{ + return __builtin_inff(); +} +float +__flt_epsilon (void) +{ + return FLT_EPSILON; +} +float +__flt_minval (void) +{ + return FLT_MIN; +} +float +__flt_maxval (void) +{ + return FLT_MAX; +} +float +__flt_hugeval (void) +{ + return __builtin_huge_valf(); +} +double +__dbl_epsilon (void) +{ + return DBL_EPSILON; +} +double +__dbl_minval (void) +{ + return DBL_MIN; +} +double +__dbl_maxval (void) +{ + return DBL_MAX; +} +double +__dbl_hugeval (void) +{ + return __builtin_huge_val(); +} + +/* Redefined in stdlib.h to avoid problems */ +int +Libstd_atexit (void (*function) (void)) +{ + return atexit (function); +} + +void +_libstd__init_System_Void (void) +{ +} diff --git a/libcilsupport/runtime-support.c b/libcilsupport/runtime-support.c index 4a9380b1a67..474cc3f9a75 100644 --- a/libcilsupport/runtime-support.c +++ b/libcilsupport/runtime-support.c @@ -1,5 +1,7 @@ /* + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Contributed by STMicroelectronics This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the |