X-Original-To: pgsql-ports-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B1B852F11 for ; Sat, 20 Aug 2005 12:41:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65617-02 for ; Sat, 20 Aug 2005 15:41:05 +0000 (GMT) Received: from mail.pironet-ndh.com (mail01.pironet-ndh.com [194.64.31.10]) by svr1.postgresql.org (Postfix) with ESMTP id 9188D52EB9 for ; Sat, 20 Aug 2005 12:41:02 -0300 (ADT) Received: from mail.fbn-dd.de (mail.fbn-dd.de [195.227.105.178]) by mail.pironet-ndh.com (Postfix) with ESMTP id DF7AFECC1E for ; Sat, 20 Aug 2005 17:40:55 +0200 (CEST) Received: from sonne.intranet.fbn-dd.de (192-168-0-1.transfer-000.intranet.fbn-dd.de [192.168.0.1]) by mail.fbn-dd.de (Postfix) with ESMTP id 4F43634E72 for ; Sat, 20 Aug 2005 17:40:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by sonne.intranet.fbn-dd.de (Postfix) with ESMTP id D848D20285 for ; Sat, 20 Aug 2005 17:40:55 +0200 (CEST) Received: from sonne.intranet.fbn-dd.de (localhost [127.0.0.1]) by localhost (AvMailGate-2.0.1.16) id 20972-531F3718; Sat, 20 Aug 2005 17:40:55 +0200 Received: from localhost.localdomain (10-28-129-83.intranet-28-129.fbn-dd.de [10.28.129.83]) by sonne.intranet.fbn-dd.de (Postfix) with ESMTP id 8EE7D20285 for ; Sat, 20 Aug 2005 17:40:55 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 1000) id F0CCB299A; Sat, 20 Aug 2005 17:40:44 +0200 (CEST) Date: Sat, 20 Aug 2005 17:40:44 +0200 From: Martin Pitt To: pgsql-ports@postgresql.org Subject: Re: gcc 4.0 build failures on m68k, mips, and mipsel Message-ID: <20050820154044.GA7412@piware.de> Mail-Followup-To: pgsql-ports@postgresql.org References: <20050724155941.GA27638@piware.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline In-Reply-To: <20050724155941.GA27638@piware.de> User-Agent: Mutt/1.5.9i X-AntiVirus: checked by AntiVir MailGate (version: 2.0.1.16; AVE: 6.31.1.0; VDF: 6.31.1.151; host: sonne) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200508/11 X-Sequence-Number: 2186 --IiVenqGWf+H9Y6IX Content-Type: multipart/mixed; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 --=20 Martin Pitt http://www.piware.de Ubuntu Developer http://www.ubuntu.com Debian Developer http://www.debian.org --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="14-mips-gcc4.patch" Content-Transfer-Encoding: quoted-printable 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__ */ =20 =20 -#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.0= 00000000 +0200 +++ postgresql-8.0.3/src/include/storage/s_lock.h 2005-08-20 17:32:15.00000= 0000 +0200 @@ -367,6 +367,33 @@ =20 #endif /* __vax__ */ =20 +#if defined(__mips__) && defined(__linux__) +#define TAS(lock) tas(lock) + +static __inline__ int +tas(volatile slock_t *lock) +{ + register volatile slock_t *__l =3D 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 " + : "=3D&r" (__r), "+R" (*__l)); + return __r; +} + +#endif /* mips */ + =20 #if defined(__ns32k__) #define HAS_TEST_AND_SET --zhXaljGHf11kAtnf-- --IiVenqGWf+H9Y6IX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDB078DecnbV4Fd/IRAq0bAJoC/aQRTS1qH5PWiY8SlcMM31rRzACgj8Yi DEMo6sZDZOgd4AXWlJHkpxo= =k55h -----END PGP SIGNATURE----- --IiVenqGWf+H9Y6IX--