Re: BUG #15844: MIPS: remove .set mips2 in s_lock.h to fix r6 build

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: YunQiang Su <wzssyqa@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2019-06-16T04:28:02Z
Lists: pgsql-bugs
YunQiang Su <wzssyqa@gmail.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> 于2019年6月16日周日 上午11:32写道:
>> experimentation that NetBSD as of 7.0.2 doesn't default to assuming

> I have no idea about NetBSD. Can you run gcc -v on it?

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: mipsel--netbsd
Configured with: /usr/7/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=mipsel--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20150115' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-threads --enable-libstdcxx-time=rt --enable-lto --with-mpc-lib=/var/obj/mknative/pmax-mipsel/usr/7/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/pmax-mipsel/usr/7/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/pmax-mipsel/usr/7/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/7/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/7/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/7/src/external/lgpl3/gmp/lib/libgmp/arch/mipsel --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd6.0. --host=mipsel--netbsd --with-sysroot=/var/obj/mknative/pmax-mipsel/usr/7/src/destdir.pmax
Thread model: posix
gcc version 4.8.4 (nb2 20150115) 

I found that specifying -march=mips2 gets it to accept the s_lock.h
code without ".set mips2".  Given that we don't make any pretense of
actually running on MIPS-I hardware, I wonder if some hack involving
forcing -march would be sane?  You'd get better code quality across
the board, presumably.

Also, checking the predefined symbols on this gcc, I don't see
anything about __mips_isa_rev, but I do see that "__mips" is defined
and -march=mips2 changes it from "1" to "2".  So I'm wondering about
some test along the lines of

#if __mips_isa_rev > 0 || __mips == 1
#define FORCE_MIPS2_ARCHITECTURE
#endif

or alternatively, teach configure to force -march=mips2 if it sees
that "__mips" is predefined as 1.

(BTW, have you got any recommendations for booting recent Debian/MIPS
under qemu?  I can't get anything newer than wheezy to work.)

			regards, tom lane



Commits

  1. Fix spinlock assembly code for MIPS so it works on MIPS r6.