Re: Compilation for mips-mti-elf fails
Jeff Johnston <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAOox84ttb5szmu+J+zOySvXJwmkkq0=-DarD+qve2FGUaBCzjw@mail.gmail.com> |
Hi Marian, Thanks for the patch. That directory has a Makefile.am file so it must be modified and the Makefile.in generated. I have included a modified version of your patch. If you have no objections, I'll check it in. Regards, -- Jeff J. On Thu, Nov 25, 2021 at 4:04 PM Marian Buschsieweke < [email protected]> wrote: > Hi, > > compiling for newlib with GCC 11.2.0 for mips-mti-elf with multilib > now fails with "Error: unrecognized opcode `cfc1 $3,$31'" while compiling > newlib/libm/machine/mips/fenv.c > > More precisely, newlib/libc/machine/mips/machine/fenv-fp.h included by > fenv.c > contains multiple calls of the function line macro __cfc1() which is > defined in > newlib/libc/machine/mips/sys/fenv.h as > > #define __cfc1(__fcsr) __asm __volatile("cfc1 %0, $31" : "=r" > (__fcsr)) > > Apparently, this is not compatible with mips16. Adding -mno-mips16 to the > invocation of the compiler fixes the comiplation. (The same was already > done for > cma101.c and cygmon.c in libgloss.) > > Attached is a potential fix. > > Kind regards, > Marian >
0001-Modifying-patch-from-marian.buschsieweke-ovgu.de.patch
(text/x-patch, 4.9 KB)
From f3df3e145d1b2a54a248db3a2a68271664dde86c Mon Sep 17 00:00:00 2001 From: Jeff Johnston <[email protected]> Date: Mon, 29 Nov 2021 17:33:52 -0500 Subject: [PATCH] Modifying patch from: [email protected] The code accessing the floating point control/status register, namely #define __cfc1(__fcsr) __asm __volatile("cfc1 %0, $31" : "=r" (__fcsr) does not compile with mips16. This changed the makefile to pass -mno-mips16 to avoid the following compiler error: mips-mti-elf fails with "Error: unrecognized opcode `cfc1 $3,$31'" --- newlib/libm/machine/mips/Makefile.am | 12 ++++++++++-- newlib/libm/machine/mips/Makefile.in | 21 ++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/newlib/libm/machine/mips/Makefile.am b/newlib/libm/machine/mips/Makefile.am index bb142a6..cef4957 100644 --- a/newlib/libm/machine/mips/Makefile.am +++ b/newlib/libm/machine/mips/Makefile.am @@ -6,8 +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 \ - fenv.c + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -17,5 +16,14 @@ noinst_DATA = include $(srcdir)/../../../Makefile.shared +LIBADD_OBJS = \ + lib_a-fenv.$(OBJEXT) + +lib_a-fenv.o: fenv.c + $(COMPILE) -mno-mips16 -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` + ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libm/machine/mips/Makefile.in b/newlib/libm/machine/mips/Makefile.in index 2a42145..cfab717 100644 --- a/newlib/libm/machine/mips/Makefile.in +++ b/newlib/libm/machine/mips/Makefile.in @@ -75,7 +75,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-fenv.$(OBJEXT) + lib_a-feupdateenv.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -189,6 +189,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ +shared_machine_dir = @shared_machine_dir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sys_dir = @sys_dir@ @@ -203,8 +204,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 \ - fenv.c + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -221,6 +221,9 @@ DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) +LIBADD_OBJS = \ + lib_a-fenv.$(OBJEXT) + ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -348,12 +351,6 @@ lib_a-feupdateenv.o: feupdateenv.c lib_a-feupdateenv.obj: feupdateenv.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.obj `if test -f 'feupdateenv.c'; then $(CYGPATH_W) 'feupdateenv.c'; else $(CYGPATH_W) '$(srcdir)/feupdateenv.c'; fi` -lib_a-fenv.o: fenv.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.o `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c - -lib_a-fenv.obj: fenv.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.obj `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi` - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -554,6 +551,12 @@ docbook: $(DOCBOOK_OUT_FILES) ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \ done +lib_a-fenv.o: fenv.c + $(COMPILE) -mno-mips16 -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` + # 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. .NOEXPORT: -- 1.8.3.1