Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sKDuZ-008vsD-Lf for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Jun 2024 09:16:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sKDuX-0030NJ-Db for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Jun 2024 09:16:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJx1r-000kAL-7f for pgsql-hackers@lists.postgresql.org; Wed, 19 Jun 2024 15:15:20 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sJx1q-002UPO-0w for pgsql-hackers@postgresql.org; Wed, 19 Jun 2024 15:15:19 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52cccd44570so786185e87.2 for ; Wed, 19 Jun 2024 08:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718810117; x=1719414917; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jEfbjSqqSxbND/l4g1LYXVbmfiUAMklq//0UM7+8Mh0=; b=POeqT2c0bFkToZs7eRpOV3LIyPRXg8WA2leMJNuV7HTcuWfCvPY4kMfij8HV0Gld0I SwgBitfVsQ0RhP2aJh6UkhsxEPmjw7uBdF/S3dk7gU74EQ6EY/3JYXxH5pAQRPYb8riE v7VhIzsuiE4XZAcj5nODLKmMLW/DwU+8HasIhe9NJBPdLthOCxhal25gvj4gpY6lnoWk Dl1UgS11hJHqbs2CL/k3CKFw2j+63e+2KZZTjPmRa991p8S4HdVPETW34N9NSeEM7zL1 ZnBlIDI+vSlaSmMX2YxNL0oZM8NWshMLaJ+OqVHipIMb6rRKn3VlT+2H6Oqu9EgJUrQp 4DGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718810117; x=1719414917; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jEfbjSqqSxbND/l4g1LYXVbmfiUAMklq//0UM7+8Mh0=; b=Wlr/L3RTIqBq81CmW6YX6oZAq3ZOi30eOyVYjhV5Djihn4kfIxb/SqB64j4G6CMSUK c+xdAyCA2Z01T6V87UIU2S2D/a4ytZquDZyZKvVdJCU3vb7kzC+DOxakqhOM21Ge/jqG ZhuPwlI441Dy6y4rI2MYgNJegYAj7++4IBbfil9fBHTI0GN5h4dNepUTwI8LP8wuD3BE uMPDrGD+U0wqsMNcyX+ujNQOpF4J0VzzBczth47UJQVFR7oX1bHLEc6nxihk2a8rdAMn 7Vrd+uQwBIqPWy7QbUQq3rgq7qbWJOLlBs52JR78OjSTehc5xeI2D6tcWo5g86P1jiX7 VwiQ== X-Forwarded-Encrypted: i=1; AJvYcCX/3gUNwmaar6sgZqAixjzfZUF5DfAU2RNs/JaNCSNA0+j352BeNljh8G97JqyksZtXFGq7pdyDfG1cjKWz+pTfTI2TMVQSl6tje+Fb X-Gm-Message-State: AOJu0Yzc0y/hHLAhf/MRK3YFRFNbxLf7VnBxwFSawx9v55mqIZ3oWFtY 9yNKCfIsWW92D14aDItCGXSc/UzbMi/su4q5S3Z/qSHbLUTThjbk X-Google-Smtp-Source: AGHT+IHYyZe+BG7oaUNmCDdIbTpp413FnqKDepZlaqGadrBoEBSv90YhI2LU888Wt2cyUqtSU6GCXg== X-Received: by 2002:a05:6512:3fc:b0:52c:9fab:e979 with SMTP id 2adb3069b0e04-52ccaaa8d04mr1484106e87.67.1718810116505; Wed, 19 Jun 2024 08:15:16 -0700 (PDT) Received: from [192.168.1.110] (dsl-hkibng22-54f8db-125.dhcp.inet.fi. [84.248.219.125]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca287ac67sm1784553e87.226.2024.06.19.08.15.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jun 2024 08:15:16 -0700 (PDT) Message-ID: Date: Wed, 19 Jun 2024 18:15:14 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: AIX support To: Srirama Kucherlapati , Laurenz Albe , Bruce Momjian , Heikki Linnakangas Cc: Peter Eisentraut , Alvaro Herrera , "pgsql-hackers@postgresql.org" , Noah Misch , Michael Paquier , Andres Freund , Tom Lane , Thomas Munro , "tvk1271@gmail.com" , "postgres-ibm-aix@wwpdl.vnet.ibm.com" References: <202405161430.ukr5bwspmfdp@alvherre.pgsql> <698dd3efec644b5c0dd6220d73033f8153ae2fde.camel@cybertec.at> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19/06/2024 17:55, Srirama Kucherlapati wrote: > +/* Commenting for XLC > + * "IBM XL C/C++ for AIX, V12.1" miscompiles, for 32-bit, some inline > + * expansions of ginCompareItemPointers() "long long" arithmetic. To take > + * advantage of inlining, build a 64-bit PostgreSQL. > +#if defined(__ILP32__) && defined(__IBMC__) > +#define PG_FORCE_DISABLE_INLINE > +#endif > + */ This seems irrelevant. > + * 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. Could you use GCC assembler to avoid this? > @@ -662,6 +666,21 @@ tas(volatile slock_t *lock) > > #if !defined(HAS_TEST_AND_SET) /* We didn't trigger above, let's try here */ > > +#if defined(_AIX) /* AIX */ > +/* > + * AIX (POWER) > + */ > +#define HAS_TEST_AND_SET > + > +#include > + > +typedef int slock_t; > + > +#define TAS(lock) _check_lock((slock_t *) (lock), 0, 1) > +#define S_UNLOCK(lock) _clear_lock((slock_t *) (lock), 0) > +#endif /* _AIX */ > + > + > /* These are in sunstudio_(sparc|x86).s */ > > #if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc)) What CPI/compiler/OS configuration is this for, exactly? Could we rely on GCC-provided __sync_lock_test_and_set() builtin function instead? > +# Allow platforms with buggy compilers to force restrict to not be > +# used by setting $FORCE_DISABLE_RESTRICT=yes in the relevant > +# template. Surely we don't need that anymore? Or is the compiler still buggy? Do you still care about 32-bit binaries on AIX? If not, let's make that the default in configure or a check for it, and remove the instructions on building 32-bit binaries from the docs. Please try hard to remove any changes from the diff that are not absolutely necessary. - Heikki