Re: [BUGS] Compile fails on AIX 6.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [BUGS] Compile fails on AIX 6.1
Date: 2015-08-27 14:36:46
Message-ID: 14934.1440686206@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

A year ago we had a thread about assembler syntax errors on AIX, but it
died off when the original complainant stopped responding. I was recently
contacted off-list by Steve Underwood, who was seeing the same symptoms
on AIX 7.1. After some investigation, we found that the problem is that
IBM's assembler doesn't understand the "local symbol" notation supported
by the GNU assembler ("bne 1f" referencing the next occurrence of "1:").
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.

Curiously, our build goes through just fine if you use the gcc 4.2.0
build available from IBM's website. But it turns out it's using the
"generic AIX" stanza of s_lock.h, ie _check_lock(), rather than the
lwarx assembly code. AFAICS this must mean that that gcc build does
not define __ppc__ --- very weird. But a bit offtopic.

So now that we know what is happening, what do we want to do about it?
AFAICS there are two plausible ways to fix it:

1. Add a configure-time test to see if the assembler supports local
symbols. If not, don't try to use the lwarx assembly stanza, but let
it fall through to using _check_lock(). This would be simple but
there would presumably be some performance hit.

2. Don't rely on local symbols in the PPC spinlock assembly code. This
is a bit ugly, because the only way to do that is to hard-code branch
offsets, as in the attached draft patch. If there were any likelihood
that we'd be changing the PPC spinlock code in future, I would regard
this as unmaintainable ... but really, that code is pretty static.
So I think this is a viable alternative.

Comments?

regards, tom lane

Attachment Content-Type Size
no-local-asm-symbols.patch text/x-diff 1.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message smilodon100 2015-08-27 15:29:40 BUG #13593: ERROR: cannot find xlog functions
Previous Message Kristoffer Gustafsson 2015-08-27 06:29:11 Re: BUG #13592: Optimizer throws out join constraint causing incorrect result

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Crawford 2015-08-27 14:51:48 Re: What does RIR as in fireRIRrules stand for?
Previous Message Tom Lane 2015-08-27 13:52:45 Re: What does RIR as in fireRIRrules stand for?