Re: [PORTS] gcc 4.0 build failures on m68k, mips, and mipsel

Martin Pitt <[email protected]>
Newsgroups gmane.comp.db.postgresql.ports
Message-ID <[email protected]>
Hi! 

Tom Lane [2005-08-20 15:10 -0400]:
> Martin Pitt <[email protected]> writes:
> > However, Thiemo Seufer dealt with this and created a proper tas()
> > function for PostgreSQL on mips, which also works with gcc 4. Of
> > course this is much better, so I applied his patch in Debian.
> > I attach the patch. Do you consider applying it upstream?
> 
> Hm, does this patch actually compile as-is?  I'd think you'd need to
> have the MIPS definition of slock_t placed earlier than the assembly
> code fragment.

Sorry, I got the patch against 7.4 and I couldn't check it against 8.0
I fixed it for 8.0, and the new packages have finally built
successfully on mips:

http://buildd.debian.org/fetch.php?&pkg=postgresql-7.4&ver=1%3A7.4.8-17&arch=mips&stamp=1124942993&file=log&as=raw
http://buildd.debian.org/fetch.php?&pkg=postgresql-8.0&ver=8.0.3-14&arch=mips&stamp=1124946041&file=log&as=raw

I attach the updated patch against 8.0.

Sorry for the confusion, and thanks!

Martin
-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org
14-mips-gcc4.patch (text/plain, 1.6 KB)
diff -ruN postgresql-8.0.3-old/src/backend/storage/lmgr/s_lock.c postgresql-8.0.3/src/backend/storage/lmgr/s_lock.c
--- postgresql-8.0.3-old/src/backend/storage/lmgr/s_lock.c	2004-12-31 23:01:05.000000000 +0100
+++ postgresql-8.0.3/src/backend/storage/lmgr/s_lock.c	2005-08-23 19:30:19.000000000 +0200
@@ -172,7 +172,7 @@
 #endif   /* __m68k__ */
 
 
-#if defined(__mips__) && !defined(__sgi)
+#if defined(__mips__) && !defined(__sgi) && !defined(__linux__)
 static void
 tas_dummy()
 {
diff -ruN postgresql-8.0.3-old/src/include/storage/s_lock.h postgresql-8.0.3/src/include/storage/s_lock.h
--- postgresql-8.0.3-old/src/include/storage/s_lock.h	2005-08-23 19:30:18.000000000 +0200
+++ postgresql-8.0.3/src/include/storage/s_lock.h	2005-08-23 19:31:29.000000000 +0200
@@ -445,7 +445,32 @@
 #define HAS_TEST_AND_SET
 
 typedef unsigned int slock_t;
-#endif
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	register volatile slock_t *__l = lock;
+        register int __r;
+
+        __asm__ __volatile__(
+	       "       .set push           \n"
+	       "       .set mips2          \n"
+	       "       .set noreorder      \n"
+	       "       .set nomacro        \n"
+	       "1:     ll      %0, %1      \n"
+	       "       bne     %0, $0, 1f  \n"
+	       "        xori   %0, 1       \n"
+	       "       sc      %0, %1      \n"
+	       "       beq     %0, $0, 1b  \n"
+	       "        sync               \n"
+	       "1:     .set pop              "
+	       : "=&r" (__r), "+R" (*__l));
+	return __r;
+}
+
+#endif /* mips */
 
 
 #endif	/* __GNUC__ */
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDXaQDecnbV4Fd/IRAr/XAKCDHtg2BIsH0ekrMvjW5tj0tWoBNwCfYB3+
ePjMTjRBWk+L+9TyIERJ4H8=
=M2vq
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.