From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 8674F385781D; Fri, 4 Sep 2020 13:11:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8674F385781D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libm/riscv: Fix machine-specific sqrt build process X-Act-Checkin: newlib-cygwin X-Git-Author: Keith Packard via Newlib X-Git-Refname: refs/heads/master X-Git-Oldrev: cae21d17ade360b9eb490f2f637bf8a583380364 X-Git-Newrev: 373f628d043cbfb138c0f53c73cafb831bac621c Message-Id: <20200904131147.8674F385781D@sourceware.org> Date: Fri, 4 Sep 2020 13:11:47 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2020 13:11:47 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=373f628d043cbfb138c0f53c73cafb831bac621c commit 373f628d043cbfb138c0f53c73cafb831bac621c Author: Keith Packard via Newlib Date: Thu Sep 3 13:54:32 2020 -0700 libm/riscv: Fix machine-specific sqrt build process Like ARM, some RISC-V implementations have hardware sqrt. Support for that can be detected at compile time, which the code did. However, the filenames were incorrect so that both the risc-v specific and general code were getting included in the resulting library. Fix this by following the ARM model and #include'ing the general code when the architecture-specific support is not available. Signed-off-by: Keith Packard Diff: --- newlib/libm/machine/riscv/Makefile.am | 2 +- newlib/libm/machine/riscv/Makefile.in | 22 +++++++++++----------- newlib/libm/machine/riscv/{s_sqrt.c => e_sqrt.c} | 6 ++---- newlib/libm/machine/riscv/{sf_sqrt.c => ef_sqrt.c} | 6 ++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/newlib/libm/machine/riscv/Makefile.am b/newlib/libm/machine/riscv/Makefile.am index a7783797a..870f2a7b6 100644 --- a/newlib/libm/machine/riscv/Makefile.am +++ b/newlib/libm/machine/riscv/Makefile.am @@ -7,7 +7,7 @@ LIB_SOURCES = \ feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ - s_fma.c s_sqrt.c sf_fma.c sf_sqrt.c + s_fma.c e_sqrt.c sf_fma.c ef_sqrt.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) diff --git a/newlib/libm/machine/riscv/Makefile.in b/newlib/libm/machine/riscv/Makefile.in index c56830569..4ac1d30c4 100644 --- a/newlib/libm/machine/riscv/Makefile.in +++ b/newlib/libm/machine/riscv/Makefile.in @@ -77,8 +77,8 @@ am__objects_1 = lib_a-feclearexcept.$(OBJEXT) \ lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \ lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \ lib_a-feupdateenv.$(OBJEXT) lib_a-s_fma.$(OBJEXT) \ - lib_a-s_sqrt.$(OBJEXT) lib_a-sf_fma.$(OBJEXT) \ - lib_a-sf_sqrt.$(OBJEXT) + lib_a-e_sqrt.$(OBJEXT) lib_a-sf_fma.$(OBJEXT) \ + lib_a-ef_sqrt.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -207,7 +207,7 @@ LIB_SOURCES = \ feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ - s_fma.c s_sqrt.c sf_fma.c sf_sqrt.c + s_fma.c e_sqrt.c sf_fma.c ef_sqrt.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -363,11 +363,11 @@ lib_a-s_fma.o: s_fma.c lib_a-s_fma.obj: s_fma.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fma.obj `if test -f 's_fma.c'; then $(CYGPATH_W) 's_fma.c'; else $(CYGPATH_W) '$(srcdir)/s_fma.c'; fi` -lib_a-s_sqrt.o: s_sqrt.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_sqrt.o `test -f 's_sqrt.c' || echo '$(srcdir)/'`s_sqrt.c +lib_a-e_sqrt.o: e_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-e_sqrt.o `test -f 'e_sqrt.c' || echo '$(srcdir)/'`e_sqrt.c -lib_a-s_sqrt.obj: s_sqrt.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_sqrt.obj `if test -f 's_sqrt.c'; then $(CYGPATH_W) 's_sqrt.c'; else $(CYGPATH_W) '$(srcdir)/s_sqrt.c'; fi` +lib_a-e_sqrt.obj: e_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-e_sqrt.obj `if test -f 'e_sqrt.c'; then $(CYGPATH_W) 'e_sqrt.c'; else $(CYGPATH_W) '$(srcdir)/e_sqrt.c'; fi` lib_a-sf_fma.o: sf_fma.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fma.o `test -f 'sf_fma.c' || echo '$(srcdir)/'`sf_fma.c @@ -375,11 +375,11 @@ lib_a-sf_fma.o: sf_fma.c lib_a-sf_fma.obj: sf_fma.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fma.obj `if test -f 'sf_fma.c'; then $(CYGPATH_W) 'sf_fma.c'; else $(CYGPATH_W) '$(srcdir)/sf_fma.c'; fi` -lib_a-sf_sqrt.o: sf_sqrt.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_sqrt.o `test -f 'sf_sqrt.c' || echo '$(srcdir)/'`sf_sqrt.c +lib_a-ef_sqrt.o: ef_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ef_sqrt.o `test -f 'ef_sqrt.c' || echo '$(srcdir)/'`ef_sqrt.c -lib_a-sf_sqrt.obj: sf_sqrt.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_sqrt.obj `if test -f 'sf_sqrt.c'; then $(CYGPATH_W) 'sf_sqrt.c'; else $(CYGPATH_W) '$(srcdir)/sf_sqrt.c'; fi` +lib_a-ef_sqrt.obj: ef_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ef_sqrt.obj `if test -f 'ef_sqrt.c'; then $(CYGPATH_W) 'ef_sqrt.c'; else $(CYGPATH_W) '$(srcdir)/ef_sqrt.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ diff --git a/newlib/libm/machine/riscv/s_sqrt.c b/newlib/libm/machine/riscv/e_sqrt.c similarity index 94% rename from newlib/libm/machine/riscv/s_sqrt.c rename to newlib/libm/machine/riscv/e_sqrt.c index abccf4b1c..d6bfd90ad 100644 --- a/newlib/libm/machine/riscv/s_sqrt.c +++ b/newlib/libm/machine/riscv/e_sqrt.c @@ -46,8 +46,6 @@ __ieee754_sqrt (double x) return result; } -#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) -__strong_reference(__ieee754_sqrt, sqrt); -#endif - +#else +#include "../../math/e_sqrt.c" #endif diff --git a/newlib/libm/machine/riscv/sf_sqrt.c b/newlib/libm/machine/riscv/ef_sqrt.c similarity index 94% rename from newlib/libm/machine/riscv/sf_sqrt.c rename to newlib/libm/machine/riscv/ef_sqrt.c index 9a67906c9..1f378f547 100644 --- a/newlib/libm/machine/riscv/sf_sqrt.c +++ b/newlib/libm/machine/riscv/ef_sqrt.c @@ -46,8 +46,6 @@ __ieee754_sqrtf (float x) return result; } -#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) -__strong_reference(__ieee754_sqrtf, sqrtf); -#endif - +#else +#include "../../math/ef_sqrt.c" #endif