From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martin Pitt <martin@piware.de>
Cc: pgsql-ports@postgresql.org
Subject: Re: gcc 4.0 build failures on m68k, mips, and mipsel
Date: Thu, 25 Aug 2005 13:23:49 -0400
Message-ID: <331.1124990629@sss.pgh.pa.us> (raw)
In-Reply-To: <20050825074312.GA8461@piware.de>
References: <20050724155941.GA27638@piware.de>
<20050820154044.GA7412@piware.de>
<2290.1124565042@sss.pgh.pa.us>
<20050825074312.GA8461@piware.de>
Martin Pitt <martin@piware.de> 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.
> I attach the updated patch against 8.0.
OK, better, but I think not quite there yet. AFAICS the s_lock.c code
should simply go away, as there are no platforms for which it'd be used.
Also, the constraints for the inline assembler ought to include memory
and cc clobbers, according to the comments near the head of s_lock.h.
I've applied the attached modified patch to CVS HEAD, but can't test it
without a MIPS machine ... could you double-check it?
regards, tom lane
inline patch 1: src/backend/storage/lmgr/s_lock.c, src/include/storage/s_lock.h (+35/-35 lines) download inline-1.patch*** src/backend/storage/lmgr/s_lock.c.orig Fri Jul 29 23:07:40 2005
--- src/backend/storage/lmgr/s_lock.c Thu Aug 25 13:14:27 2005
***************
*** 172,205 ****
#endif /* __m68k__ */
- #if defined(__mips__) && !defined(__sgi)- static void- tas_dummy()- {- __asm__ __volatile__(- "\- .global tas \n\- tas: \n\- .frame $sp, 0, $31 \n\- .set push \n\- .set mips2 \n\- ll $14, 0($4) \n\- or $15, $14, 1 \n\- sc $15, 0($4) \n\- .set pop \n\- beq $15, 0, fail\n\- bne $14, 0, fail\n\- li $2, 0 \n\- .livereg 0x2000FF0E,0x00000FFF \n\- j $31 \n\- fail: \n\- li $2, 1 \n\- j $31 \n\- ");- }- #endif /* __mips__ && !__sgi */- -
#else /* not __GNUC__ */
/*
--- 172,177 ----
*** src/include/storage/s_lock.h.orig Thu Mar 10 16:41:01 2005
--- src/include/storage/s_lock.h Thu Aug 25 13:14:21 2005
***************
*** 453,472 ****
#endif /* __alpha || __alpha__ */
! /* These live in s_lock.c, but only for gcc */
! #if defined(__m68k__)
! #define HAS_TEST_AND_SET
! typedef unsigned char slock_t;
! #endif
! #if defined(__mips__) && !defined(__sgi)
#define HAS_TEST_AND_SET
! typedef unsigned int slock_t;
#endif
--- 453,500 ----
#endif /* __alpha || __alpha__ */
! #if defined(__mips__) && !defined(__sgi)
! /* Note: on SGI we use the OS' mutex ABI, see below */
! #define HAS_TEST_AND_SET
+ typedef unsigned int slock_t;
! #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)
! :
! : "memory", "cc");
! return __r;
! }
+ #endif /* __mips__ && !__sgi */
!
! /* These live in s_lock.c, but only for gcc */
!
!
! #if defined(__m68k__)
#define HAS_TEST_AND_SET
! typedef unsigned char slock_t;
#endif
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: tgl@sss.pgh.pa.us, martin@piware.de
Subject: Re: gcc 4.0 build failures on m68k, mips, and mipsel
In-Reply-To: <331.1124990629@sss.pgh.pa.us>
References: <20050724155941.GA27638@piware.de> <20050820154044.GA7412@piware.de> <2290.1124565042@sss.pgh.pa.us> <20050825074312.GA8461@piware.de> <331.1124990629@sss.pgh.pa.us>
* 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