From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
To: newlib@sourceware.org
Subject: Compilation for mips-mti-elf fails
Date: Thu, 25 Nov 2021 22:04:13 +0100 [thread overview]
Message-ID: <20211125220413.35e7869f@faultier2go.lan> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 716 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: fix-mips-mti-elf.patch --]
[-- Type: text/x-patch, Size: 1439 bytes --]
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-4.1.0/newlib/libm/machine/mips/Makefile.in.orig 2021-11-12 11:49:11.691337941 +0100
+++ newlib-4.1.0/newlib/libm/machine/mips/Makefile.in 2021-11-12 11:48:21.181600000 +0100
@@ -349,7 +349,7 @@ 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
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -mno-mips16 -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`
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next reply other threads:[~2021-11-25 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 21:04 Marian Buschsieweke [this message]
2021-11-29 23:27 ` Jeff Johnston
2022-02-07 6:42 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211125220413.35e7869f@faultier2go.lan \
--to=marian.buschsieweke@ovgu.de \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).