Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVYue-0001ia-Bc for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Aug 2015 05:42:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZVYud-0002B9-Kh for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Aug 2015 05:42:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZVYuc-0002AM-6J for pgsql-hackers@postgresql.org; Sat, 29 Aug 2015 05:42:46 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZVYuZ-0005ku-Ih for pgsql-hackers@postgresql.org; Sat, 29 Aug 2015 05:42:44 +0000 Received: by pacgr6 with SMTP id gr6so10161830pac.0 for ; Fri, 28 Aug 2015 22:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=BSB8zAytBb0stXEM/M8tgeouDIr+GkzlFq7mxUO7bLk=; b=KRGN+dlxvDOmeWThQ3m4tg2ijg/Gxy+7WDTUSEsy24XXkwNdD4L4TDLUOwrJ3/swlu j3coxDQu6vYv2vHtYxP3Rjhx4ypyYx1B9ILLQ66mTvaRvkY6DBu+r4rWfgapf4z4JrRO LtxJ2bq7hDhc6VtZa5kaS44q/DGW/4mWlzSp4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=BSB8zAytBb0stXEM/M8tgeouDIr+GkzlFq7mxUO7bLk=; b=lgWXLnpveq8pqQOlCiNlWhJVlHEC4i92YdEhj2HS9qvnVSZAYoz+IIeswyxWvG6Q+d HD7BwVCyrgLZIRo4bXuY23e7n7LaFddHGJDRxMfU+GIXX6Sfa9BEuVIfDtLlmBPvTlxX UB/5i/AjyE2629Pml28/167RrEXX7dzeT7WAH0L52hZdpX47865MU7l9e8gZwZeyACkf 8ugpK8hCueAkqyyCw4MjeO2JlC5zJ5IsT4GIrLOdlGWzVRsLRESvUeEaBAs5oZeihS53 UbsPVDzBBSqvWsiYdXtJeQizmCoqW6fuhby1wNSk1Pwr6sCVJi/RrD4ncqLs/geAUno4 5zbg== X-Gm-Message-State: ALoCoQl9Gk4imXTAqh2HFAd4IkMky+st5g8SiVh8oya/p44AZiyES0zu5wSYed2+CvJeiJ3ba2Bs X-Received: by 10.68.134.169 with SMTP id pl9mr20852070pbb.164.1440826962037; Fri, 28 Aug 2015 22:42:42 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id n6sm7545624pdr.55.2015.08.28.22.42.40 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Aug 2015 22:42:41 -0700 (PDT) Date: Sat, 29 Aug 2015 01:42:39 -0400 From: Noah Misch To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: [BUGS] Compile fails on AIX 6.1 Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qtZFehHsKgwS5rPz" Content-Disposition: inline In-Reply-To: <19828.1440770326@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --qtZFehHsKgwS5rPz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 28, 2015 at 09:58:46AM -0400, Tom Lane wrote: > Noah Misch 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. --qtZFehHsKgwS5rPz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="no-local-asm-symbols-dollar.patch" diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 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) --qtZFehHsKgwS5rPz Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --qtZFehHsKgwS5rPz--