From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [BUGS] Compile fails on AIX 6.1
Date: Sat, 29 Aug 2015 01:42:39 -0400
Message-ID: <20150829054239.GA2556062@tornado.leadboat.com> (raw)
In-Reply-To: <19828.1440770326@sss.pgh.pa.us>
References: <1823346352.314711.1405443099463.open-xchange@oxbaltgw55.schlund.de>
<14934.1440686206@sss.pgh.pa.us>
<20150828070203.GA2534837@tornado.leadboat.com>
<19828.1440770326@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On Fri, Aug 28, 2015 at 09:58:46AM -0400, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Thu, Aug 27, 2015 at 10:36:46AM -0400, Tom Lane wrote:
> >> So s_lock.h's PowerPC assembly code works if you have gcc configured to
> >> use gas as backend, but not if it's configured to use the native AIX
> >> assembler. Steve says the latter configuration is pretty common.
>
> > These days, the latter configuration is all but universal. Per the GCC
> > installation instructions, "The GNU Assembler has not been updated to support
> > AIX 6 or AIX 7."
>
> Ouch. I'm surprised we've not gotten more complaints.
That surprised me, too. Perhaps almost everyone has used either xlc or that
IBM-provided gcc you wrote about.
> >> 2. Don't rely on local symbols in the PPC spinlock assembly code.
> > A third option is to use __sync intrinsics, like we do on ARM. I like (2).
>
> I've been waiting to hear confirmation from Steve that the proposed patch
> works with IBM's assembler. (For all I know, it uses "*" rather than ".",
> or some other randomness.) He's not responded yet though. Are you in
> a position to test the patch?
I tested a gcc 64-bit build. Consistent with your followup, "b .+12" doesn't
build, but "b $+12" builds and passes "make check". I am attaching the exact
diff I tested.
On GNU/Linux ppc, I get the same opcodes before and after the change.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:no-local-asm-symbols-dollar.patch (text/plain, 1.4K) downloaddiff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.hindex ef66644..b7567c1 100644--- a/src/include/storage/s_lock.h+++ b/src/include/storage/s_lock.h@@ -447,6 +447,12 @@ typedef unsigned int slock_t;
* NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
* an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
* On newer machines, we can use lwsync instead for better performance.
+ *+ * Ordinarily, we'd code the branches here using GNU-style local symbols, that+ * is "1f" referencing "1:" and so on. But some people run gcc on AIX with+ * IBM's assembler as backend, and IBM's assembler doesn't do local symbols.+ * So hand-code the branch offsets; fortunately, all PPC instructions are+ * exactly 4 bytes each, so it's not too hard to count.
*/
static __inline__ int
tas(volatile slock_t *lock)
@@ -461,20 +467,18 @@ tas(volatile slock_t *lock)
" lwarx %0,0,%3 \n"
#endif
" cmpwi %0,0 \n"
-" bne 1f \n"+" bne $+16 \n" /* branch to li %1,1 */
" addi %0,%0,1 \n"
" stwcx. %0,0,%3 \n"
-" beq 2f \n"-"1: li %1,1 \n"-" b 3f \n"-"2: \n"+" beq $+12 \n" /* branch to lwsync/isync */+" li %1,1 \n"+" b $+12 \n" /* branch to end of asm sequence */
#ifdef USE_PPC_LWSYNC
" lwsync \n"
#else
" isync \n"
#endif
" li %1,0 \n"
-"3: \n"
: "=&r"(_t), "=r"(_res), "+m"(*lock)
: "r"(lock)
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-bugs@postgresql.org
Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [BUGS] Compile fails on AIX 6.1
In-Reply-To: <20150829054239.GA2556062@tornado.leadboat.com>
References: <1823346352.314711.1405443099463.open-xchange@oxbaltgw55.schlund.de> <14934.1440686206@sss.pgh.pa.us> <20150828070203.GA2534837@tornado.leadboat.com> <19828.1440770326@sss.pgh.pa.us> <20150829054239.GA2556062@tornado.leadboat.com>
* 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