[PATCH v2 5/8] mips: Add C implementation of memcpy/memset

Maciej W. Rozycki macro@orcam.me.uk
Fri Jul 4 11:27:28 GMT 2025


On Thu, 3 Jul 2025, Jovan Dmitrovic wrote:

> >>> [...]/build/mipsel-linux-gnu/string/memcpy.o
> >>> ../sysdeps/mips/memcpy.c:78:6: error: "__mips_isa_rev" is not defined, evaluates to 0 [-Werror=undef]
> >>>      78 | #if (__mips_isa_rev < 6 && !defined(__mips1)) || defined(__nanomips__)
> >>>         |      ^~~~~~~~~~~~~~
> >>> ../sysdeps/mips/memcpy.c:86:6: error: "__mips_isa_rev" is not defined, evaluates to 0 [-Werror=undef]
> >>>      86 |  #if __mips_isa_rev >= 6 && !defined(__nanomips__)
> >>>         |      ^~~~~~~~~~~~~~
> >>> cc1: all warnings being treated as errors

 Umm, I've only noticed the details of these error messages now.  Since 
support for the nanoMIPS ISA is a separate port, as it's an entirely new 
instruction set (and a distinct `e_machine' setting IIRC), you'll have to 
split any code changes related to that port off, and submit separately 
along with any other bits required for the nanoMIPS ISA (which, again, 
will only be eligible for inclusion with glibc once we have nanoMIPS ISA 
support in place with the toolchain).

 FWIW, this change fails to build here as well:

../sysdeps/mips/memcpy.c:74:6: error: "__mips_isa_rev" is not defined, evaluates to 0 [-Werror=undef]
   74 | #if (__mips_isa_rev < 6 && !defined(__mips1))
      |      ^~~~~~~~~~~~~~
../sysdeps/mips/memcpy.c:82:6: error: "__mips_isa_rev" is not defined, evaluates to 0 [-Werror=undef]
   82 |  #if __mips_isa_rev >= 6
      |      ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

with a compiler configured as follows:

$ mips-linux-gnu-gcc -v --version
[...]
Target: mips-linux-gnu
Configured with: /path/to/src/gcc/configure CFLAGS='-pipe -O2 -g0' CXXFLAGS='-pipe -O2 -g0' FCFLAGS='-pipe -O2 -g0' 'CFLAGS_FOR_TARGET=-pipe -O2 -g0' 'CXXFLAGS_FOR_TARGET=-pipe -O2 -g0' 'FCFLAGS_FOR_TARGET=-pipe -O2 -g0' --enable-werror-always --cache-file=/dev/null --disable-nls --disable-version-specific-runtime-libs --disable-multilib --enable-languages=all --with-build-sysroot=/path/to/install/usr/sysroot --with-sysroot=/usr/sysroot --prefix=/usr --with-toolexeclibdir=/usr/sysroot/usr/lib --target=mips-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)
[...]

You can try and use these options to reproduce a similar compiler 
configuration, but overall you do need to include <sysdep.h> from your 
code, just as Adhemerval says.

  Maciej


More information about the Libc-alpha mailing list