Skip to contentSkip to conversation

postgresql: fix sparc compile issue

PATCH Superseded Waldemar Brodkorb 2 participants 2 messages Aug 9, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 postgresql: fix sparc compile issue

Fixes autobuilder compile error:
http://autobuild.buildroot.net/results/f374d3535cf91f139ce80703cd2d0a2be5d3b2b1/

The predefines are wrong:
./output/host/usr/bin/sparc-buildroot-linux-uclibc-gcc -dM -E - </dev/null|grep sparc #define sparc 1
#define __sparc__ 1
#define __sparc 1
#define __sparc_v8__ 1

---
 package/postgresql/0001-fix-sparcv8-compile.patch |   38 +++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 package/postgresql/0001-fix-sparcv8-compile.patch
package/postgresql/0001-fix-sparcv8-compile.patch new file +38 -0
new file mode 100644
index 0000000..cde5434
@@ -0,0 +1,38 @@
+The gcc predefines in 4.9.x are __sparc_v8__/__sparc_v7__.
+
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+
+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 11:17:48.000000000 +0200
+@@ -420,12 +420,12 @@
+ :		"=r"(_res), "+m"(*lock)
+ :		"r"(lock)
+ :		"memory");
+-#if defined(__sparcv7)
++#if defined(__sparc_v7__)
+ 	/*
+ 	 * No stbar or membar available, luckily no actually produced hardware
+ 	 * requires a barrier.
+ 	 */
+-#elif defined(__sparcv8)
++#elif 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(__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(__sparc_v8__)
+ /* stbar is available (and required for both PSO, RMO), membar isn't */
+ #define S_UNLOCK(lock)	\
+ do \
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 postgresql: fix sparc compile issue

Waldemar,

Quoted 9 lines · Waldemar Brodkorb

Fixes autobuilder compile error:
http://autobuild.buildroot.net/results/f374d3535cf91f139ce80703cd2d0a2be5d3b2b1/

The predefines are wrong:
./output/host/usr/bin/sparc-buildroot-linux-uclibc-gcc -dM -E - </dev/null|grep sparc #define sparc 1
#define __sparc__ 1
#define __sparc 1
#define __sparc_v8__ 1

As discussed on IRC, can you respin after using #if defined(__sparcv8) || defined(__sparc_v8__), so that it continue to works on Solaris (for which __sparcv8 is defined). This way you can submit the patch upstream.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com