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

From: YunQiang Su <wzssyqa(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15844: MIPS: remove .set mips2 in s_lock.h to fix r6 build
Date: 2019-06-16 04:38:05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2019年6月16日周日 下午12:28写道:
> YunQiang Su <wzssyqa(at)gmail(dot)com> writes:
> > Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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_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= --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.

-march is not a good idea, since r6 cannot compatible with the previous version.
If you use -march=mips2 or something else, it will failed to build for r6.
Which -march to use should be determined by finial user or distribution vendor.

If the vendor of NetBSD believe they have no need to support so old hardware,
they should change the options that they build their gcc.

For example build gcc with "--with-arch-32=mips32r2" or similar.

> 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
> #endif
> or alternatively, teach configure to force -march=mips2 if it sees
> that "__mips" is predefined as 1.

If you wish to use __mips, you can just use
#if __mips > 1

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

I have an r6 one:
It is buster.

And I will figure out a r2 one for you.

> regards, tom lane

YunQiang Su

In response to


Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-06-16 12:35:07 BUG #15854: postgres wtih Docker: binding port fails with release greater than 9.6.13
Previous Message Tom Lane 2019-06-16 04:28:02 Re: BUG #15844: MIPS: remove .set mips2 in s_lock.h to fix r6 build