pg.ddx.io  pgsql-ports@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Pitt <martin@piware.de>
To: pgsql-ports@postgresql.org
Subject: Re: gcc 4.0 build failures on m68k, mips, and mipsel
Date: Sat, 20 Aug 2005 17:40:44 +0200
Message-ID: <20050820154044.GA7412@piware.de> (raw)
In-Reply-To: <20050724155941.GA27638@piware.de>
References: <20050724155941.GA27638@piware.de>

Hi again,

Martin Pitt [2005-07-24 17:59 +0200]:
> I noticed that PostgreSQL does not build any more with gcc 4.0 on
> m68k, mips, and mipsel because of bugs/incompatibilities in
> src/include/storage/s_lock.h.
> [...]
> However, since I don't have access to a mips/mipsel machine with gcc
> 4.0, I was unable to fix the problem myself, so I just disabled
> spinlocks on these two architectures in Debian for now (which sucks,
> but at least the package builds and works). Does anybody here have a
> MIPS machine and could try this?

A better workaround than disabling spinlocks at all is to compile
s_lock.c with -fno-unit-at-a-time (this is the default in gcc 4 and
breaks it; that was the reason why it worked with gcc 3.3).

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?

Thanks and have a nice weekend,

Martin
-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

Attachments:

14-mips-gcc4.patch (text/plain, 1.6K) download 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-20 17:32:15.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-20 17:30:57.000000000 +0200 +++ postgresql-8.0.3/src/include/storage/s_lock.h 2005-08-20 17:32:15.000000000 +0200 @@ -367,6 +367,33 @@ #endif /* __vax__ */ +#if defined(__mips__) && defined(__linux__) +#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 */ + #if defined(__ns32k__) #define HAS_TEST_AND_SET
signature.asc (application/pgp-signature, 188B) download

view thread (6+ messages)  latest in thread

Message-ID: <20050820154044.GA7412@piware.de>
Permalink:  ../20050820154044.GA7412@piware.de/
Also on:    postgresql.org/message-id/20050820154044.GA7412@piware.de

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-ports@postgresql.org
  Cc: martin@piware.de
  Subject: Re: gcc 4.0 build failures on m68k, mips, and mipsel
  In-Reply-To: <20050820154044.GA7412@piware.de>
  References: <20050724155941.GA27638@piware.de> <20050820154044.GA7412@piware.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox