Skip to content

Commit

Permalink
Enable fenv for nanoMips
Browse files Browse the repository at this point in the history
Change-Id: I55882df7f8dac704b411daac6e386f8bd21ae79a
  • Loading branch information
Nikola Peric committed Jul 26, 2024
1 parent 2a4a94c commit b0f8b83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
14 changes: 10 additions & 4 deletions newlib/libm/machine/mips/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \
LIB_SOURCES = \
feclearexcept.c fegetenv.c fegetexceptflag.c \
fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c fenv.c

noinst_LIBRARIES = lib.a
lib_a_SOURCES = $(LIB_SOURCES)
Expand All @@ -19,12 +19,18 @@ include $(srcdir)/../../../Makefile.shared
LIBADD_OBJS = \
lib_a-fenv.$(OBJEXT)

# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction
ifeq ($(host_cpu),nanomips)
ADDITIONAL_FLAGS =
else
# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction
ADDITIONAL_FLAGS = -mno-mips16
endif

lib_a-fenv.o: fenv.c
$(COMPILE) -mno-mips16 -c -o $@ `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c
$(COMPILE) $(ADDITIONAL_FLAGS) -c -o $@ `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c

lib_a-fenv.obj: fenv.c
$(COMPILE) -mno-mips16 -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`
$(COMPILE) $(ADDITIONAL_FLAGS) -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`

ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
17 changes: 12 additions & 5 deletions newlib/libm/machine/mips/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ am__objects_1 = lib_a-feclearexcept.$(OBJEXT) lib_a-fegetenv.$(OBJEXT) \
lib_a-feholdexcept.$(OBJEXT) lib_a-feraiseexcept.$(OBJEXT) \
lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \
lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \
lib_a-feupdateenv.$(OBJEXT)
lib_a-feupdateenv.$(OBJEXT) lib_a-fenv.$(OBJEXT)
am_lib_a_OBJECTS = $(am__objects_1)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
Expand Down Expand Up @@ -223,7 +223,7 @@ INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \
LIB_SOURCES = \
feclearexcept.c fegetenv.c fegetexceptflag.c \
fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c fenv.c

noinst_LIBRARIES = lib.a
lib_a_SOURCES = $(LIB_SOURCES)
Expand Down Expand Up @@ -570,12 +570,19 @@ docbook: $(DOCBOOK_OUT_FILES)
${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
done

# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction
ifeq ($(host_cpu),nanomips)
ADDITIONAL_FLAGS =
else
# fenv.c cannot be compiled as mips16 since it uses the cfc1 instruction
ADDITIONAL_FLAGS = -mno-mips16
endif

lib_a-fenv.o: fenv.c
$(COMPILE) -mno-mips16 -c -o $@ `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c
$(COMPILE) $(ADDITIONAL_FLAGS) -c -o $@ `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c

lib_a-fenv.obj: fenv.c
$(COMPILE) -mno-mips16 -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`
$(COMPILE) $(ADDITIONAL_FLAGS) -c -o $@ `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi`


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
Expand Down

0 comments on commit b0f8b83

Please sign in to comment.