Обсуждение: linux sparc compile issue
Hi, while doing regular builds via buildroot autobuilders a compile problem for sparc 32bit v8 was found. It seems the defines for Linux are other than for Solaris. Following patch fixes it for buildroot: The gcc predefines for Linux are __sparc_v8__/__sparc_v7__ Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> diff -Nur postgresql-9.4.4.orig/src/include/storage/s_lock.h postgresql-9.4.4/src/include/storage/s_lock.h --- postgresql-9.4.4.orig/src/include/storage/s_lock.h 2015-06-09 21:29:38.000000000 +0200 +++ postgresql-9.4.4/src/include/storage/s_lock.h 2015-08-09 19:57:06.000000000 +0200 @@ -420,12 +420,12 @@: "=r"(_res), "+m"(*lock): "r"(lock): "memory"); -#if defined(__sparcv7) +#if defined(__sparcv7) || defined(__sparc_v7__) /* * No stbar or membar available, luckily no actually produced hardware * requires a barrier. */ -#elif defined(__sparcv8) +#elif defined(__sparcv8) || defined(__sparc_v8__) /* stbar is available (and required for both PSO, RMO), membar isn't*/ __asm__ __volatile__ ("stbar \n":::"memory");#else @@ -438,13 +438,13 @@ return (int) _res;} -#if defined(__sparcv7) +#if defined(__sparcv7) || defined(__sparc_v7__)/* * No stbar or membar available, luckily no actually produced hardware* requires a barrier. */#define S_UNLOCK(lock) (*((volatile slock_t *) (lock)) = 0) -#elif defined(__sparcv8) +#elif defined(__sparcv8) || defined(__sparc_v8__)/* stbar is available (and required for both PSO, RMO), membar isn't */#defineS_UNLOCK(lock) \do \
Waldemar Brodkorb <wbx@openadk.org> writes: > while doing regular builds via buildroot autobuilders > a compile problem for sparc 32bit v8 was found. > It seems the defines for Linux are other than for Solaris. > Following patch fixes it for buildroot: > The gcc predefines for Linux are __sparc_v8__/__sparc_v7__ I've applied your suggested patch for this, but I'm a bit curious what version of gcc you are using; our code's been like that for a very long time and nobody complained before. regards, tom lane
On 2015-08-10 17:36:57 -0400, Tom Lane wrote: > Waldemar Brodkorb <wbx@openadk.org> writes: > > while doing regular builds via buildroot autobuilders > > a compile problem for sparc 32bit v8 was found. > > It seems the defines for Linux are other than for Solaris. > > > Following patch fixes it for buildroot: > > The gcc predefines for Linux are __sparc_v8__/__sparc_v7__ > > I've applied your suggested patch for this, but I'm a bit curious what > version of gcc you are using; our code's been like that for a very long > time and nobody complained before. Hm. Could this be caused by using a new solaris studio compiler? It apparently uses gcc as a frontend and thus might actually reach that bit of code. Greetings, Andres Freund
Hi Tom, Tom Lane wrote, > Waldemar Brodkorb <wbx@openadk.org> writes: > > while doing regular builds via buildroot autobuilders > > a compile problem for sparc 32bit v8 was found. > > It seems the defines for Linux are other than for Solaris. > > > Following patch fixes it for buildroot: > > The gcc predefines for Linux are __sparc_v8__/__sparc_v7__ > > I've applied your suggested patch for this, but I'm a bit curious what > version of gcc you are using; our code's been like that for a very long > time and nobody complained before. Thanks. The cross-compiler we use is gcc 4.9.3. But also the native gcc on my Sun Voyager running Debian 4.0 have it: platin:~# gcc -dM -E - </dev/null|grep sparc #define sparc 1 #define __sparc__ 1 #define __sparc 1 #define __sparc_v8__ 1 platin:~# gcc -v Using built-in specs. Target: sparc-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-cpu=v8 --enable-checking=release sparc-linux-gnu Thread model: posix gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) platin:~# cat /etc/debian_version 4.0 The last supported Debian is delivering Postgresql 7.5.22. I think this version did not contained the code: platin:~/postgresql-7.5.22# find . -name \*lock.h platin:~/postgresql-7.5.22# grep -r sparc * So may be buildroot is one of the few projects supporting sparcv8 for 32 Bit sparc machines. best regardsWaldemar