public inbox for [email protected]
help / color / mirror / Atom feedAIX support
73+ messages / 18 participants
[nested] [flat]
* AIX support
@ 2024-03-21 12:55 Sriram RK <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Sriram RK @ 2024-03-21 12:55 UTC (permalink / raw)
To: pgsql-hackers
Hello Team,
We are working on AIX systems and noticed that the thread on removing AIX support in Postgres going forward.
https://github.com/postgres/postgres/commit/0b16bb8776bb834eb1ef8204ca95dd7667ab948b”
We would be glad to understand any outstanding issues hindering the support on AIX.
It is important for us to have Postgres to be supported on AIX. As we are using Postgres extensively on AIX.
Also we would like to provide any feasible support from our end for enabling the support on AIX.
We would request the community to extend the support on AIX ..
Thanks & regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-21 13:57 Alvaro Herrera <[email protected]>
parent: Sriram RK <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: Alvaro Herrera @ 2024-03-21 13:57 UTC (permalink / raw)
To: Sriram RK <[email protected]>; +Cc: pgsql-hackers
On 2024-Mar-21, Sriram RK wrote:
> Hello Team,
>
> We are working on AIX systems and noticed that the thread on removing AIX support in Postgres going forward.
>
> https://github.com/postgres/postgres/commit/0b16bb8776bb834eb1ef8204ca95dd7667ab948b”
>
> We would be glad to understand any outstanding issues hindering the support on AIX.
There's a Discussion link at the bottom of that commit message. I
suggest you read that discussion complete, and consider how much effort
you or your company are willing to spend on doing the maintenance of the
port yourselves for the community. Maybe ponder this question: would it
be less onerous to migrate your Postgres servers to Linux, like Phil
Florent described on the currently-last message of that thread?
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Para tener más hay que desear menos"
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-21 13:57 Tom Lane <[email protected]>
parent: Sriram RK <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Tom Lane @ 2024-03-21 13:57 UTC (permalink / raw)
To: Sriram RK <[email protected]>; +Cc: pgsql-hackers
Sriram RK <[email protected]> writes:
> We are working on AIX systems and noticed that the thread on removing AIX support in Postgres going forward.
> https://github.com/postgres/postgres/commit/0b16bb8776bb834eb1ef8204ca95dd7667ab948b
> We would be glad to understand any outstanding issues hindering the
> support on AIX.
Did you read the linked thread? Starting say about here:
https://www.postgresql.org/message-id/flat/20240224172345.32%40rfd.leadboat.com#8b41e50c2190c82c861d...
> Also we would like to provide any feasible support from our end for enabling the support on AIX.
Who is "we", and how much resources are you prepared to put into this?
> We would request the community to extend the support on AIX ..
The community, in the sense of the existing people doing significant
work on Postgres, are absolutely not going to do that. If you can
bring a bunch of work to fix all the problems noted in the discussion
thread, and commit to providing ongoing development manpower and
hardware to keep it working, maybe something could happen. But I
suspect you will find it cheaper to start thinking about migrating
off AIX.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-21 16:35 Sriram RK <[email protected]>
parent: Tom Lane <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Sriram RK @ 2024-03-21 16:35 UTC (permalink / raw)
To: Tom Lane <[email protected]>; Alvaro Herrera <[email protected]>; +Cc: pgsql-hackers
Thanks, Tom and Alvaro, for the info.
We shall look into to details and get back.
From: Tom Lane <[email protected]>
Date: Thursday, 21 March 2024 at 7:27 PM
To: Sriram RK <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: AIX support
Sriram RK <[email protected]> writes:
> We are working on AIX systems and noticed that the thread on removing AIX support in Postgres going forward.
> https://github.com/postgres/postgres/commit/0b16bb8776bb834eb1ef8204ca95dd7667ab948b
> We would be glad to understand any outstanding issues hindering the
> support on AIX.
Did you read the linked thread? Starting say about here:
https://www.postgresql.org/message-id/flat/20240224172345.32%40rfd.leadboat.com#8b41e50c2190c82c861d...
> Also we would like to provide any feasible support from our end for enabling the support on AIX.
Who is "we", and how much resources are you prepared to put into this?
> We would request the community to extend the support on AIX ..
The community, in the sense of the existing people doing significant
work on Postgres, are absolutely not going to do that. If you can
bring a bunch of work to fix all the problems noted in the discussion
thread, and commit to providing ongoing development manpower and
hardware to keep it working, maybe something could happen. But I
suspect you will find it cheaper to start thinking about migrating
off AIX.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-28 11:09 Sriram RK <[email protected]>
parent: Sriram RK <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Sriram RK @ 2024-03-28 11:09 UTC (permalink / raw)
To: Tom Lane <[email protected]>; Alvaro Herrera <[email protected]>; pgsql-hackers
Hi Team,
We are setting up the build environment and trying to build the source and also trying to analyze the assert from the Aix point of view.
Also, would like to know if we can access the buildfarm(power machines) to run any of the specific tests to hit this assert.
Thanks & regards,
Sriram.
> From: Sriram RK <[email protected]>
> Date: Thursday, 21 March 2024 at 10:05 PM
> To: Tom Lane [email protected]<mailto:[email protected]>, Alvaro Herrera <[email protected]>
> Cc: [email protected]<mailto:[email protected]> <[email protected]>
> Subject: Re: AIX support
> Thanks, Tom and Alvaro, for the info.
> We shall look into to details and get back.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-29 02:48 Noah Misch <[email protected]>
parent: Sriram RK <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Noah Misch @ 2024-03-29 02:48 UTC (permalink / raw)
To: Sriram RK <[email protected]>; +Cc: Tom Lane <[email protected]>; Alvaro Herrera <[email protected]>; pgsql-hackers
On Thu, Mar 28, 2024 at 11:09:43AM +0000, Sriram RK wrote:
> We are setting up the build environment and trying to build the source and also trying to analyze the assert from the Aix point of view.
The thread Alvaro and Tom cited contains an analysis. It's a compiler bug.
You can get past the compiler bug by upgrading your compiler; both ibm-clang
17.1.1.2 and gcc 13.2.0 are free from the bug.
> Also, would like to know if we can access the buildfarm(power machines) to run any of the specific tests to hit this assert.
https://portal.cfarm.net/users/new/ is the form to request access. It lists
the eligibility criteria.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2024-03-29 03:07 Tom Lane <[email protected]>
parent: Noah Misch <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Tom Lane @ 2024-03-29 03:07 UTC (permalink / raw)
To: Noah Misch <[email protected]>; +Cc: Sriram RK <[email protected]>; Alvaro Herrera <[email protected]>; pgsql-hackers
Noah Misch <[email protected]> writes:
> On Thu, Mar 28, 2024 at 11:09:43AM +0000, Sriram RK wrote:
>> Also, would like to know if we can access the buildfarm(power machines) to run any of the specific tests to hit this assert.
> https://portal.cfarm.net/users/new/ is the form to request access. It lists
> the eligibility criteria.
There might be some confusion here about what system we are talking
about. The Postgres buildfarm is described at
https://buildfarm.postgresql.org/index.html
but it consists of a large number of individual machines run by
individual owners. There would not be a lot of point in adding a
new AIX machine to the Postgres buildfarm right now, because it
would surely fail to build HEAD. What Noah is referencing is
the GCC compile farm, which happens to include some AIX machines.
The existing AIX entries in the Postgres buildfarm are run (by Noah)
on those GCC compile farm machines, which really the GCC crowd have
been *very* forgiving about letting us abuse like that. If you have
your own AIX hardware there's not a lot of reason that you should
need to access the GCC farm.
What you do need to do to reproduce the described problems is
check out the Postgres git tree and rewind to just before
commit 0b16bb877, where we deleted AIX support. Any attempt
to restore AIX support would have to start with reverting that
commit (and perhaps the followup f0827b443).
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-03-07 14:11 Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-03-07 14:11 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; [email protected] <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Robert Haas <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>
Hi Team,
Our team has identified couple of issues with the meson build on AIX, primarily focusing on the following areas:
1. Symbol extraction and resolution in object files during binary creation.
2. Dynamic runtime library path resolution in shared libraries.
We have resolved them and we plan to submit these fixes to the meson community shortly.
In addition, we are actively working on resolving other test issues. I will provide you with updates once these problems have been resolved.
92/301 postgresql:regress / regress/regress
# 4 of 223 tests failed.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-03-07 16:20 Robert Haas <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Robert Haas @ 2025-03-07 16:20 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; pgsql-hackers; [email protected] <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>
On Fri, Mar 7, 2025 at 9:11 AM Srirama Kucherlapati
<[email protected]> wrote:
> Our team has identified couple of issues with the meson build on AIX, primarily focusing on the following areas:
>
> Symbol extraction and resolution in object files during binary creation.
> Dynamic runtime library path resolution in shared libraries.
>
> We have resolved them and we plan to submit these fixes to the meson community shortly.
Nice!
--
Robert Haas
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-03-17 16:58 Srirama Kucherlapati <[email protected]>
parent: Robert Haas <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-03-17 16:58 UTC (permalink / raw)
To: Robert Haas <[email protected]>; pgsql-hackers; Heikki Linnakangas <[email protected]>; [email protected] <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>
Hi Team,
Here are the updates on the meson on AIX. Our team had pushed the fixes meson github here …
https://github.com/mesonbuild/meson/pull/14335
#14335 Enhance AIX shared library build to use an export List.<https://github.com/mesonbuild/meson/pull/14335;
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-03 13:45 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-03 13:45 UTC (permalink / raw)
To: wenhui qiu <[email protected]>; Heikki Linnakangas <[email protected]>; [email protected] <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>
Hi Wenhui Qiu,
May I know the freeze dates.
We are nearly ready to deliver the patch. Currently, we have compiled the
source using Meson and are investigating one test case issue. Once we pinpoint
the cause, we will send you the patch. Notably, this test case behaves
differently on AIX, opting for a Bitmap Index Scan instead of an Index Scan.
Not sure if this is really specific to AIX?
>> meson test
396 Ok: 81
397 Expected Fail: 0
398 Fail: 1 (regex)
399 Unexpected Pass: 0
400 Skipped: 219
401 Timeout: 0
>>
7 explain (costs off) select * from pg_proc where proname ~ '^abc';
8 - QUERY PLAN
9 -----------------------------------------------------------------------
10 - Index Scan using pg_proc_proname_args_nsp_index on pg_proc
11 - Index Cond: ((proname >= 'abc'::text) AND (proname < 'abd'::text))
12 + QUERY PLAN
13 +----------------------------------------------------------------------------
14 + Bitmap Heap Scan on pg_proc
15 Filter: (proname ~ '^abc'::text)
16 -(3 rows)
17 + -> Bitmap Index Scan on pg_proc_proname_args_nsp_index
18 + Index Cond: ((proname >= 'abc'::text) AND (proname < 'abd'::text))
19 +(4 rows)
As of now below are the changes wrt to meson.
modified: meson.build
modified: src/backend/meson.build
modified: src/bin/initdb/initdb.c
modified: src/include/c.h
modified: src/include/port/aix.h
modified: src/include/utils/float.h
modified: src/interfaces/ecpg/compatlib/meson.build
modified: src/interfaces/ecpg/ecpglib/meson.build
modified: src/interfaces/ecpg/pgtypeslib/meson.build
modified: src/interfaces/libpq/meson.build
modified: src/test/regress/expected/txid.out
modified: src/test/regress/expected/xid.out
modified: src/test/regress/sql/sanity_check.sql
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-04 19:31 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-04 19:31 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>
Hi Heikki and team,
Thank you for considering our request. As discussed, we have revised the patch
to incorporate all the review comments provided.
Please find the attached patch, which focuses solely on the gmake changes.
As discussed the meson specific changes would be provided as different patch.
We have taken into account and resolved the earlier comments within this patch.
https://www.postgresql.org/message-id/e0dc2bff-300b-4edd-912b-b6c52274bdc5%40iki.fi
- Build using latest master. (used commit 898c131b58a0b)
- We have merged our changes to this latest level.
- configure.ac
- Updated the changes aligning to configure file.
- configure
- Updated the comments wrt to the alignment details. Updated with
the gcc specific fix which talks about the alignment.
- updated the int64_t specific changes.
- doc/src/sgml/dfunc.sgml
- This is removed as it is not relevant.
- src/backend/port/aix/mkldexport.sh
- When building shared libraries from various archives on AIX, we encounter a
situation where symbols are not exported. To resolve this, we require an export
file. For instance, the command is used to export symbols.
gcc -shared libtest.so libtest.a -Wl,-bE:test.exp
However, if we directly provide object files in the command line instead of an
archive, the symbols will be exported automatically, as demonstrated by the command
gcc -shared libtest.so test1.o test2.o test3.o.
- We will update the description with additional details in the later point of time. (Considering the time lines)
- src/makefiles/Makefile.aix
- The changes in this file are required
- This change is not required “+LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE”
- src/template/aix
- WRT to the MEMSET_LOOP_LIMIT flag, this is set to “0”, which would internally use
The system call memset() as mentioned in the below link as well
https://www.postgresql.org/message-id/20060203135315.E08B09DC816%40postgresql.org
I Kindly request you to review the changes and provide your feedback.
With all the above changes we have built and ran the tests. As of now we see
there is only one test case that is failing, which seems to have been
introduced recently. And this might not be related to the above changes as
earlier there were no test cases failing.
64 not ok 12 + float8 235 ms
297 # 1 of 226 tests failed.
20 +ERROR: value out of range: overflow
21 -- test overflow/underflow handling
22 SELECT gamma(float8 '-infinity');
23 ERROR: value out of range: overflow
Warm regards,
Sriram.
Attachments:
[application/octet-stream] 0001-AIX-support.v7.patch (14.4K, 3-0001-AIX-support.v7.patch)
download | inline diff:
From 614cd077da0de9ca92c4e4fb300c39f73ab5ad10 Mon Sep 17 00:00:00 2001
From: Sriram RK <[email protected]>
Date: Fri, 4 Apr 2025 13:16:21 -0500
Subject: [PATCH] AIX support.
---
Makefile | 2 -
configure | 34 ++++++++++++++---
configure.ac | 34 ++++++++++++++---
src/Makefile.shlib | 29 ++++++++++++++
src/backend/Makefile | 20 ++++++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 4 ++
src/include/storage/s_lock.h | 10 ++---
src/makefiles/Makefile.aix | 39 +++++++++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 7 ++++
12 files changed, 224 insertions(+), 20 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 11615d1122d..6088fa26679 100755
--- a/configure
+++ b/configure
@@ -3008,6 +3008,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -16953,13 +16954,34 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index debdf165044..c21aaa52064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -1987,13 +1988,34 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- AC_MSG_ERROR([alignment of 'int64_t' is greater than the alignment of 'double'])
fi
AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any C data type.])
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index fa81f6ffdd6..13ea84ac185 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 8a6b6905079..3a8e9dc30b0 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -904,7 +904,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..7d08480c8c0
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,4 @@
+/*
+ * src/include/port/aix.h
+ */
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..5da9b3acda4 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -421,17 +421,15 @@ tas(volatile slock_t *lock)
__asm__ __volatile__(
" lwarx %0,0,%3,1 \n"
" 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: \n"
+" beq $+12 \n" /* branch to lwsync */
" li %1,1 \n"
-" b 3f \n"
-"2: \n"
+" b $+12 \n" /* branch to end of asm sequence */
" lwsync \n"
" li %1,0 \n"
-"3: \n"
+
: "=&b"(_t), "=r"(_res), "+m"(*lock)
: "r"(lock)
: "memory", "cc");
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..d33918f91b9
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,39 @@
+# MAKE_EXPORTS is required for svr4 loaders that want a file of
+# symbol names to tell them what to export/import.
+MAKE_EXPORTS= true
+
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# when building with gcc, need to make sure that libgcc can be found
+ifeq ($(GCC), yes)
+libpath := $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
+endif
+
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+#LDFLAGS_SL += -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..48a3ce55cf7
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,7 @@
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+CFLAGS_SL=""
+
+# Native memset() is faster.
+MEMSET_LOOP_LIMIT=0
--
2.41.0
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-05 18:29 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-05 18:29 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
--_004_CY8PR15MB5602EADE20375FB66090B61BDBA82CY8PR15MB5602namp_
Content-Type: multipart/alternative;
boundary="_000_CY8PR15MB5602EADE20375FB66090B61BDBA82CY8PR15MB5602namp_"
--_000_CY8PR15MB5602EADE20375FB66090B61BDBA82CY8PR15MB5602namp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hi Heikki,
Please find the attached patch addressing the provided comments. Our respon=
ses are outlined below.
>> - src/backend/port/aix/mkldexport.sh>
> Oh, that's interesting. So if we do that, we don't need mkldepxort.sh
> anymore?
Here the better approach still would be to use the script to extract the
symbols build the corresponding shared libraries. As we see there are
lot of extensions that are getting built using the symbols exported from
"postges" binary, we need to definitely use the script to extract the symb=
ols
and import them while building the library extensions.
>> - WRT to the MEMSET_LOOP_LIMIT flag, this is set to =930=94, which would
>> internally use
> Yes, I understand what it does. But why? Whatever benchmarking was done
> back in 2006 by is no longer relevant.
We ran the program , mentioned in the below link and collected the
benchmark stats on our node (POWER_10).
https://postgrespro.com/list/thread-id/1673194
The native AIX memset() seems to performs better. The benchmark seems to be=
still
relevant, so I think we should continue to use the existing optimization fo=
r
AIX. Below are the stats (64bit Object mode).
>> ./memset-aix
sizeof(int) =3D 4
sizeof(long) =3D 8
Loop by int (size=3D8) : 0.238024
memset by int (size=3D8) : 0.280301
Loop by long (size=3D8) : 0.202650
Loop by int (size=3D16) : 0.389846
memset by int (size=3D16) : 0.280979
Loop by long (size=3D16) : 0.246879
Loop by int (size=3D32) : 0.773478
memset by int (size=3D32) : 0.331691
Loop by long (size=3D32) : 0.422261
Loop by int (size=3D64) : 1.945150
memset by int (size=3D64) : 0.319117
Loop by long (size=3D64) : 0.769770
Loop by int (size=3D128) : 4.517186
memset by int (size=3D128) : 0.398292
Loop by long (size=3D128) : 1.982307
Loop by int (size=3D256) : 12.486661
memset by int (size=3D256) : 0.463115
Loop by long (size=3D256) : 4.526272
Loop by int (size=3D512) : 24.433075
memset by int (size=3D512) : 0.681426
Loop by long (size=3D512) : 12.564701
Loop by int (size=3D1024) : 48.060486
memset by int (size=3D1024) : 0.904048
Loop by long (size=3D1024) : 24.149871
Loop by int (size=3D2048) : 96.288018
memset by int (size=3D2048) : 1.509465
Loop by long (size=3D2048) : 48.216079
Loop by int (size=3D4096) : 191.847177
memset by int (size=3D4096) : 1.435403
Loop by long (size=3D4096) : 96.433072
>> 12 files changed, 224 insertions(+), 20 deletions(-)
> I'm glad to see this patch shrinking :-)
Thanks for your suggestions, yes it further shrinked.
> > diff --git a/src/include/port/aix.h b/src/include/port/aix.h
> Useless.
I too initially felt this was not needed, This file is still required as th=
e below file is
getting auto generated. I attempted to remove it; the below error is hit.
so this is still required.
64 ../../src/include/c.h:59:10: fatal error: pg_config_os.h: No such f=
ile or directory
65 59 | #include "pg_config_os.h" /* config from incl=
ude/port/PORTNAME.h */
66 | ^~~~~~~~~~~~~~~~
> diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
> Why is this change needed?
> Yes, I know we've been over this many times already. I still don't
> understand why it's needed. The onus is on you to explain it adequately,
> in comments in the patch, so that I and others understand it. Or even
> better, remove it if it's not necessary.
If you recall, we previously considered replacing this assembly code with
__sync_lock_test_and_set(). However, as you mentioned earlier, this should =
be
handled in a separate patch. For now, I'll make a note and submit a separat=
e
patch for this later, as originally planned. Below is the reference to olde=
r
discussion.
https://www.postgresql.org/message-id/7751f9c5-e2e6-4252-a9fa-14b3e78ddec9%=
40iki.fi
>> diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
>> +MAKE_EXPORTS=3D true
>Oh this is interesting. I think MAKE_EXPORTS is actually a leftover that
>I failed to remove when I removed the AIX support; it's not used on any
>currently-supported platform.
Removed it and its working fine.
>> +# -blibpath must contain ALL directories where we should look for libra=
ries
>> +libpath :=3D $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed=
-e's/ //g'):/usr/lib:/lib
> Is this still sensible on modern AIX systems? What happens if you leave
> it out?
This is required as it is looking for the possible non-default directories =
for the linker
at the runtime. This is used along with rpath. As suggested, I tested this =
by removing
the libpath, but at run time the linker is not able to find the dependent l=
ibraries path
as a result, the binaries are not getting loaded. After doing some research=
, AIX uses a stricter,
more explicit approach. The runtime linker expects to tell it exactly where=
to look using -blibpath.
>> +# when building with gcc, need to make sure that libgcc can be found
>> +ifeq ($(GCC), yes)
>> +libpath :=3D $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
>> +endif
> Same here. Still relevant? What happens if you leave it out?
Removed it and it is working fine.
>> +# gcc needs to know it's building a shared lib, otherwise it'll not emi=
t
>> +# correct code / link to the right support libraries
>> +ifeq ($(GCC), yes)
>> +LDFLAGS_SL +=3D -shared
>> +endif
>On other platforms, we have this in LINK.shared, see src/Makefile.shlib.
>Should we do the same on AIX; if not, why not?
I tried your suggestion to move the gcc "LDFLAGS_SL +=3D -shared" flag to M=
akefile.shlib,
"LINK.shared =3D $(COMPILER) -shared", but there are some extensions =
dependent
on this in "contrib" which are not building with =93-shared=94 flag, as a r=
esult a testcase
is failing to load this library "contrib/spi/autoinc.so" . Below is the err=
or.
not ok 78 + triggers 2443 ms
31 +ERROR: incompatible library "/home/pgdev/pgdb/postgres/src/test/regres=
s/autoinc.so": missing magic block
32 +HINT: Extension libraries are required to use the PG_MODULE_MAGIC macr=
o.
I noticed that the =93-shared=94 flag was missing while building the contri=
b/spi/autoinc.so library.
I tried to add the =93include $(top_builddir)/src/Makefile.shlib=94 in the
contrib/spi/Makefile, but still the =93-shared=94 flag is not getting inclu=
ded while building
the library.
So we will continue to use the earlier change.
> Does AIX have LD_LIBRARY_PATH? This suggests that it does:
> https://www.ibm.com/support/pages/aix-libpath-recommendations
> What's the difference between LIBPATH and LD_LIBRARY_PATH? Why prefer
LIBPATH?
AIX uses only LIBPATH and LD_LIBRARY_PATH is specific to Linux.
> Separately from the remaining issues with this patch, I still feel
> pretty reluctant with accepting this, because if I commit this patch,
> I'm on the hook to keep it working. I do regularly commit stuff that I'm
> not personally that interested in, but a new port is different:
> If something breaks on AIX, I have no means (or interest!) in debugging
> it. That means that I need to be pretty confident that there are others
> who are interested and invested in keeping working, take ownership, will
> help to debug problems in a timely fashion, and can submit high-quality
> fixes. I am not seeing that.
I completely understand your concerns about committing to a new port and
ensuring its long-term maintenance.
Our team would like to extend the support to maintain PostgreSQL on AIX.
We would like to assist by timely debugging and resolving any issues on AIX=
.
We=92re also keen to actively contribute to this effort.
> I also notice that all the AIX systems we have in the buildfarm are still=
:
> - maintained by Noah, who - correct me if I'm wrong - is not
> particularly interested in AIX or keen on maintaining them
> - are on AIX 7.1.5, which I believe is already end-of-line
> - running on power7 hardware which is 15 years old.
> That's not very reassuring.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-12 16:41 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-12 16:41 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Here are some stats wrt to loop and native memset after enabling optimization with the same test tool(tested for long and long align using MemSetAligned). Corresponding glibc is linked on PPcle and AIX libc is linked on AIX.
https://postgrespro.com/list/thread-id/1673194
AIX loop-1 PPCle - loop1 AIX loop-2 PPCle - loop2
Loop by long (size=8) : 0 0 0.000001 0
Loop Align by long (size=8) : 0 0 0 0
memset by long (size=8) : 0.00999 0.010229 0.00994 0.010211
Loop by long (size=16) : 0 0 0 0
Loop Align by long (size=16) : 0 0 0 0
memset by long (size=16) : 0.010082 0.010036 0.010094 0.01003
Loop by long (size=32) : 0.32903 0.227726 0.329027 0.227707
Loop Align by long (size=32) : 0.329486 0.227705 0.328932 0.227712
memset by long (size=32) : 0.021061 0.01064 0.021115 0.01064
Loop by long (size=64) : 0.334761 0.227714 0.34326 0.227688
Loop Align by long (size=64) : 0.329005 0.236937 0.329084 0.236906
memset by long (size=64) : 0.059559 0.025612 0.053004 0.029589
Loop by long (size=128) : 0.420381 0.329634 0.420332 0.329524
Loop Align by long (size=128) : 0.420376 0.337169 0.42022 0.337162
memset by long (size=128) : 0.420153 0.098774 0.420312 0.101888
Loop by long (size=256) : 0.472187 0.428049 0.472774 0.429217
Loop Align by long (size=256) : 0.472586 0.438316 0.472447 0.438325
memset by long (size=256) : 0.473731 0.428013 0.473864 0.42759
Loop by long (size=512) : 0.676089 0.435649 0.632774 0.43574
Loop Align by long (size=512) : 0.66702 0.428013 0.630751 0.427319
memset by long (size=512) : 0.666619 0.427989 0.691485 0.427263
Loop by long (size=1024) : 1.00773 0.45079 0.925212 0.452131
Loop Align by long (size=1024) : 0.92114 0.45084 0.920574 0.452994
memset by long (size=1024) : 0.935062 0.450821 0.917 0.452396
Loop by long (size=2048) : 1.52585 0.702127 1.265107 0.701822
Loop Align by long (size=2048) : 1.57524 0.702158 1.439109 0.702651
memset by long (size=2048) : 1.614771 0.702247 1.384672 0.701857
Loop by long (size=4096) : 1.418133 1.37568 1.325803 1.376005
Loop Align by long (size=4096) : 1.421619 1.375741 1.325743 1.376071
memset by long (size=4096) : 1.423404 1.375716 1.325666 1.376091
After enabling optimization levels, both are performing similar.
As both are performing similar we have removed the MEMSET_LOOP in the AIX template and tried the below benchmark after running pgbench.
Run#1
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 2603.2 tps, lat 18.692 ms stddev 61.947, 0 failed
progress: 20.0 s, 3373.2 tps, lat 14.841 ms stddev 17.724, 0 failed
progress: 30.0 s, 2599.6 tps, lat 19.222 ms stddev 99.307, 0 failed
progress: 40.0 s, 3531.3 tps, lat 14.159 ms stddev 14.786, 0 failed
progress: 50.0 s, 2561.3 tps, lat 15.180 ms stddev 33.532, 0 failed
progress: 60.0 s, 3315.4 tps, lat 18.421 ms stddev 111.988, 0 failed
progress: 70.0 s, 3517.4 tps, lat 14.203 ms stddev 14.931, 0 failed
progress: 80.0 s, 2023.4 tps, lat 21.858 ms stddev 125.718, 0 failed
progress: 90.0 s, 3472.1 tps, lat 16.049 ms stddev 55.152, 0 failed
progress: 100.0 s, 3580.5 tps, lat 13.966 ms stddev 14.636, 0 failed
progress: 110.0 s, 2823.4 tps, lat 14.572 ms stddev 20.433, 0 failed
progress: 120.0 s, 3140.3 tps, lat 18.717 ms stddev 120.447, 0 failed
progress: 130.0 s, 3488.4 tps, lat 14.329 ms stddev 15.057, 0 failed
progress: 140.0 s, 2503.7 tps, lat 19.966 ms stddev 125.551, 0 failed
progress: 150.0 s, 3083.3 tps, lat 16.212 ms stddev 56.652, 0 failed
progress: 160.0 s, 3572.0 tps, lat 13.991 ms stddev 14.660, 0 failed
progress: 170.0 s, 3642.2 tps, lat 13.722 ms stddev 14.507, 0 failed
progress: 180.0 s, 2453.6 tps, lat 20.364 ms stddev 133.126, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 552889
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 227816/552889 (41.205%)
latency average = 16.252 ms
latency stddev = 69.656 ms
initial connection time = 237.245 ms
tps = 3074.421213 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.090 0 BEGIN;
3.153 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.462 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.012 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.060 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.224 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_T
3.246 0 END;
Run#2
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 577290
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 234815/577290 (40.675%)
latency average = 15.558 ms
latency stddev = 65.428 ms
initial connection time = 314.109 ms
tps = 3211.642930 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.084 0 BEGIN;
2.761 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.371 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.000 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.014 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.229 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_T
3.093 0 END;
>> diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
> - Does GCC on AIX (still) use the IBM assembler?
> - Does the IBM assembler still not understand the label syntax?
> - Is there some other label syntax that would work on the IBM assembler?
> - Is it possible to use the GNU assembler instead?
GCC on AIX still uses the AIX native assembler only. The GNU assembler has some level of support in AIX through some of the patches. But still GCC/gnu assembler combination is not very much tested.
We removed AIX specific changes for TAS(), which would now use the __sync_lock_test_and_set() routines directly instead, and we ran pgbench on it.
+ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 550838
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 227805/550838 (41.356%)
latency average = 16.323 ms
latency stddev = 68.404 ms
initial connection time = 235.449 ms
tps = 3061.041640 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.098 0 BEGIN;
2.993 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.501 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.004 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.127 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.238 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.356 0 END;
> 21 -- test overflow/underflow handling
>
> 22 SELECT gamma(float8 '-infinity');
>
> 23 ERROR: value out of range: overflow
WRT failure in lgamma(), we worked with the libm team to resolve it. It’s an issue with the errno that is being set. I’ll work on the testcase.
>> ./gamma-test NaN
Gamma and natural logarithm of gamma for the input values:
Gamma(NaNS) = NaNQ errno: 34
lgamma(NaNS) = NaNQ errno: 34
With fixed libm
+ ./gamma-test NaN
Gamma and natural logarithm of gamma for the input values:
Gamma(NaNS) = NaNQ errno: 0
lgamma(NaNS) = NaNQ errno: 0
Warm Regards,
Sriram
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-12 17:09 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-12 17:09 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Working on the patch. I will update you.
-Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-04-15 16:20 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-04-15 16:20 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Hi Team, Please find the attached diff with the latest changes.
The diff file changes that were done for memset and spinlock, are modified
on top of the previous patch.
New changes for review: 0001-AIX-support.tas.memset.diffs
Previous patch: 0001-AIX-support.v8.patch
>> diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
>
We have replaced the asm code with the gcc specific routines __sync_lock_test_and_set ()
and ran the pgbench. On AIX both have the similar performance, On PPcle we see a slight
variation in the performance. It seems the asm code is performing better on PPCle. Please
let us know, would it be better to continue to use the PPC assemble code over gcc routines.
Attached are the complete stats. (spinlock.stats.log)
Below is the summary…
AIX With asm AIX With __sync PPCle With asm PPCle With __sync
number of transactions "226554/ "230810/ "356945/ "364346/
above the 10.0 ms 556329 567936 918647 863937
latency limit (40.723%)" (40.640%)" (38.856%)" (42.173%)"
latency average 16.160 ms 15.821 ms 9.796 ms 10.416 ms
initial connection time 230.786 ms 249.668 ms 19.606 ms 20.090 ms
tps 3086.209412 3158.14915 5103.024267 4799.621896
> diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
>
> At least it needs to be updated to match what MemSet() looks like
> nowadays. The changes may be just cosmetic, but better check. Should
> also check the effect on MemSetAligned(). That might matter more for
> performance in practice.
As per the stats in the previous mail wrt to memset, both the loop and the native
memset are performing similar after optimization “-O2”. So for now we removed the
native memset changes.
We will setup the memset performance on different platforms and will post the
details in a different thread.
>>> +# -blibpath must contain ALL directories where we should look for libraries
>>> +libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
>
Added additional details about the -blibpath usage. These details are available in the below link
https://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
> 21 -- test overflow/underflow handling
>
> 22 SELECT gamma(float8 '-infinity');
>
> 23 ERROR: value out of range: overflow
This testcase is resolved from AIX libm side. Below is the result.
postgres=#
SELECT x, gamma(x),lgamma(x)
FROM (VALUES (0.5), (1), (2), (3), (4), (5),
(float8 'infinity'), (float8 'nan')) AS t(x);
0.5 | 1.772453850905516 | 0.5723649429247001
1 | 1 | 0
2 | 1 | 0
3 | 2 | 0.6931471805599453
4 | 6 | 1.791759469228055
5 | 24 | 3.1780538303479458
Infinity | Infinity | Infinity
NaN | NaN | NaN
Kindly let us know your feedback on the diffs.
I will commit the diffs to the patch(0001-AIX-support.v8.patch) once you are fine.
Warm regards,
Sriram.
------------------------------------------
AIX with asm spin lock
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3181.5 tps, lat 15.331 ms stddev 17.867, 0 failed
progress: 20.0 s, 3277.2 tps, lat 14.730 ms stddev 18.792, 0 failed
progress: 30.0 s, 2642.9 tps, lat 19.556 ms stddev 106.940, 0 failed
progress: 40.0 s, 3614.3 tps, lat 13.830 ms stddev 14.673, 0 failed
progress: 50.0 s, 2355.4 tps, lat 21.208 ms stddev 132.907, 0 failed
progress: 60.0 s, 3046.8 tps, lat 16.407 ms stddev 53.507, 0 failed
progress: 70.0 s, 3640.1 tps, lat 13.734 ms stddev 14.549, 0 failed
progress: 80.0 s, 2435.2 tps, lat 20.518 ms stddev 125.603, 0 failed
progress: 90.0 s, 3576.3 tps, lat 13.977 ms stddev 14.341, 0 failed
progress: 100.0 s, 3653.9 tps, lat 13.681 ms stddev 14.554, 0 failed
progress: 110.0 s, 2414.6 tps, lat 20.684 ms stddev 134.585, 0 failed
progress: 120.0 s, 3051.6 tps, lat 16.383 ms stddev 63.253, 0 failed
progress: 130.0 s, 3657.2 tps, lat 13.667 ms stddev 14.375, 0 failed
progress: 140.0 s, 3159.0 tps, lat 14.259 ms stddev 18.915, 0 failed
progress: 150.0 s, 2889.8 tps, lat 19.006 ms stddev 121.852, 0 failed
progress: 160.0 s, 3649.0 tps, lat 13.693 ms stddev 14.288, 0 failed
progress: 170.0 s, 2799.8 tps, lat 14.552 ms stddev 17.307, 0 failed
progress: 180.0 s, 2582.9 tps, lat 22.914 ms stddev 121.785, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 556329
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 226554/556329 (40.723%)
latency average = 16.160 ms
latency stddev = 69.085 ms
initial connection time = 230.786 ms
tps = 3086.209412 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.084 0 BEGIN;
2.997 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.400 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.014 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.094 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.217 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.346 0 END;
------------------------------------------
AIX with __sync_lock_test_and_set
pgdev@roxxpg2:~/pgdb/postgres/install]
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3391.8 tps, lat 14.339 ms stddev 13.922, 0 failed
progress: 20.0 s, 2724.0 tps, lat 18.350 ms stddev 96.241, 0 failed
progress: 30.0 s, 3571.4 tps, lat 14.001 ms stddev 14.957, 0 failed
progress: 40.0 s, 2630.9 tps, lat 18.993 ms stddev 115.583, 0 failed
progress: 50.0 s, 3574.5 tps, lat 13.984 ms stddev 14.838, 0 failed
progress: 60.0 s, 3577.0 tps, lat 13.973 ms stddev 15.055, 0 failed
progress: 70.0 s, 2401.7 tps, lat 20.810 ms stddev 149.104, 0 failed
progress: 80.0 s, 2891.0 tps, lat 17.291 ms stddev 73.637, 0 failed
progress: 90.0 s, 3529.0 tps, lat 14.160 ms stddev 15.212, 0 failed
progress: 100.0 s, 2637.2 tps, lat 18.951 ms stddev 111.379, 0 failed
progress: 110.0 s, 3593.1 tps, lat 13.903 ms stddev 14.604, 0 failed
progress: 120.0 s, 3560.3 tps, lat 14.048 ms stddev 14.926, 0 failed
progress: 130.0 s, 3230.5 tps, lat 13.796 ms stddev 15.330, 0 failed
progress: 140.0 s, 2293.2 tps, lat 24.154 ms stddev 163.908, 0 failed
progress: 150.0 s, 3511.8 tps, lat 14.219 ms stddev 15.367, 0 failed
progress: 160.0 s, 3612.9 tps, lat 13.836 ms stddev 14.839, 0 failed
progress: 170.0 s, 2523.9 tps, lat 19.811 ms stddev 129.520, 0 failed
progress: 180.0 s, 3533.7 tps, lat 14.136 ms stddev 14.988, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 567936
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 230810/567936 (40.640%)
latency average = 15.821 ms
latency stddev = 69.610 ms
initial connection time = 249.668 ms
tps = 3158.149150 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.092 0 BEGIN;
2.794 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.472 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.040 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.062 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.225 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.117 0 END;
------------------------------------------
PPCle with asm code
Pple - with asm
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4932.9 tps, lat 10.110 ms stddev 7.215, 0 failed
progress: 20.0 s, 5041.2 tps, lat 9.916 ms stddev 6.794, 0 failed
progress: 30.0 s, 5135.3 tps, lat 9.737 ms stddev 6.572, 0 failed
progress: 40.0 s, 5085.2 tps, lat 9.830 ms stddev 6.556, 0 failed
progress: 50.0 s, 5199.0 tps, lat 9.616 ms stddev 6.579, 0 failed
progress: 60.0 s, 5173.5 tps, lat 9.663 ms stddev 6.536, 0 failed
progress: 70.0 s, 5184.9 tps, lat 9.643 ms stddev 6.796, 0 failed
progress: 80.0 s, 5205.1 tps, lat 9.605 ms stddev 6.639, 0 failed
progress: 90.0 s, 5209.5 tps, lat 9.598 ms stddev 6.636, 0 failed
progress: 100.0 s, 5141.9 tps, lat 9.723 ms stddev 6.631, 0 failed
progress: 110.0 s, 5204.0 tps, lat 9.607 ms stddev 6.494, 0 failed
progress: 120.0 s, 5187.3 tps, lat 9.638 ms stddev 6.683, 0 failed
progress: 130.0 s, 5046.7 tps, lat 9.904 ms stddev 6.820, 0 failed
progress: 140.0 s, 4643.9 tps, lat 10.768 ms stddev 7.380, 0 failed
progress: 150.0 s, 5080.3 tps, lat 9.840 ms stddev 6.681, 0 failed
progress: 160.0 s, 5152.3 tps, lat 9.705 ms stddev 6.669, 0 failed
progress: 170.0 s, 5106.7 tps, lat 9.790 ms stddev 6.518, 0 failed
progress: 180.0 s, 5130.0 tps, lat 9.743 ms stddev 6.651, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 918647
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 356945/918647 (38.856%)
latency average = 9.796 ms
latency stddev = 6.718 ms
initial connection time = 19.606 ms
tps = 5103.024267 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.578 0 BEGIN;
1.764 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.595 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
0.922 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2.504 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.499 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2.956 0 END;
------------------------------------------
PPCle with __sync_lock_test_and_set
PPCle - with __sync
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4817.2 tps, lat 10.353 ms stddev 7.367, 0 failed
progress: 20.0 s, 4737.2 tps, lat 10.552 ms stddev 7.232, 0 failed
progress: 30.0 s, 4774.7 tps, lat 10.470 ms stddev 7.186, 0 failed
progress: 40.0 s, 4892.3 tps, lat 10.219 ms stddev 7.072, 0 failed
progress: 50.0 s, 4811.5 tps, lat 10.391 ms stddev 7.123, 0 failed
progress: 60.0 s, 4883.1 tps, lat 10.242 ms stddev 6.962, 0 failed
progress: 70.0 s, 4867.8 tps, lat 10.269 ms stddev 7.049, 0 failed
progress: 80.0 s, 4886.6 tps, lat 10.228 ms stddev 7.037, 0 failed
progress: 90.0 s, 4765.9 tps, lat 10.494 ms stddev 7.149, 0 failed
progress: 100.0 s, 4902.0 tps, lat 10.198 ms stddev 7.030, 0 failed
progress: 110.0 s, 4815.3 tps, lat 10.381 ms stddev 7.208, 0 failed
progress: 120.0 s, 4807.1 tps, lat 10.400 ms stddev 7.059, 0 failed
progress: 130.0 s, 4932.0 tps, lat 10.137 ms stddev 6.973, 0 failed
progress: 140.0 s, 4880.6 tps, lat 10.244 ms stddev 7.009, 0 failed
progress: 150.0 s, 4613.2 tps, lat 10.837 ms stddev 7.594, 0 failed
progress: 160.0 s, 4335.8 tps, lat 11.533 ms stddev 7.776, 0 failed
progress: 170.0 s, 4904.0 tps, lat 10.194 ms stddev 6.935, 0 failed
progress: 180.0 s, 4762.6 tps, lat 10.501 ms stddev 7.194, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 863937
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 364346/863937 (42.173%)
latency average = 10.416 ms
latency stddev = 7.168 ms
initial connection time = 20.090 ms
tps = 4799.621896 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.628 0 BEGIN;
1.793 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.627 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
0.977 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2.694 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.525 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.194 0 END;
------------------------------------------
Attachments:
[application/octet-stream] 0001-AIX-support.tas.memset.diffs (3.2K, 3-0001-AIX-support.tas.memset.diffs)
download
[text/plain] spinlock.stats.log (11.0K, 4-spinlock.stats.log)
download | inline:
------------------------------------------
AIX with asm spin lock
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3181.5 tps, lat 15.331 ms stddev 17.867, 0 failed
progress: 20.0 s, 3277.2 tps, lat 14.730 ms stddev 18.792, 0 failed
progress: 30.0 s, 2642.9 tps, lat 19.556 ms stddev 106.940, 0 failed
progress: 40.0 s, 3614.3 tps, lat 13.830 ms stddev 14.673, 0 failed
progress: 50.0 s, 2355.4 tps, lat 21.208 ms stddev 132.907, 0 failed
progress: 60.0 s, 3046.8 tps, lat 16.407 ms stddev 53.507, 0 failed
progress: 70.0 s, 3640.1 tps, lat 13.734 ms stddev 14.549, 0 failed
progress: 80.0 s, 2435.2 tps, lat 20.518 ms stddev 125.603, 0 failed
progress: 90.0 s, 3576.3 tps, lat 13.977 ms stddev 14.341, 0 failed
progress: 100.0 s, 3653.9 tps, lat 13.681 ms stddev 14.554, 0 failed
progress: 110.0 s, 2414.6 tps, lat 20.684 ms stddev 134.585, 0 failed
progress: 120.0 s, 3051.6 tps, lat 16.383 ms stddev 63.253, 0 failed
progress: 130.0 s, 3657.2 tps, lat 13.667 ms stddev 14.375, 0 failed
progress: 140.0 s, 3159.0 tps, lat 14.259 ms stddev 18.915, 0 failed
progress: 150.0 s, 2889.8 tps, lat 19.006 ms stddev 121.852, 0 failed
progress: 160.0 s, 3649.0 tps, lat 13.693 ms stddev 14.288, 0 failed
progress: 170.0 s, 2799.8 tps, lat 14.552 ms stddev 17.307, 0 failed
progress: 180.0 s, 2582.9 tps, lat 22.914 ms stddev 121.785, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 556329
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 226554/556329 (40.723%)
latency average = 16.160 ms
latency stddev = 69.085 ms
initial connection time = 230.786 ms
tps = 3086.209412 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.084 0 BEGIN;
2.997 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.400 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.014 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.094 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.217 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.346 0 END;
------------------------------------------
AIX with __sync_lock_test_and_set
pgdev@roxxpg2:~/pgdb/postgres/install]
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3391.8 tps, lat 14.339 ms stddev 13.922, 0 failed
progress: 20.0 s, 2724.0 tps, lat 18.350 ms stddev 96.241, 0 failed
progress: 30.0 s, 3571.4 tps, lat 14.001 ms stddev 14.957, 0 failed
progress: 40.0 s, 2630.9 tps, lat 18.993 ms stddev 115.583, 0 failed
progress: 50.0 s, 3574.5 tps, lat 13.984 ms stddev 14.838, 0 failed
progress: 60.0 s, 3577.0 tps, lat 13.973 ms stddev 15.055, 0 failed
progress: 70.0 s, 2401.7 tps, lat 20.810 ms stddev 149.104, 0 failed
progress: 80.0 s, 2891.0 tps, lat 17.291 ms stddev 73.637, 0 failed
progress: 90.0 s, 3529.0 tps, lat 14.160 ms stddev 15.212, 0 failed
progress: 100.0 s, 2637.2 tps, lat 18.951 ms stddev 111.379, 0 failed
progress: 110.0 s, 3593.1 tps, lat 13.903 ms stddev 14.604, 0 failed
progress: 120.0 s, 3560.3 tps, lat 14.048 ms stddev 14.926, 0 failed
progress: 130.0 s, 3230.5 tps, lat 13.796 ms stddev 15.330, 0 failed
progress: 140.0 s, 2293.2 tps, lat 24.154 ms stddev 163.908, 0 failed
progress: 150.0 s, 3511.8 tps, lat 14.219 ms stddev 15.367, 0 failed
progress: 160.0 s, 3612.9 tps, lat 13.836 ms stddev 14.839, 0 failed
progress: 170.0 s, 2523.9 tps, lat 19.811 ms stddev 129.520, 0 failed
progress: 180.0 s, 3533.7 tps, lat 14.136 ms stddev 14.988, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 567936
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 230810/567936 (40.640%)
latency average = 15.821 ms
latency stddev = 69.610 ms
initial connection time = 249.668 ms
tps = 3158.149150 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.092 0 BEGIN;
2.794 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
1.472 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
2.040 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
4.062 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
1.225 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.117 0 END;
------------------------------------------
PPCle with asm code
Pple - with asm
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4932.9 tps, lat 10.110 ms stddev 7.215, 0 failed
progress: 20.0 s, 5041.2 tps, lat 9.916 ms stddev 6.794, 0 failed
progress: 30.0 s, 5135.3 tps, lat 9.737 ms stddev 6.572, 0 failed
progress: 40.0 s, 5085.2 tps, lat 9.830 ms stddev 6.556, 0 failed
progress: 50.0 s, 5199.0 tps, lat 9.616 ms stddev 6.579, 0 failed
progress: 60.0 s, 5173.5 tps, lat 9.663 ms stddev 6.536, 0 failed
progress: 70.0 s, 5184.9 tps, lat 9.643 ms stddev 6.796, 0 failed
progress: 80.0 s, 5205.1 tps, lat 9.605 ms stddev 6.639, 0 failed
progress: 90.0 s, 5209.5 tps, lat 9.598 ms stddev 6.636, 0 failed
progress: 100.0 s, 5141.9 tps, lat 9.723 ms stddev 6.631, 0 failed
progress: 110.0 s, 5204.0 tps, lat 9.607 ms stddev 6.494, 0 failed
progress: 120.0 s, 5187.3 tps, lat 9.638 ms stddev 6.683, 0 failed
progress: 130.0 s, 5046.7 tps, lat 9.904 ms stddev 6.820, 0 failed
progress: 140.0 s, 4643.9 tps, lat 10.768 ms stddev 7.380, 0 failed
progress: 150.0 s, 5080.3 tps, lat 9.840 ms stddev 6.681, 0 failed
progress: 160.0 s, 5152.3 tps, lat 9.705 ms stddev 6.669, 0 failed
progress: 170.0 s, 5106.7 tps, lat 9.790 ms stddev 6.518, 0 failed
progress: 180.0 s, 5130.0 tps, lat 9.743 ms stddev 6.651, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 918647
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 356945/918647 (38.856%)
latency average = 9.796 ms
latency stddev = 6.718 ms
initial connection time = 19.606 ms
tps = 5103.024267 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.578 0 BEGIN;
1.764 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.595 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
0.922 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2.504 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.499 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2.956 0 END;
------------------------------------------
PPCle with __sync_lock_test_and_set
PPCle - with __sync
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4817.2 tps, lat 10.353 ms stddev 7.367, 0 failed
progress: 20.0 s, 4737.2 tps, lat 10.552 ms stddev 7.232, 0 failed
progress: 30.0 s, 4774.7 tps, lat 10.470 ms stddev 7.186, 0 failed
progress: 40.0 s, 4892.3 tps, lat 10.219 ms stddev 7.072, 0 failed
progress: 50.0 s, 4811.5 tps, lat 10.391 ms stddev 7.123, 0 failed
progress: 60.0 s, 4883.1 tps, lat 10.242 ms stddev 6.962, 0 failed
progress: 70.0 s, 4867.8 tps, lat 10.269 ms stddev 7.049, 0 failed
progress: 80.0 s, 4886.6 tps, lat 10.228 ms stddev 7.037, 0 failed
progress: 90.0 s, 4765.9 tps, lat 10.494 ms stddev 7.149, 0 failed
progress: 100.0 s, 4902.0 tps, lat 10.198 ms stddev 7.030, 0 failed
progress: 110.0 s, 4815.3 tps, lat 10.381 ms stddev 7.208, 0 failed
progress: 120.0 s, 4807.1 tps, lat 10.400 ms stddev 7.059, 0 failed
progress: 130.0 s, 4932.0 tps, lat 10.137 ms stddev 6.973, 0 failed
progress: 140.0 s, 4880.6 tps, lat 10.244 ms stddev 7.009, 0 failed
progress: 150.0 s, 4613.2 tps, lat 10.837 ms stddev 7.594, 0 failed
progress: 160.0 s, 4335.8 tps, lat 11.533 ms stddev 7.776, 0 failed
progress: 170.0 s, 4904.0 tps, lat 10.194 ms stddev 6.935, 0 failed
progress: 180.0 s, 4762.6 tps, lat 10.501 ms stddev 7.194, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 863937
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 364346/863937 (42.173%)
latency average = 10.416 ms
latency stddev = 7.168 ms
initial connection time = 20.090 ms
tps = 4799.621896 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.628 0 BEGIN;
1.793 0 UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.627 0 SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
0.977 0 UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
2.694 0 UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.525 0 INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.194 0 END;
------------------------------------------
[application/octet-stream] 0001-AIX-support.v8.patch (14.1K, 5-0001-AIX-support.v8.patch)
download | inline diff:
From c854025252ca3dfff9f7f1c4d4aed21cf0cf5346 Mon Sep 17 00:00:00 2001
From: Sriram RK <[email protected]>
Date: Fri, 4 Apr 2025 13:16:21 -0500
Subject: [PATCH] AIX support.
---
Makefile | 2 -
configure | 34 ++++++++++++++---
configure.ac | 34 ++++++++++++++---
src/Makefile.shlib | 29 ++++++++++++++
src/backend/Makefile | 20 ++++++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 4 ++
src/include/storage/s_lock.h | 10 ++---
src/makefiles/Makefile.aix | 29 ++++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 7 ++++
12 files changed, 214 insertions(+), 20 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 11615d1122d..6088fa26679 100755
--- a/configure
+++ b/configure
@@ -3008,6 +3008,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -16953,13 +16954,34 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index debdf165044..c21aaa52064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -1987,13 +1988,34 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- AC_MSG_ERROR([alignment of 'int64_t' is greater than the alignment of 'double'])
fi
AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any C data type.])
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index fa81f6ffdd6..13ea84ac185 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 8a6b6905079..3a8e9dc30b0 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -904,7 +904,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..7d08480c8c0
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,4 @@
+/*
+ * src/include/port/aix.h
+ */
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..5da9b3acda4 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -421,17 +421,15 @@ tas(volatile slock_t *lock)
__asm__ __volatile__(
" lwarx %0,0,%3,1 \n"
" 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: \n"
+" beq $+12 \n" /* branch to lwsync */
" li %1,1 \n"
-" b 3f \n"
-"2: \n"
+" b $+12 \n" /* branch to end of asm sequence */
" lwsync \n"
" li %1,0 \n"
-"3: \n"
+
: "=&b"(_t), "=r"(_res), "+m"(*lock)
: "r"(lock)
: "memory", "cc");
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..ab6581533d8
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,29 @@
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..48a3ce55cf7
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,7 @@
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+CFLAGS_SL=""
+
+# Native memset() is faster.
+MEMSET_LOOP_LIMIT=0
--
2.41.0
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-09-03 16:44 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-09-03 16:44 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; pgsql-hackers; +Cc: Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Hi Heikki and team,
As part of our ongoing efforts to enhance AIX platform compatibility, we’ve been running the code across all stable PostgreSQL release branches using the build farm infrastructure. All test suites, including TAP tests, are passing consistently, indicating no regressions.
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=douc&br=REL_13_STABLE
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=douc&br=REL_14_STABLE
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=douc&br=REL_15_STABLE
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=douc&br=REL_16_STABLE << Also tested locally.
To further validated the patch, we executed the build farm scripts locally for PostgreSQL 17 and 18 on AIX. The corresponding test results are attached for reference.
We value your feedback and would appreciate your insights on the attached patch. Kindly request you to review and share your comments.
Warm regards,
Sriram.
Sun Aug 10 22:34:32 2025: buildfarm run for urus:REL_16_STABLE starting
urus:REL_16_STABLE [22:34:43] checking out source ...
running git clone -q /home/pgdev/bfarm/build-farm-19.1.16/buildroot/pgmirror.git "/home/pgdev/bfarm/build-farm-19.1.16/buildroot/HEAD/pgsql"
urus:REL_16_STABLE [22:41:18] checking if build run needed ...
urus:REL_16_STABLE [22:41:18] copying source to pgsql.build ...
urus:REL_16_STABLE [22:41:27] running configure ...
urus:REL_16_STABLE [22:42:11] running build ...
urus:REL_16_STABLE [22:53:07] running basic regression tests ...
urus:REL_16_STABLE [22:54:23] running make contrib ...
urus:REL_16_STABLE [22:55:29] running make testmodules ...
urus:REL_16_STABLE [22:55:39] running install ...
urus:REL_16_STABLE [22:56:09] running make contrib install ...
urus:REL_16_STABLE [22:56:19] running testmodules install ...
urus:REL_16_STABLE [22:56:24] running make check miscellaneous modules ...
urus:REL_16_STABLE [22:57:41] running bin test initdb ...
urus:REL_16_STABLE [22:57:52] running bin test pg_amcheck ...
urus:REL_16_STABLE [22:58:11] running bin test pg_archivecleanup ...
urus:REL_16_STABLE [22:58:12] running bin test pg_basebackup ...
urus:REL_16_STABLE [22:59:02] running bin test pg_checksums ...
urus:REL_16_STABLE [22:59:09] running bin test pg_config ...
urus:REL_16_STABLE [22:59:09] running bin test pg_controldata ...
urus:REL_16_STABLE [22:59:12] running bin test pg_ctl ...
urus:REL_16_STABLE [22:59:31] running bin test pg_dump ...
urus:REL_16_STABLE [23:00:10] running bin test pg_resetwal ...
urus:REL_16_STABLE [23:00:15] running bin test pg_rewind ...
urus:REL_16_STABLE [23:01:49] running bin test pg_test_fsync ...
urus:REL_16_STABLE [23:01:50] running bin test pg_test_timing ...
urus:REL_16_STABLE [23:01:50] running bin test pg_upgrade ...
urus:REL_16_STABLE [23:02:55] running bin test pg_verifybackup ...
urus:REL_16_STABLE [23:03:57] running bin test pg_waldump ...
urus:REL_16_STABLE [23:04:01] running bin test pgbench ...
urus:REL_16_STABLE [23:04:13] running bin test psql ...
urus:REL_16_STABLE [23:04:20] running bin test scripts ...
urus:REL_16_STABLE [23:05:10] running test misc-recovery ...
urus:REL_16_STABLE [23:11:33] running test misc-subscription ...
urus:REL_16_STABLE [23:16:21] running test misc-authentication ...
urus:REL_16_STABLE [23:16:37] running misc test module-brin ...
urus:REL_16_STABLE [23:16:50] running misc test module-commit_ts ...
urus:REL_16_STABLE [23:17:15] running misc test module-ldap_password_func ...
urus:REL_16_STABLE [23:17:16] running misc test module-libpq_pipeline ...
urus:REL_16_STABLE [23:17:19] running misc test module-ssl_passphrase_callback ...
urus:REL_16_STABLE [23:17:23] running misc test module-test_custom_rmgrs ...
urus:REL_16_STABLE [23:17:26] running misc test module-test_escape ...
urus:REL_16_STABLE [23:17:29] running misc test module-test_misc ...
urus:REL_16_STABLE [23:17:43] running misc test module-test_pg_dump ...
urus:REL_16_STABLE [23:17:53] running misc test module-libpq ...
urus:REL_16_STABLE [23:18:04] running misc test module-pg_bsd_indent ...
urus:REL_16_STABLE [23:18:08] running contrib test amcheck ...
urus:REL_16_STABLE [23:18:36] running contrib test auto_explain ...
urus:REL_16_STABLE [23:18:43] running contrib test bloom ...
urus:REL_16_STABLE [23:19:03] running contrib test oid2name ...
urus:REL_16_STABLE [23:19:04] running contrib test pg_prewarm ...
urus:REL_16_STABLE [23:19:08] running contrib test test_decoding ...
urus:REL_16_STABLE [23:19:30] running contrib test vacuumlo ...
urus:REL_16_STABLE [23:19:31] setting up db cluster (C)...
urus:REL_16_STABLE [23:19:33] starting db (C)...
urus:REL_16_STABLE [23:19:33] running installcheck (C)...
urus:REL_16_STABLE [23:20:30] restarting db (C)...
urus:REL_16_STABLE [23:20:33] running make isolation check ...
urus:REL_16_STABLE [23:21:09] restarting db (C)...
urus:REL_16_STABLE [23:21:14] running make PL installcheck (C)...
urus:REL_16_STABLE [23:21:18] restarting db (C)...
urus:REL_16_STABLE [23:21:20] running make contrib installcheck (C)...
urus:REL_16_STABLE [23:25:29] restarting db (C)...
urus:REL_16_STABLE [23:25:31] running make test-modules installcheck (C)...
urus:REL_16_STABLE [23:26:31] stopping db (C)...
urus:REL_16_STABLE [23:26:32] running make ecpg check ...
urus:REL_16_STABLE [23:27:15] OK
Branch: REL_16_STABLE
All stages succeeded
Thu Aug 7 04:52:04 2025: buildfarm run for uruspg17:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg17:HEAD [04:52:54] running configure ...
uruspg17:HEAD [04:53:43] running build ...
uruspg17:HEAD [05:05:18] running basic regression tests ...
uruspg17:HEAD [05:10:34] running make contrib ...
uruspg17:HEAD [05:11:40] running make testmodules ...
uruspg17:HEAD [05:11:53] running install ...
uruspg17:HEAD [05:12:20] running make contrib install ...
uruspg17:HEAD [05:12:31] running testmodules install ...
uruspg17:HEAD [05:12:36] running make check miscellaneous modules ...
uruspg17:HEAD [05:13:34] running bin test initdb ...
uruspg17:HEAD [05:13:52] running bin test pg_amcheck ...
uruspg17:HEAD [05:14:17] running bin test pg_archivecleanup ...
uruspg17:HEAD [05:14:17] running bin test pg_basebackup ...
uruspg17:HEAD [05:15:31] running bin test pg_checksums ...
uruspg17:HEAD [05:15:37] running bin test pg_combinebackup ...
uruspg17:HEAD [05:16:55] running bin test pg_config ...
uruspg17:HEAD [05:16:55] running bin test pg_controldata ...
uruspg17:HEAD [05:16:58] running bin test pg_ctl ...
uruspg17:HEAD [05:17:18] running bin test pg_dump ...
uruspg17:HEAD [05:20:19] running bin test pg_resetwal ...
uruspg17:HEAD [05:20:28] running bin test pg_rewind ...
uruspg17:HEAD [05:22:29] running bin test pg_test_fsync ...
uruspg17:HEAD [05:22:30] running bin test pg_test_timing ...
uruspg17:HEAD [05:22:30] running bin test pg_upgrade ...
uruspg17:HEAD [05:30:39] running bin test pg_verifybackup ...
uruspg17:HEAD [05:31:43] running bin test pg_waldump ...
uruspg17:HEAD [05:31:51] running bin test pg_walsummary ...
uruspg17:HEAD [05:31:55] running bin test pgbench ...
uruspg17:HEAD [05:32:24] running bin test psql ...
uruspg17:HEAD [05:32:32] running bin test scripts ...
uruspg17:HEAD [05:33:29] running test misc-recovery ...
uruspg17:HEAD [05:47:05] running test misc-subscription ...
uruspg17:HEAD [05:52:54] running test misc-authentication ...
uruspg17:HEAD [05:53:20] running misc test module-brin ...
uruspg17:HEAD [05:53:39] running misc test module-commit_ts ...
uruspg17:HEAD [05:54:15] running misc test module-ldap_password_func ...
uruspg17:HEAD [05:54:15] running misc test module-libpq_pipeline ...
uruspg17:HEAD [05:54:20] running misc test module-ssl_passphrase_callback ...
uruspg17:HEAD [05:54:25] running misc test module-test_custom_rmgrs ...
uruspg17:HEAD [05:54:30] running misc test module-test_escape ...
uruspg17:HEAD [05:54:34] running misc test module-test_json_parser ...
uruspg17:HEAD [05:54:42] running misc test module-test_misc ...
uruspg17:HEAD [05:54:57] running misc test module-test_pg_dump ...
uruspg17:HEAD [05:55:18] running misc test module-worker_spi ...
uruspg17:HEAD [05:55:23] running misc test module-xid_wraparound ...
uruspg17:HEAD [05:55:24] running misc test module-libpq ...
uruspg17:HEAD [05:55:37] running misc test module-pg_bsd_indent ...
uruspg17:HEAD [05:55:40] running contrib test amcheck ...
uruspg17:HEAD [05:56:12] running contrib test auto_explain ...
uruspg17:HEAD [05:56:15] running contrib test bloom ...
uruspg17:HEAD [05:56:38] running contrib test oid2name ...
uruspg17:HEAD [05:56:39] running contrib test pg_prewarm ...
uruspg17:HEAD [05:56:45] running contrib test pg_stat_statements ...
uruspg17:HEAD [05:56:54] running contrib test pg_visibility ...
uruspg17:HEAD [05:57:01] running contrib test test_decoding ...
uruspg17:HEAD [05:57:24] setting up db cluster (C)...
uruspg17:HEAD [05:57:27] starting db (C)...
uruspg17:HEAD [05:57:27] running installcheck (C)...
uruspg17:HEAD [06:04:38] restarting db (C)...
uruspg17:HEAD [06:04:40] running make isolation check ...
uruspg17:HEAD [06:07:07] restarting db (C)...
uruspg17:HEAD [06:07:13] running make PL installcheck (C)...
uruspg17:HEAD [06:07:19] restarting db (C)...
uruspg17:HEAD [06:07:21] running make contrib installcheck (C)...
uruspg17:HEAD [06:12:56] restarting db (C)...
uruspg17:HEAD [06:12:59] running make test-modules installcheck (C)...
uruspg17:HEAD [06:14:37] stopping db (C)...
uruspg17:HEAD [06:14:37] running make ecpg check ...
uruspg17:HEAD [06:15:26] OK
Branch: HEAD
All stages succeeded
Thu Aug 7 01:40:13 2025: buildfarm run for uruspg18:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg18:HEAD [01:40:24] running configure ...
uruspg18:HEAD [01:41:12] running build ...
uruspg18:HEAD [01:53:12] running basic regression tests ...
uruspg18:HEAD [01:59:36] running make contrib ...
uruspg18:HEAD [02:00:47] running make testmodules ...
uruspg18:HEAD [02:01:03] running install ...
uruspg18:HEAD [02:01:30] running make contrib install ...
uruspg18:HEAD [02:01:43] running testmodules install ...
uruspg18:HEAD [02:01:48] running make check miscellaneous modules ...
uruspg18:HEAD [02:03:00] running bin test initdb ...
uruspg18:HEAD [02:03:21] running bin test pg_amcheck ...
uruspg18:HEAD [02:03:46] running bin test pg_archivecleanup ...
uruspg18:HEAD [02:03:47] running bin test pg_basebackup ...
uruspg18:HEAD [02:05:04] running bin test pg_checksums ...
uruspg18:HEAD [02:05:10] running bin test pg_combinebackup ...
uruspg18:HEAD [02:06:41] running bin test pg_config ...
uruspg18:HEAD [02:06:41] running bin test pg_controldata ...
uruspg18:HEAD [02:06:44] running bin test pg_ctl ...
uruspg18:HEAD [02:07:03] running bin test pg_dump ...
uruspg18:HEAD [02:11:41] running bin test pg_resetwal ...
uruspg18:HEAD [02:11:48] running bin test pg_rewind ...
uruspg18:HEAD [02:13:36] running bin test pg_test_fsync ...
uruspg18:HEAD [02:13:37] running bin test pg_test_timing ...
uruspg18:HEAD [02:13:37] running bin test pg_upgrade ...
uruspg18:HEAD [02:24:35] running bin test pg_verifybackup ...
uruspg18:HEAD [02:26:04] running bin test pg_waldump ...
uruspg18:HEAD [02:26:15] running bin test pg_walsummary ...
uruspg18:HEAD [02:26:20] running bin test pgbench ...
uruspg18:HEAD [02:26:52] running bin test psql ...
uruspg18:HEAD [02:27:02] running bin test scripts ...
uruspg18:HEAD [02:28:09] running test misc-recovery ...
uruspg18:HEAD [02:41:40] running test misc-subscription ...
uruspg18:HEAD [02:48:12] running test misc-authentication ...
uruspg18:HEAD [02:48:42] running misc test module-brin ...
uruspg18:HEAD [02:49:00] running misc test module-commit_ts ...
uruspg18:HEAD [02:49:34] running misc test module-injection_points ...
uruspg18:HEAD [02:49:34] running misc test module-ldap_password_func ...
uruspg18:HEAD [02:49:35] running misc test module-libpq_pipeline ...
uruspg18:HEAD [02:49:40] running misc test module-oauth_validator ...
uruspg18:HEAD [02:49:40] running misc test module-ssl_passphrase_callback ...
uruspg18:HEAD [02:49:45] running misc test module-test_aio ...
uruspg18:HEAD [02:50:02] running misc test module-test_custom_rmgrs ...
uruspg18:HEAD [02:50:06] running misc test module-test_escape ...
uruspg18:HEAD [02:50:11] running misc test module-test_extensions ...
uruspg18:HEAD [02:50:21] running misc test module-test_json_parser ...
uruspg18:HEAD [02:50:51] running misc test module-test_misc ...
uruspg18:HEAD [02:51:11] running misc test module-test_pg_dump ...
uruspg18:HEAD [02:51:35] running misc test module-test_slru ...
uruspg18:HEAD [02:51:39] running misc test module-worker_spi ...
uruspg18:HEAD [02:51:46] running misc test module-xid_wraparound ...
uruspg18:HEAD [02:51:47] running misc test module-libpq ...
uruspg18:HEAD [02:52:08] running misc test module-pg_bsd_indent ...
uruspg18:HEAD [02:52:12] running contrib test amcheck ...
uruspg18:HEAD [02:52:52] running contrib test auto_explain ...
uruspg18:HEAD [02:52:56] running contrib test basebackup_to_shell ...
uruspg18:HEAD [02:53:03] running contrib test bloom ...
uruspg18:HEAD [02:53:27] running contrib test oid2name ...
uruspg18:HEAD [02:53:28] running contrib test pg_stat_statements ...
uruspg18:HEAD [02:53:42] running contrib test postgres_fdw ...
Use of uninitialized value $ENV{"PG_TEST_EXTRA"} in pattern match (m//) at ./run_build.pl line 2510.
uruspg18:HEAD [02:54:02] running contrib test test_decoding ...
uruspg18:HEAD [02:54:25] running contrib test vacuumlo ...
uruspg18:HEAD [02:54:26] setting up db cluster (C)...
uruspg18:HEAD [02:54:29] starting db (C)...
uruspg18:HEAD [02:54:29] running installcheck (C)...
uruspg18:HEAD [03:03:12] restarting db (C)...
uruspg18:HEAD [03:03:14] running make isolation check ...
uruspg18:HEAD [03:05:52] restarting db (C)...
uruspg18:HEAD [03:06:00] running make PL installcheck (C)...
uruspg18:HEAD [03:06:06] restarting db (C)...
uruspg18:HEAD [03:06:08] running make contrib installcheck (C)...
uruspg18:HEAD [03:11:59] restarting db (C)...
uruspg18:HEAD [03:12:02] running make test-modules installcheck (C)...
uruspg18:HEAD [03:14:25] stopping db (C)...
uruspg18:HEAD [03:14:26] running make ecpg check ...
uruspg18:HEAD [03:15:16] OK
Branch: HEAD
All stages succeeded
Attachments:
[application/octet-stream] 0001-AIX-support.v9.patch (15.7K, 3-0001-AIX-support.v9.patch)
download | inline diff:
From 24e96d9849f3e6a6217a284aff717ad4d7f2d45a Mon Sep 17 00:00:00 2001
From: AIX-dev <[email protected]>
Date: Wed, 3 Sep 2025 09:37:14 -0500
Subject: [PATCH] AIX support.
---
Makefile | 2 -
configure | 37 +++++++++++++++---
configure.ac | 29 +++++++++++++-
src/Makefile.shlib | 29 ++++++++++++++
src/backend/Makefile | 20 ++++++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 4 ++
src/include/storage/s_lock.h | 48 +++--------------------
src/makefiles/Makefile.aix | 34 +++++++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 7 ++++
12 files changed, 223 insertions(+), 52 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index b363b2f2476..786424613ab 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 1b9980226c5..abda4be633e 100755
--- a/configure
+++ b/configure
@@ -3022,6 +3022,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -17204,13 +17205,37 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+echo "Checking for MAX ALIGN - $PORTNAME"
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $ac_cv_alignof_long_long_int -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ echo "MAX ALIGN ac_cv_alignof_long"
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ echo "MAX ALIGN ac_cv_alignof_double"
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ echo "MAX ALIGN ac_cv_alignof_int64_t"
+ fi
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index 3e3fcfa9831..1ef58a1d7a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -2021,7 +2022,33 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 3825af5b228..35adc4174ed 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 47af743990f..f0f4ff051b5 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -905,7 +905,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..7d08480c8c0
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,4 @@
+/*
+ * src/include/port/aix.h
+ */
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..ba120c08d14 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -398,56 +398,18 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
-/* On PPC, it's a win to use a non-locking test before the lwarx */
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
-/*
- * The second operand of addi can hold a constant zero or a register number,
- * hence constraint "=&b" to avoid allocating r0. "b" stands for "address
- * base register"; most operands having this register-or-zero property are
- * address bases, e.g. the second operand of lwax.
- *
- * 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.
- * But if the spinlock is in ordinary memory, we can use lwsync instead for
- * better performance.
- */
static __inline__ int
tas(volatile slock_t *lock)
{
- slock_t _t;
- int _res;
-
- __asm__ __volatile__(
-" lwarx %0,0,%3,1 \n"
-" cmpwi %0,0 \n"
-" bne 1f \n"
-" addi %0,%0,1 \n"
-" stwcx. %0,0,%3 \n"
-" beq 2f \n"
-"1: \n"
-" li %1,1 \n"
-" b 3f \n"
-"2: \n"
-" lwsync \n"
-" li %1,0 \n"
-"3: \n"
-: "=&b"(_t), "=r"(_res), "+m"(*lock)
-: "r"(lock)
-: "memory", "cc");
- return _res;
+ return __sync_lock_test_and_set(lock, 1);
}
-/*
- * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
- * But we can use lwsync instead for better performance.
- */
-#define S_UNLOCK(lock) \
-do \
-{ \
- __asm__ __volatile__ (" lwsync \n" ::: "memory"); \
- *((volatile slock_t *) (lock)) = 0; \
-} while (0)
+#define S_UNLOCK(lock) __sync_lock_release(lock)
#endif /* powerpc */
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..4c4de8b0be7
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,34 @@
+# -blibpath:
+# The path to be inserted into the default path (Index 0 path) field of the
+# loader section. When this flag is presented, the -L paths will not be stored.
+# AIX uses a stricter, more explicit approach. The runtime linker expects to
+# tell it exactly where to look using -blibpath.
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..bfc193348f4
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,7 @@
+# This file is referred for specific flags wrt to AIX build process like
+# cflags.
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+# With optimization, the MemSet() and MemSetAlign() perform better.
+CFLAGS_SL=" -O2 "
--
2.41.0
[text/plain] build-farm-19.pg16.log (4.3K, 4-build-farm-19.pg16.log)
download | inline:
Sun Aug 10 22:34:32 2025: buildfarm run for urus:REL_16_STABLE starting
urus:REL_16_STABLE [22:34:43] checking out source ...
running git clone -q /home/pgdev/bfarm/build-farm-19.1.16/buildroot/pgmirror.git "/home/pgdev/bfarm/build-farm-19.1.16/buildroot/HEAD/pgsql"
urus:REL_16_STABLE [22:41:18] checking if build run needed ...
urus:REL_16_STABLE [22:41:18] copying source to pgsql.build ...
urus:REL_16_STABLE [22:41:27] running configure ...
urus:REL_16_STABLE [22:42:11] running build ...
urus:REL_16_STABLE [22:53:07] running basic regression tests ...
urus:REL_16_STABLE [22:54:23] running make contrib ...
urus:REL_16_STABLE [22:55:29] running make testmodules ...
urus:REL_16_STABLE [22:55:39] running install ...
urus:REL_16_STABLE [22:56:09] running make contrib install ...
urus:REL_16_STABLE [22:56:19] running testmodules install ...
urus:REL_16_STABLE [22:56:24] running make check miscellaneous modules ...
urus:REL_16_STABLE [22:57:41] running bin test initdb ...
urus:REL_16_STABLE [22:57:52] running bin test pg_amcheck ...
urus:REL_16_STABLE [22:58:11] running bin test pg_archivecleanup ...
urus:REL_16_STABLE [22:58:12] running bin test pg_basebackup ...
urus:REL_16_STABLE [22:59:02] running bin test pg_checksums ...
urus:REL_16_STABLE [22:59:09] running bin test pg_config ...
urus:REL_16_STABLE [22:59:09] running bin test pg_controldata ...
urus:REL_16_STABLE [22:59:12] running bin test pg_ctl ...
urus:REL_16_STABLE [22:59:31] running bin test pg_dump ...
urus:REL_16_STABLE [23:00:10] running bin test pg_resetwal ...
urus:REL_16_STABLE [23:00:15] running bin test pg_rewind ...
urus:REL_16_STABLE [23:01:49] running bin test pg_test_fsync ...
urus:REL_16_STABLE [23:01:50] running bin test pg_test_timing ...
urus:REL_16_STABLE [23:01:50] running bin test pg_upgrade ...
urus:REL_16_STABLE [23:02:55] running bin test pg_verifybackup ...
urus:REL_16_STABLE [23:03:57] running bin test pg_waldump ...
urus:REL_16_STABLE [23:04:01] running bin test pgbench ...
urus:REL_16_STABLE [23:04:13] running bin test psql ...
urus:REL_16_STABLE [23:04:20] running bin test scripts ...
urus:REL_16_STABLE [23:05:10] running test misc-recovery ...
urus:REL_16_STABLE [23:11:33] running test misc-subscription ...
urus:REL_16_STABLE [23:16:21] running test misc-authentication ...
urus:REL_16_STABLE [23:16:37] running misc test module-brin ...
urus:REL_16_STABLE [23:16:50] running misc test module-commit_ts ...
urus:REL_16_STABLE [23:17:15] running misc test module-ldap_password_func ...
urus:REL_16_STABLE [23:17:16] running misc test module-libpq_pipeline ...
urus:REL_16_STABLE [23:17:19] running misc test module-ssl_passphrase_callback ...
urus:REL_16_STABLE [23:17:23] running misc test module-test_custom_rmgrs ...
urus:REL_16_STABLE [23:17:26] running misc test module-test_escape ...
urus:REL_16_STABLE [23:17:29] running misc test module-test_misc ...
urus:REL_16_STABLE [23:17:43] running misc test module-test_pg_dump ...
urus:REL_16_STABLE [23:17:53] running misc test module-libpq ...
urus:REL_16_STABLE [23:18:04] running misc test module-pg_bsd_indent ...
urus:REL_16_STABLE [23:18:08] running contrib test amcheck ...
urus:REL_16_STABLE [23:18:36] running contrib test auto_explain ...
urus:REL_16_STABLE [23:18:43] running contrib test bloom ...
urus:REL_16_STABLE [23:19:03] running contrib test oid2name ...
urus:REL_16_STABLE [23:19:04] running contrib test pg_prewarm ...
urus:REL_16_STABLE [23:19:08] running contrib test test_decoding ...
urus:REL_16_STABLE [23:19:30] running contrib test vacuumlo ...
urus:REL_16_STABLE [23:19:31] setting up db cluster (C)...
urus:REL_16_STABLE [23:19:33] starting db (C)...
urus:REL_16_STABLE [23:19:33] running installcheck (C)...
urus:REL_16_STABLE [23:20:30] restarting db (C)...
urus:REL_16_STABLE [23:20:33] running make isolation check ...
urus:REL_16_STABLE [23:21:09] restarting db (C)...
urus:REL_16_STABLE [23:21:14] running make PL installcheck (C)...
urus:REL_16_STABLE [23:21:18] restarting db (C)...
urus:REL_16_STABLE [23:21:20] running make contrib installcheck (C)...
urus:REL_16_STABLE [23:25:29] restarting db (C)...
urus:REL_16_STABLE [23:25:31] running make test-modules installcheck (C)...
urus:REL_16_STABLE [23:26:31] stopping db (C)...
urus:REL_16_STABLE [23:26:32] running make ecpg check ...
urus:REL_16_STABLE [23:27:15] OK
Branch: REL_16_STABLE
All stages succeeded
[text/plain] build-farm-19.pg17.log (4.7K, 5-build-farm-19.pg17.log)
download | inline:
Thu Aug 7 04:52:04 2025: buildfarm run for uruspg17:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg17:HEAD [04:52:54] running configure ...
uruspg17:HEAD [04:53:43] running build ...
uruspg17:HEAD [05:05:18] running basic regression tests ...
uruspg17:HEAD [05:10:34] running make contrib ...
uruspg17:HEAD [05:11:40] running make testmodules ...
uruspg17:HEAD [05:11:53] running install ...
uruspg17:HEAD [05:12:20] running make contrib install ...
uruspg17:HEAD [05:12:31] running testmodules install ...
uruspg17:HEAD [05:12:36] running make check miscellaneous modules ...
uruspg17:HEAD [05:13:34] running bin test initdb ...
uruspg17:HEAD [05:13:52] running bin test pg_amcheck ...
uruspg17:HEAD [05:14:17] running bin test pg_archivecleanup ...
uruspg17:HEAD [05:14:17] running bin test pg_basebackup ...
uruspg17:HEAD [05:15:31] running bin test pg_checksums ...
uruspg17:HEAD [05:15:37] running bin test pg_combinebackup ...
uruspg17:HEAD [05:16:55] running bin test pg_config ...
uruspg17:HEAD [05:16:55] running bin test pg_controldata ...
uruspg17:HEAD [05:16:58] running bin test pg_ctl ...
uruspg17:HEAD [05:17:18] running bin test pg_dump ...
uruspg17:HEAD [05:20:19] running bin test pg_resetwal ...
uruspg17:HEAD [05:20:28] running bin test pg_rewind ...
uruspg17:HEAD [05:22:29] running bin test pg_test_fsync ...
uruspg17:HEAD [05:22:30] running bin test pg_test_timing ...
uruspg17:HEAD [05:22:30] running bin test pg_upgrade ...
uruspg17:HEAD [05:30:39] running bin test pg_verifybackup ...
uruspg17:HEAD [05:31:43] running bin test pg_waldump ...
uruspg17:HEAD [05:31:51] running bin test pg_walsummary ...
uruspg17:HEAD [05:31:55] running bin test pgbench ...
uruspg17:HEAD [05:32:24] running bin test psql ...
uruspg17:HEAD [05:32:32] running bin test scripts ...
uruspg17:HEAD [05:33:29] running test misc-recovery ...
uruspg17:HEAD [05:47:05] running test misc-subscription ...
uruspg17:HEAD [05:52:54] running test misc-authentication ...
uruspg17:HEAD [05:53:20] running misc test module-brin ...
uruspg17:HEAD [05:53:39] running misc test module-commit_ts ...
uruspg17:HEAD [05:54:15] running misc test module-ldap_password_func ...
uruspg17:HEAD [05:54:15] running misc test module-libpq_pipeline ...
uruspg17:HEAD [05:54:20] running misc test module-ssl_passphrase_callback ...
uruspg17:HEAD [05:54:25] running misc test module-test_custom_rmgrs ...
uruspg17:HEAD [05:54:30] running misc test module-test_escape ...
uruspg17:HEAD [05:54:34] running misc test module-test_json_parser ...
uruspg17:HEAD [05:54:42] running misc test module-test_misc ...
uruspg17:HEAD [05:54:57] running misc test module-test_pg_dump ...
uruspg17:HEAD [05:55:18] running misc test module-worker_spi ...
uruspg17:HEAD [05:55:23] running misc test module-xid_wraparound ...
uruspg17:HEAD [05:55:24] running misc test module-libpq ...
uruspg17:HEAD [05:55:37] running misc test module-pg_bsd_indent ...
uruspg17:HEAD [05:55:40] running contrib test amcheck ...
uruspg17:HEAD [05:56:12] running contrib test auto_explain ...
uruspg17:HEAD [05:56:15] running contrib test bloom ...
uruspg17:HEAD [05:56:38] running contrib test oid2name ...
uruspg17:HEAD [05:56:39] running contrib test pg_prewarm ...
uruspg17:HEAD [05:56:45] running contrib test pg_stat_statements ...
uruspg17:HEAD [05:56:54] running contrib test pg_visibility ...
uruspg17:HEAD [05:57:01] running contrib test test_decoding ...
uruspg17:HEAD [05:57:24] setting up db cluster (C)...
uruspg17:HEAD [05:57:27] starting db (C)...
uruspg17:HEAD [05:57:27] running installcheck (C)...
uruspg17:HEAD [06:04:38] restarting db (C)...
uruspg17:HEAD [06:04:40] running make isolation check ...
uruspg17:HEAD [06:07:07] restarting db (C)...
uruspg17:HEAD [06:07:13] running make PL installcheck (C)...
uruspg17:HEAD [06:07:19] restarting db (C)...
uruspg17:HEAD [06:07:21] running make contrib installcheck (C)...
uruspg17:HEAD [06:12:56] restarting db (C)...
uruspg17:HEAD [06:12:59] running make test-modules installcheck (C)...
uruspg17:HEAD [06:14:37] stopping db (C)...
uruspg17:HEAD [06:14:37] running make ecpg check ...
uruspg17:HEAD [06:15:26] OK
Branch: HEAD
All stages succeeded
[text/plain] build-farm-19.pg18.log (5.3K, 6-build-farm-19.pg18.log)
download | inline:
Thu Aug 7 01:40:13 2025: buildfarm run for uruspg18:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg18:HEAD [01:40:24] running configure ...
uruspg18:HEAD [01:41:12] running build ...
uruspg18:HEAD [01:53:12] running basic regression tests ...
uruspg18:HEAD [01:59:36] running make contrib ...
uruspg18:HEAD [02:00:47] running make testmodules ...
uruspg18:HEAD [02:01:03] running install ...
uruspg18:HEAD [02:01:30] running make contrib install ...
uruspg18:HEAD [02:01:43] running testmodules install ...
uruspg18:HEAD [02:01:48] running make check miscellaneous modules ...
uruspg18:HEAD [02:03:00] running bin test initdb ...
uruspg18:HEAD [02:03:21] running bin test pg_amcheck ...
uruspg18:HEAD [02:03:46] running bin test pg_archivecleanup ...
uruspg18:HEAD [02:03:47] running bin test pg_basebackup ...
uruspg18:HEAD [02:05:04] running bin test pg_checksums ...
uruspg18:HEAD [02:05:10] running bin test pg_combinebackup ...
uruspg18:HEAD [02:06:41] running bin test pg_config ...
uruspg18:HEAD [02:06:41] running bin test pg_controldata ...
uruspg18:HEAD [02:06:44] running bin test pg_ctl ...
uruspg18:HEAD [02:07:03] running bin test pg_dump ...
uruspg18:HEAD [02:11:41] running bin test pg_resetwal ...
uruspg18:HEAD [02:11:48] running bin test pg_rewind ...
uruspg18:HEAD [02:13:36] running bin test pg_test_fsync ...
uruspg18:HEAD [02:13:37] running bin test pg_test_timing ...
uruspg18:HEAD [02:13:37] running bin test pg_upgrade ...
uruspg18:HEAD [02:24:35] running bin test pg_verifybackup ...
uruspg18:HEAD [02:26:04] running bin test pg_waldump ...
uruspg18:HEAD [02:26:15] running bin test pg_walsummary ...
uruspg18:HEAD [02:26:20] running bin test pgbench ...
uruspg18:HEAD [02:26:52] running bin test psql ...
uruspg18:HEAD [02:27:02] running bin test scripts ...
uruspg18:HEAD [02:28:09] running test misc-recovery ...
uruspg18:HEAD [02:41:40] running test misc-subscription ...
uruspg18:HEAD [02:48:12] running test misc-authentication ...
uruspg18:HEAD [02:48:42] running misc test module-brin ...
uruspg18:HEAD [02:49:00] running misc test module-commit_ts ...
uruspg18:HEAD [02:49:34] running misc test module-injection_points ...
uruspg18:HEAD [02:49:34] running misc test module-ldap_password_func ...
uruspg18:HEAD [02:49:35] running misc test module-libpq_pipeline ...
uruspg18:HEAD [02:49:40] running misc test module-oauth_validator ...
uruspg18:HEAD [02:49:40] running misc test module-ssl_passphrase_callback ...
uruspg18:HEAD [02:49:45] running misc test module-test_aio ...
uruspg18:HEAD [02:50:02] running misc test module-test_custom_rmgrs ...
uruspg18:HEAD [02:50:06] running misc test module-test_escape ...
uruspg18:HEAD [02:50:11] running misc test module-test_extensions ...
uruspg18:HEAD [02:50:21] running misc test module-test_json_parser ...
uruspg18:HEAD [02:50:51] running misc test module-test_misc ...
uruspg18:HEAD [02:51:11] running misc test module-test_pg_dump ...
uruspg18:HEAD [02:51:35] running misc test module-test_slru ...
uruspg18:HEAD [02:51:39] running misc test module-worker_spi ...
uruspg18:HEAD [02:51:46] running misc test module-xid_wraparound ...
uruspg18:HEAD [02:51:47] running misc test module-libpq ...
uruspg18:HEAD [02:52:08] running misc test module-pg_bsd_indent ...
uruspg18:HEAD [02:52:12] running contrib test amcheck ...
uruspg18:HEAD [02:52:52] running contrib test auto_explain ...
uruspg18:HEAD [02:52:56] running contrib test basebackup_to_shell ...
uruspg18:HEAD [02:53:03] running contrib test bloom ...
uruspg18:HEAD [02:53:27] running contrib test oid2name ...
uruspg18:HEAD [02:53:28] running contrib test pg_stat_statements ...
uruspg18:HEAD [02:53:42] running contrib test postgres_fdw ...
Use of uninitialized value $ENV{"PG_TEST_EXTRA"} in pattern match (m//) at ./run_build.pl line 2510.
uruspg18:HEAD [02:54:02] running contrib test test_decoding ...
uruspg18:HEAD [02:54:25] running contrib test vacuumlo ...
uruspg18:HEAD [02:54:26] setting up db cluster (C)...
uruspg18:HEAD [02:54:29] starting db (C)...
uruspg18:HEAD [02:54:29] running installcheck (C)...
uruspg18:HEAD [03:03:12] restarting db (C)...
uruspg18:HEAD [03:03:14] running make isolation check ...
uruspg18:HEAD [03:05:52] restarting db (C)...
uruspg18:HEAD [03:06:00] running make PL installcheck (C)...
uruspg18:HEAD [03:06:06] restarting db (C)...
uruspg18:HEAD [03:06:08] running make contrib installcheck (C)...
uruspg18:HEAD [03:11:59] restarting db (C)...
uruspg18:HEAD [03:12:02] running make test-modules installcheck (C)...
uruspg18:HEAD [03:14:25] stopping db (C)...
uruspg18:HEAD [03:14:26] running make ecpg check ...
uruspg18:HEAD [03:15:16] OK
Branch: HEAD
All stages succeeded
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-11 05:20 Vamshikrishna T <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 2 replies; 73+ messages in thread
From: Vamshikrishna T @ 2025-09-11 05:20 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; pgsql-hackers; Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Hi Team,
Just checking in regarding the AIX support patch shared earlier. As
mentioned, we’ve successfully run the patch across all stable PostgreSQL
releases using the build farm, and all tests—including TAP—have passed. We
also ran the build farm scripts locally for PostgreSQL 17 and 18 on AIX,
and the test results were attached for your reference.
We’d appreciate your review and feedback on the patch. Once we receive your
input, our next steps will be:
1. Address any comments or suggestions you may have.
2. Finalize the patch based on feedback.
3. Proceed with integration into the relevant branches.
Please let us know if you need any additional details or clarification.
Thanks
Vamshi.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-11 06:12 Laurenz Albe <[email protected]>
parent: Vamshikrishna T <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Laurenz Albe @ 2025-09-11 06:12 UTC (permalink / raw)
To: Vamshikrishna T <[email protected]>; Srirama Kucherlapati <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; pgsql-hackers; Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
On Thu, 2025-09-11 at 10:50 +0530, Vamshikrishna T wrote:
> Just checking in regarding the AIX support patch shared earlier.
Did you create a commitfest entry?
That way, your patch is less likely to fall between the cracks.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-11 10:48 Vamshikrishna T <[email protected]>
parent: Laurenz Albe <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Vamshikrishna T @ 2025-09-11 10:48 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Thank you Laurenz for the info, Raised the review request here.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-15 23:44 Bruce Momjian <[email protected]>
parent: Vamshikrishna T <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Bruce Momjian @ 2025-09-15 23:44 UTC (permalink / raw)
To: Vamshikrishna T <[email protected]>; +Cc: Srirama Kucherlapati <[email protected]>; Heikki Linnakangas <[email protected]>; pgsql-hackers; Robert Haas <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
On Thu, Sep 11, 2025 at 10:50:45AM +0530, Vamshikrishna T wrote:
> We’d appreciate your review and feedback on the patch. Once we receive your
> input, our next steps will be:
>
> 1. Address any comments or suggestions you may have.
>
> 2. Finalize the patch based on feedback.
>
> 3. Proceed with integration into the relevant branches.
I assume the only relevant branch is PG 19.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-09-16 15:13 Srirama Kucherlapati <[email protected]>
parent: Bruce Momjian <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-09-16 15:13 UTC (permalink / raw)
To: Bruce Momjian <[email protected]>; Vamshikrishna T <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; pgsql-hackers; Robert Haas <[email protected]>; Peter Eisentraut <[email protected]>; Alvaro Herrera <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
Hi Bruce,
Please find the attached patch that is run on master branch PG19.
Kindly request you to go through and let us know your feedback.
Also attached are the builfarm results.
Warm regards,
Sriram.
Mon Sep 15 18:56:20 2025: buildfarm run for uruspg19:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg19:HEAD [18:59:44] running configure ...
uruspg19:HEAD [19:01:04] running build ...
uruspg19:HEAD [19:01:52] running basic regression tests ...
uruspg19:HEAD [19:10:10] running make contrib ...
uruspg19:HEAD [19:10:11] running make testmodules ...
uruspg19:HEAD [19:10:12] running install ...
uruspg19:HEAD [19:10:56] running make contrib install ...
uruspg19:HEAD [19:11:12] running testmodules install ...
uruspg19:HEAD [19:11:19] running make check miscellaneous modules ...
uruspg19:HEAD [19:13:31] running bin test initdb ...
uruspg19:HEAD [19:13:57] running bin test pg_amcheck ...
uruspg19:HEAD [19:14:23] running bin test pg_archivecleanup ...
uruspg19:HEAD [19:14:24] running bin test pg_basebackup ...
uruspg19:HEAD [19:15:38] running bin test pg_checksums ...
uruspg19:HEAD [19:15:45] running bin test pg_combinebackup ...
uruspg19:HEAD [19:17:10] running bin test pg_config ...
uruspg19:HEAD [19:17:10] running bin test pg_controldata ...
uruspg19:HEAD [19:17:13] running bin test pg_ctl ...
uruspg19:HEAD [19:17:31] running bin test pg_dump ...
uruspg19:HEAD [19:20:40] running bin test pg_resetwal ...
uruspg19:HEAD [19:20:46] running bin test pg_rewind ...
uruspg19:HEAD [19:22:25] running bin test pg_test_fsync ...
uruspg19:HEAD [19:22:26] running bin test pg_test_timing ...
uruspg19:HEAD [19:22:28] running bin test pg_upgrade ...
uruspg19:HEAD [19:33:01] running bin test pg_verifybackup ...
uruspg19:HEAD [19:34:38] running bin test pg_waldump ...
uruspg19:HEAD [19:34:49] running bin test pg_walsummary ...
uruspg19:HEAD [19:34:54] running bin test pgbench ...
uruspg19:HEAD [19:35:25] running bin test psql ...
uruspg19:HEAD [19:35:34] running bin test scripts ...
uruspg19:HEAD [19:36:55] running test misc-recovery ...
uruspg19:HEAD [19:57:56] running test misc-subscription ...
uruspg19:HEAD [20:05:06] running test misc-authentication ...
uruspg19:HEAD [20:05:30] running misc test module-brin ...
uruspg19:HEAD [20:05:44] running misc test module-commit_ts ...
uruspg19:HEAD [20:06:10] running misc test module-injection_points ...
uruspg19:HEAD [20:06:10] running misc test module-ldap_password_func ...
uruspg19:HEAD [20:06:11] running misc test module-libpq_pipeline ...
uruspg19:HEAD [20:06:15] running misc test module-oauth_validator ...
uruspg19:HEAD [20:06:16] running misc test module-ssl_passphrase_callback ...
uruspg19:HEAD [20:06:19] running misc test module-test_aio ...
uruspg19:HEAD [20:06:34] running misc test module-test_custom_rmgrs ...
uruspg19:HEAD [20:06:37] running misc test module-test_escape ...
uruspg19:HEAD [20:06:41] running misc test module-test_extensions ...
uruspg19:HEAD [20:06:48] running misc test module-test_int128 ...
uruspg19:HEAD [20:06:49] running misc test module-test_json_parser ...
uruspg19:HEAD [20:07:19] running misc test module-test_misc ...
uruspg19:HEAD [20:07:34] running misc test module-test_pg_dump ...
uruspg19:HEAD [20:07:56] running misc test module-test_slru ...
uruspg19:HEAD [20:07:59] running misc test module-worker_spi ...
uruspg19:HEAD [20:08:05] running misc test module-xid_wraparound ...
uruspg19:HEAD [20:08:06] running misc test module-libpq ...
uruspg19:HEAD [20:08:25] running misc test module-pg_bsd_indent ...
uruspg19:HEAD [20:08:29] running contrib test amcheck ...
uruspg19:HEAD [20:09:09] running contrib test auto_explain ...
uruspg19:HEAD [20:09:16] running contrib test basebackup_to_shell ...
uruspg19:HEAD [20:09:23] running contrib test bloom ...
uruspg19:HEAD [20:09:48] running contrib test oid2name ...
uruspg19:HEAD [20:09:49] running contrib test pg_stat_statements ...
uruspg19:HEAD [20:10:03] running contrib test postgres_fdw ...
Use of uninitialized value $ENV{"PG_TEST_EXTRA"} in pattern match (m//) at ./run_build.pl line 2510.
uruspg19:HEAD [20:10:24] running contrib test test_decoding ...
uruspg19:HEAD [20:10:47] running contrib test vacuumlo ...
uruspg19:HEAD [20:10:48] setting up db cluster (C)...
uruspg19:HEAD [20:10:50] starting db (C)...
uruspg19:HEAD [20:10:50] running installcheck (C)...
uruspg19:HEAD [20:19:31] restarting db (C)...
uruspg19:HEAD [20:19:34] running make isolation check ...
uruspg19:HEAD [20:22:11] restarting db (C)...
uruspg19:HEAD [20:22:18] running make PL installcheck (C)...
uruspg19:HEAD [20:22:24] restarting db (C)...
uruspg19:HEAD [20:22:26] running make contrib installcheck (C)...
uruspg19:HEAD [20:30:42] restarting db (C)...
uruspg19:HEAD [20:30:47] running make test-modules installcheck (C)...
uruspg19:HEAD [20:36:44] stopping db (C)...
uruspg19:HEAD [20:36:46] running make ecpg check ...
uruspg19:HEAD [20:37:19] OK
Branch: HEAD
All stages succeeded
Attachments:
[application/octet-stream] 0001-Changes-to-add-support-for-AIX.v9.pg19.patch (15.7K, 3-0001-Changes-to-add-support-for-AIX.v9.pg19.patch)
download | inline diff:
From 407b42b1fbe562dff69820f7456dbb32a8a37d79 Mon Sep 17 00:00:00 2001
From: AIX-dev <[email protected]>
Date: Tue, 16 Sep 2025 08:59:22 -0500
Subject: [PATCH] Changes to add support for AIX.
---
Makefile | 2 -
configure | 37 +++++++++++++++---
configure.ac | 29 +++++++++++++-
src/Makefile.shlib | 29 ++++++++++++++
src/backend/Makefile | 20 ++++++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 4 ++
src/include/storage/s_lock.h | 48 +++--------------------
src/makefiles/Makefile.aix | 34 +++++++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 7 ++++
12 files changed, 223 insertions(+), 52 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 507a2437c33..67cad0f5581 100755
--- a/configure
+++ b/configure
@@ -3022,6 +3022,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -17204,13 +17205,37 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+echo "Checking for MAX ALIGN - $PORTNAME"
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $ac_cv_alignof_long_long_int -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ echo "MAX ALIGN ac_cv_alignof_long"
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ echo "MAX ALIGN ac_cv_alignof_double"
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ echo "MAX ALIGN ac_cv_alignof_int64_t"
+ fi
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index 5f4548adc5c..a25aedacef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -2021,7 +2022,33 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 3825af5b228..35adc4174ed 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index b7b9692f8c8..d0c4b7ba3ac 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -905,7 +905,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..7d08480c8c0
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,4 @@
+/*
+ * src/include/port/aix.h
+ */
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..ba120c08d14 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -398,56 +398,18 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
-/* On PPC, it's a win to use a non-locking test before the lwarx */
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
-/*
- * The second operand of addi can hold a constant zero or a register number,
- * hence constraint "=&b" to avoid allocating r0. "b" stands for "address
- * base register"; most operands having this register-or-zero property are
- * address bases, e.g. the second operand of lwax.
- *
- * 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.
- * But if the spinlock is in ordinary memory, we can use lwsync instead for
- * better performance.
- */
static __inline__ int
tas(volatile slock_t *lock)
{
- slock_t _t;
- int _res;
-
- __asm__ __volatile__(
-" lwarx %0,0,%3,1 \n"
-" cmpwi %0,0 \n"
-" bne 1f \n"
-" addi %0,%0,1 \n"
-" stwcx. %0,0,%3 \n"
-" beq 2f \n"
-"1: \n"
-" li %1,1 \n"
-" b 3f \n"
-"2: \n"
-" lwsync \n"
-" li %1,0 \n"
-"3: \n"
-: "=&b"(_t), "=r"(_res), "+m"(*lock)
-: "r"(lock)
-: "memory", "cc");
- return _res;
+ return __sync_lock_test_and_set(lock, 1);
}
-/*
- * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
- * But we can use lwsync instead for better performance.
- */
-#define S_UNLOCK(lock) \
-do \
-{ \
- __asm__ __volatile__ (" lwsync \n" ::: "memory"); \
- *((volatile slock_t *) (lock)) = 0; \
-} while (0)
+#define S_UNLOCK(lock) __sync_lock_release(lock)
#endif /* powerpc */
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..4c4de8b0be7
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,34 @@
+# -blibpath:
+# The path to be inserted into the default path (Index 0 path) field of the
+# loader section. When this flag is presented, the -L paths will not be stored.
+# AIX uses a stricter, more explicit approach. The runtime linker expects to
+# tell it exactly where to look using -blibpath.
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..bfc193348f4
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,7 @@
+# This file is referred for specific flags wrt to AIX build process like
+# cflags.
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+# With optimization, the MemSet() and MemSetAlign() perform better.
+CFLAGS_SL=" -O2 "
--
2.41.0
[text/plain] bfarm.19.log (5.3K, 4-bfarm.19.log)
download | inline:
Mon Sep 15 18:56:20 2025: buildfarm run for uruspg19:HEAD starting
branch not specified, locks, logs, build artefacts etc will go in HEAD
uruspg19:HEAD [18:59:44] running configure ...
uruspg19:HEAD [19:01:04] running build ...
uruspg19:HEAD [19:01:52] running basic regression tests ...
uruspg19:HEAD [19:10:10] running make contrib ...
uruspg19:HEAD [19:10:11] running make testmodules ...
uruspg19:HEAD [19:10:12] running install ...
uruspg19:HEAD [19:10:56] running make contrib install ...
uruspg19:HEAD [19:11:12] running testmodules install ...
uruspg19:HEAD [19:11:19] running make check miscellaneous modules ...
uruspg19:HEAD [19:13:31] running bin test initdb ...
uruspg19:HEAD [19:13:57] running bin test pg_amcheck ...
uruspg19:HEAD [19:14:23] running bin test pg_archivecleanup ...
uruspg19:HEAD [19:14:24] running bin test pg_basebackup ...
uruspg19:HEAD [19:15:38] running bin test pg_checksums ...
uruspg19:HEAD [19:15:45] running bin test pg_combinebackup ...
uruspg19:HEAD [19:17:10] running bin test pg_config ...
uruspg19:HEAD [19:17:10] running bin test pg_controldata ...
uruspg19:HEAD [19:17:13] running bin test pg_ctl ...
uruspg19:HEAD [19:17:31] running bin test pg_dump ...
uruspg19:HEAD [19:20:40] running bin test pg_resetwal ...
uruspg19:HEAD [19:20:46] running bin test pg_rewind ...
uruspg19:HEAD [19:22:25] running bin test pg_test_fsync ...
uruspg19:HEAD [19:22:26] running bin test pg_test_timing ...
uruspg19:HEAD [19:22:28] running bin test pg_upgrade ...
uruspg19:HEAD [19:33:01] running bin test pg_verifybackup ...
uruspg19:HEAD [19:34:38] running bin test pg_waldump ...
uruspg19:HEAD [19:34:49] running bin test pg_walsummary ...
uruspg19:HEAD [19:34:54] running bin test pgbench ...
uruspg19:HEAD [19:35:25] running bin test psql ...
uruspg19:HEAD [19:35:34] running bin test scripts ...
uruspg19:HEAD [19:36:55] running test misc-recovery ...
uruspg19:HEAD [19:57:56] running test misc-subscription ...
uruspg19:HEAD [20:05:06] running test misc-authentication ...
uruspg19:HEAD [20:05:30] running misc test module-brin ...
uruspg19:HEAD [20:05:44] running misc test module-commit_ts ...
uruspg19:HEAD [20:06:10] running misc test module-injection_points ...
uruspg19:HEAD [20:06:10] running misc test module-ldap_password_func ...
uruspg19:HEAD [20:06:11] running misc test module-libpq_pipeline ...
uruspg19:HEAD [20:06:15] running misc test module-oauth_validator ...
uruspg19:HEAD [20:06:16] running misc test module-ssl_passphrase_callback ...
uruspg19:HEAD [20:06:19] running misc test module-test_aio ...
uruspg19:HEAD [20:06:34] running misc test module-test_custom_rmgrs ...
uruspg19:HEAD [20:06:37] running misc test module-test_escape ...
uruspg19:HEAD [20:06:41] running misc test module-test_extensions ...
uruspg19:HEAD [20:06:48] running misc test module-test_int128 ...
uruspg19:HEAD [20:06:49] running misc test module-test_json_parser ...
uruspg19:HEAD [20:07:19] running misc test module-test_misc ...
uruspg19:HEAD [20:07:34] running misc test module-test_pg_dump ...
uruspg19:HEAD [20:07:56] running misc test module-test_slru ...
uruspg19:HEAD [20:07:59] running misc test module-worker_spi ...
uruspg19:HEAD [20:08:05] running misc test module-xid_wraparound ...
uruspg19:HEAD [20:08:06] running misc test module-libpq ...
uruspg19:HEAD [20:08:25] running misc test module-pg_bsd_indent ...
uruspg19:HEAD [20:08:29] running contrib test amcheck ...
uruspg19:HEAD [20:09:09] running contrib test auto_explain ...
uruspg19:HEAD [20:09:16] running contrib test basebackup_to_shell ...
uruspg19:HEAD [20:09:23] running contrib test bloom ...
uruspg19:HEAD [20:09:48] running contrib test oid2name ...
uruspg19:HEAD [20:09:49] running contrib test pg_stat_statements ...
uruspg19:HEAD [20:10:03] running contrib test postgres_fdw ...
Use of uninitialized value $ENV{"PG_TEST_EXTRA"} in pattern match (m//) at ./run_build.pl line 2510.
uruspg19:HEAD [20:10:24] running contrib test test_decoding ...
uruspg19:HEAD [20:10:47] running contrib test vacuumlo ...
uruspg19:HEAD [20:10:48] setting up db cluster (C)...
uruspg19:HEAD [20:10:50] starting db (C)...
uruspg19:HEAD [20:10:50] running installcheck (C)...
uruspg19:HEAD [20:19:31] restarting db (C)...
uruspg19:HEAD [20:19:34] running make isolation check ...
uruspg19:HEAD [20:22:11] restarting db (C)...
uruspg19:HEAD [20:22:18] running make PL installcheck (C)...
uruspg19:HEAD [20:22:24] restarting db (C)...
uruspg19:HEAD [20:22:26] running make contrib installcheck (C)...
uruspg19:HEAD [20:30:42] restarting db (C)...
uruspg19:HEAD [20:30:47] running make test-modules installcheck (C)...
uruspg19:HEAD [20:36:44] stopping db (C)...
uruspg19:HEAD [20:36:46] running make ecpg check ...
uruspg19:HEAD [20:37:19] OK
Branch: HEAD
All stages succeeded
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-18 06:21 Vamshikrishna T <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Vamshikrishna T @ 2025-09-18 06:21 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
This patch marked 10/10 with all CI checks passing. Your feedback on the patch would be greatly appreciated.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-20 15:20 Alvaro Herrera <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Alvaro Herrera @ 2025-09-20 15:20 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; pgsql-hackers; Robert Haas <[email protected]>; Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; Laurenz Albe <[email protected]>; Noah Misch <[email protected]>; Michael Paquier <[email protected]>; Andres Freund <[email protected]>; Thomas Munro <[email protected]>; [email protected] <[email protected]>; Tom Lane <[email protected]>; Tristan Partin <[email protected]>; wenhui qiu <[email protected]>; [email protected] <[email protected]>
On 2025-Sep-03, Srirama Kucherlapati wrote:
> As part of our ongoing efforts to enhance AIX platform compatibility,
> we’ve been running the code across all stable PostgreSQL release
> branches using the build farm infrastructure. All test suites,
> including TAP tests, are passing consistently, indicating no
> regressions.
The buildfarm results you sent look good. You should definitely be
testing branch master though rather than the stable ones, because it's
not clear to me, as Bruce said, that we would really backpatch AIX
support to stable branches. (You're of course free to produce your own
packages from patched versions, in the interim).
I noticed that you add mkldexport.sh and that the makefiles use it. I
wonder if that really is necessary with the current AIX tooling (it
looks an outdated gadget).
Also, I notice that Meson supports AIX starting from version 0.56; did
you verify whether it works to build this with that?
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-22 11:09 AIX PG user <[email protected]>
parent: Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: AIX PG user @ 2025-09-22 11:09 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Alvaro,
Thank you for taking your time to look into the details.
I’ve submitted the latest changes to the master branch, which are now available in the annotations section here:
https://commitfest.postgresql.org/patch/6050/
I kindly request you to review this updated patch and share your valuable feedback.
Regarding your observation about the inclusion of mkldexport.sh and its usage in the makefiles — as previously
discussed, this is a necessary workaround due to current limitations on AIX. To build shared libraries, we need to
extract symbols using this script. The relevant details are as follows:
Script Location: src/backend/port/aix/mkldexport.sh
Purpose: Implements AIX-specific changes for shared library creation using export files.
Background: Based on discussions with the internal linker team, this method is currently required to extract symbols and build shared libraries.
Reference Practices: This approach is consistent with methods used in other open-source projects such as Python and OpenBLAS:
Python
https://github.com/python/cpython/blob/main/Modules/ld_so_aix.in
OpenBLAS
https://github.com/OpenMathLib/OpenBLAS/commit/892f8ff3e55e24fda9af3f6364319cce3f60116b#diff-4011a11...
As for Meson builds, we did explore them earlier but encountered some issues. Here are some issues/fixes we submitted to the meson community
https://github.com/mesonbuild/meson/issues/14334
For now, we would like to focus initially on the regular gmake build since our buildfarms predominantly use it. That said, we do plan to submit Meson-related changes as a separate patch in the future.
Looking forward to your feedback.
-Sriram
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-22 12:27 Andres Freund <[email protected]>
parent: AIX PG user <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Andres Freund @ 2025-09-22 12:27 UTC (permalink / raw)
To: AIX PG user <[email protected]>; +Cc: [email protected]
Hi,
On 2025-09-22 11:09:53 +0000, AIX PG user wrote:
> As for Meson builds, we did explore them earlier but encountered some
> issues. Here are some issues/fixes we submitted to the meson community
> https://github.com/mesonbuild/meson/issues/14334 For now, we would like to
> focus initially on the regular gmake build since our buildfarms
> predominantly use it. That said, we do plan to submit Meson-related changes
> as a separate patch in the future.
I think we should do the opposite if anything. We're planning to eventually
remove make based builds.
But I'm also suprprised - before the removal meson based builds on AIX were
working. Why didn't you just revive it as it was?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-23 14:26 AIX PG user <[email protected]>
parent: Andres Freund <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: AIX PG user @ 2025-09-23 14:26 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Andres,
Thank you for your feedback and for highlighting the importance of Meson-based builds.
We fully recognize the long-term objective of transitioning away from
make-based builds, and we are actively working on reviving Meson support for
AIX in alignment with that direction. However, we are currently encountering a
few errors with the revived changes, and we are working actively to
resolve them. I will keep you updated and share the finalized Meson-related
changes at the earliest opportunity.
In the meantime, we would sincerely appreciate it if you/team could review the patch
with respect to the gmake build and the associated source-level modifications
submitted on commitfest.
https://commitfest.postgresql.org/patch/6050/
Your input would be invaluable in helping us ensure the correctness and
completeness of the implementation before we proceed further. Thank you once
again for your continued guidance and support.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-09-23 14:36 Andres Freund <[email protected]>
parent: AIX PG user <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Andres Freund @ 2025-09-23 14:36 UTC (permalink / raw)
To: AIX PG user <[email protected]>; +Cc: [email protected]
Hi,
On 2025-09-23 14:26:08 +0000, AIX PG user wrote:
> Thank you for your feedback and for highlighting the importance of Meson-based builds.
>
> We fully recognize the long-term objective of transitioning away from
> make-based builds, and we are actively working on reviving Meson support for
> AIX in alignment with that direction. However, we are currently encountering a
> few errors with the revived changes, and we are working actively to
> resolve them. I will keep you updated and share the finalized Meson-related
> changes at the earliest opportunity.
It worked without meson changes just before the AIX support was dropped. I do
not see why you *need* that meson patch, rather it just being convenient -
after all I had made it work before, without that.
> In the meantime, we would sincerely appreciate it if you/team could review the patch
> with respect to the gmake build and the associated source-level modifications
> submitted on commitfest.
I'd personally just not add gmake support at all, but ...
> https://commitfest.postgresql.org/patch/6050/
>
> Your input would be invaluable in helping us ensure the correctness and
> completeness of the implementation before we proceed further. Thank you once
> again for your continued guidance and support.
One suggestion I do have is to split the patch into a few constitutent pieces.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-09-23 15:28 Srirama Kucherlapati <[email protected]>
parent: Andres Freund <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-09-23 15:28 UTC (permalink / raw)
To: Andres Freund <[email protected]>; AIX PG user <[email protected]>; +Cc: [email protected] <[email protected]>
Hi Andres,
> It worked without meson changes just before the AIX support was dropped. I do
> not see why you *need* that meson patch, rather it just being convenient -
> after all I had made it work before, without that.
I was able to build successfully using Meson on PostgreSQL 16. However, when attempting the same on the latest master(with the revived changes), I encountered a few errors. We are currently investigating these issues and working on the necessary fixes.
I’ll keep you updated once the Meson-related fixes are ready.
> One suggestion I do have is to split the patch into a few constitutent pieces.
Thank you for the suggestion.
Splitting the patch into smaller, constituent pieces makes sense and would certainly help with clarity and review.
Appreciate your guidance.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-10-15 15:58 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-10-15 15:58 UTC (permalink / raw)
To: Andres Freund <[email protected]>; AIX PG user <[email protected]>; +Cc: [email protected] <[email protected]>
Hi Andres and team,
Please find attached the patch addressing Meson build changes for AIX.
We tried to build using below meson
## meson -v
1.6.1
For the following files, the shared_module() function requires specifying the
appropriate symbol import file, which is provided via the aix_link_args
variable:
src/backend/jit/llvm/meson.build
src/backend/replication/libpqwalreceiver/meson.build
src/backend/replication/pgoutput/meson.build
src/backend/snowball/meson.build
src/backend/utils/mb/conversion_procs/meson.build
Additionally, with the latest version of Meson, when building static libraries,
the library file name must be suffixed with “_static” in the following files:
src/interfaces/ecpg/compatlib/meson.build
src/interfaces/ecpg/ecpglib/meson.build
src/interfaces/ecpg/pgtypeslib/meson.build
src/interfaces/libpq/meson.build
Main AIX changes patch - 0001-Changes-to-add-support-for-AIX.v9.pg19.patch (previously submitted one)
Meson AIX changes patch - 0001-AIX-changes-for-meson-build.patch
Looking forward to hearing your thoughts on these changes.
Your feedback on these updates is highly valued.
Thanks,
Sriram.
Attachments:
[application/octet-stream] 0001-AIX-changes-for-meson-build.v9.pg19.patch (12.9K, 3-0001-AIX-changes-for-meson-build.v9.pg19.patch)
download | inline diff:
From 18dd09463342bbc836c7a8dda3a3864ceb083176 Mon Sep 17 00:00:00 2001
From: AIX-dev <[email protected]>
Date: Wed, 15 Oct 2025 09:33:07 -0500
Subject: [PATCH] AIX changes for meson build.
---
meson.build | 25 +++++++++++--
src/backend/jit/llvm/meson.build | 6 ++++
src/backend/meson.build | 36 ++++++++++++++++++-
.../replication/libpqwalreceiver/meson.build | 8 ++++-
src/backend/replication/pgoutput/meson.build | 6 ++++
src/backend/snowball/meson.build | 8 ++++-
.../utils/mb/conversion_procs/meson.build | 6 ++++
src/include/port/aix.h | 22 ++++++++++++
src/interfaces/ecpg/compatlib/meson.build | 8 ++++-
src/interfaces/ecpg/ecpglib/meson.build | 7 +++-
src/interfaces/ecpg/pgtypeslib/meson.build | 7 +++-
src/interfaces/libpq/meson.build | 14 ++++++--
src/tools/gen_export.pl | 13 +++++--
13 files changed, 154 insertions(+), 12 deletions(-)
diff --git a/meson.build b/meson.build
index a87eb913fff..27c0f38ebc8 100644
--- a/meson.build
+++ b/meson.build
@@ -198,7 +198,26 @@ endif
# that purpose.
portname = host_system
-if host_system == 'cygwin'
+if host_system == 'aix'
+ library_path_var = 'LIBPATH'
+
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # Native memset() is faster, tested on:
+ # - AIX 5.1 and 5.2, XLC 6.0 (IBM's cc)
+ # - AIX 5.3 ML3, gcc 4.0.1
+ #memset_loop_limit = 0
+
+elif host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
dlsuffix = '.dll'
@@ -1775,7 +1794,9 @@ endforeach
# would be too much of a penalty for disk and memory space.
alignof_double = cdata.get('ALIGNOF_DOUBLE')
if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
+ if host_system != 'aix'
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
endif
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index 805fbd69006..f83db9d0d6e 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -29,11 +29,17 @@ if host_system == 'windows'
'--FILEDESC', 'llvmjit - JIT using LLVM',])
endif
+aix_link_args= []
+if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + meson.project_build_root() + '/src/backend/postgres.imp']
+endif
+
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
'dependencies': pg_mod_args['dependencies'] + [llvm],
'cpp_args': pg_mod_args['cpp_args'] + llvm.get_variable(configtool: 'cxxflags').split(),
+ link_args: aix_link_args
}
)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..47c0eae1309 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,40 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+find_obj_files = find_program('sh', required: true)
+
+cb_o = custom_target(
+ 'SUBSYS.o',
+ input: [postgres_lib.extract_all_objects(recursive: true)],
+ output: 'SUBSYS.o',
+ command: ['ld', '-r', '-o', '@OUTPUT@', '@INPUT@'],
+ install: false,
+ )
+postgres_imp = 'postgres.imp'
+
+generate_import_file = custom_target('generate_import_file', output: postgres_imp, command: ['sh', '-c', '../src/backend/port/aix/mkldexport.sh src/backend/SUBSYS.o . > src/backend/postgres.imp'], build_by_default: true, depends: [cb_o])
+
+my_dep = declare_dependency(sources:[generate_import_file])
+#libpq_aix_deps += my_dep
+backend_link_depends += generate_import_file
+
+endif
+
+if host_system == 'aix'
+ postgres = executable('postgres',
+ backend_input,
+ sources: post_export_backend_sources,
+ objects: backend_objs,
+ link_args: backend_link_args + ['-Wl,-bE:src/backend/postgres.imp'],
+ link_with: backend_link_with,
+ link_depends: backend_link_depends,
+ export_dynamic: true,
+ implib: 'postgres',
+ dependencies: backend_build_deps + [my_dep],
+ kwargs: default_bin_args,
+)
+else
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
@@ -137,7 +171,7 @@ postgres = executable('postgres',
dependencies: backend_build_deps,
kwargs: default_bin_args,
)
-
+endif
backend_targets += postgres
pg_mod_c_args = cflags_mod
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 2150f31cfa3..135062244d4 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -10,12 +10,18 @@ if host_system == 'windows'
'--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',])
endif
+aix_link_args= []
+if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + meson.project_build_root() + '/src/backend/postgres.imp']
+endif
+
libpqwalreceiver = shared_module('pqwalreceiver',
libpqwalreceiver_sources,
kwargs: pg_mod_args + {
'name_prefix': 'lib',
'dependencies': pg_mod_args['dependencies'] + [libpq],
- }
+ },
+ link_args: aix_link_args
)
backend_targets += libpqwalreceiver
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
index 14e2f03ada0..9fbd035988b 100644
--- a/src/backend/replication/pgoutput/meson.build
+++ b/src/backend/replication/pgoutput/meson.build
@@ -10,9 +10,15 @@ if host_system == 'windows'
'--FILEDESC', 'pgoutput - standard logical replication output plugin',])
endif
+aix_link_args= []
+if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + meson.project_build_root() + '/src/backend/postgres.imp']
+endif
+
pgoutput = shared_module('pgoutput',
pgoutput_sources,
kwargs: pg_mod_args,
+ link_args: aix_link_args
)
backend_targets += pgoutput
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8e73d9d7368..92b3934bcc6 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -66,12 +66,18 @@ if host_system == 'windows'
'--FILEDESC', 'snowball - natural language stemmers',])
endif
+aix_link_args= []
+if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + meson.project_build_root() + '/src/backend/postgres.imp']
+endif
+
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
- }
+ },
+ link_args: aix_link_args
)
snowball_create = custom_target('snowball_create',
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
index 0e8273e0b61..a76c4993055 100644
--- a/src/backend/utils/mb/conversion_procs/meson.build
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -38,8 +38,14 @@ foreach encoding, sources : encodings
'--NAME', encoding])
endif
+ aix_link_args= []
+ if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + meson.project_build_root() + '/src/backend/postgres.imp']
+ endif
+
backend_targets += shared_module(encoding,
source_files,
kwargs: pg_mod_args,
+ link_args: aix_link_args
)
endforeach
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
index 7d08480c8c0..450e68da657 100644
--- a/src/include/port/aix.h
+++ b/src/include/port/aix.h
@@ -2,3 +2,25 @@
* src/include/port/aix.h
*/
+/* These changes are required for the meson changes as the autoconf is not run
+ * and corresponding key feature macros are defined here.
+ */
+
+#ifdef _AIX
+#ifndef PGDLLIMPORT
+#define PGDLLIMPORT
+#endif /* PGDLLIMPORT */
+typedef float float4;
+typedef double float8;
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#define pg_noreturn _Noreturn
+#elif defined(__GNUC__)
+#define pg_noreturn __attribute__((noreturn))
+#else
+#define pg_noreturn
+#endif
+
+#include <stdbool.h>
+
+#endif /*_AIX */
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..d199002f7ed 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -15,8 +15,14 @@ if host_system == 'windows'
'--FILEDESC', 'ECPG compat - compatibility library for ECPG',])
endif
+libname = 'libecpg_compat'
+if host_machine.system() == 'aix'
+ libname += '_static'
+endif
+
+
# see src/interfaces/libpq/meson.build
-ecpg_compat_st = static_library('libecpg_compat',
+ecpg_compat_st = static_library(libname,
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..448a0038a71 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -24,8 +24,13 @@ if host_system == 'windows'
'--FILEDESC', 'ECPG - embedded SQL in C',])
endif
+libname = 'libecpg'
+if host_machine.system() == 'aix'
+ libname += '_static'
+endif
+
# see src/interfaces/libpq/meson.build
-ecpglib_st = static_library('libecpg',
+ecpglib_st = static_library(libname,
ecpglib_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..6421930dc05 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -20,8 +20,13 @@ if host_system == 'windows'
'--FILEDESC', 'pgtypes - library for data type mapping',])
endif
+libname = 'libpgtypes'
+if host_machine.system() == 'aix'
+ libname += '_static'
+endif
+
# see src/interfaces/libpq/meson.build
-ecpg_pgtypes_st = static_library('libpgtypes',
+ecpg_pgtypes_st = static_library(libname,
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..3e96d3f073e 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,6 +49,11 @@ libpq_c_args = ['-DSO_MAJOR_VERSION=5']
# The OAuth implementation differs depending on the type of library being built.
libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
+libname = 'libpq'
+if host_machine.system() == 'aix'
+ libname += '_static'
+endif
+
# Not using both_libraries() here as
# 1) resource files should only be in the shared library
# 2) we want the .pc file to include a dependency to {pgport,common}_static for
@@ -57,7 +62,7 @@ libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
# We could try to avoid building the source files twice, but it probably adds
# more complexity than its worth (reusing object files requires also linking
# to the library on windows or breaks precompiled headers).
-libpq_st = static_library('libpq',
+libpq_st = static_library(libname,
libpq_sources,
include_directories: [libpq_inc],
c_args: libpq_c_args,
@@ -66,6 +71,11 @@ libpq_st = static_library('libpq',
kwargs: default_lib_args,
)
+aix_link_args = []
+if host_machine.system() == 'aix'
+ aix_link_args = ['-Wl,-bI:' + export_file.full_path()]
+endif
+
libpq_so = shared_library('libpq',
libpq_sources + libpq_so_sources,
include_directories: [libpq_inc, postgres_inc],
@@ -76,7 +86,7 @@ libpq_so = shared_library('libpq',
darwin_versions: ['5', '5.' + pg_version_major.to_string()],
dependencies: [frontend_shlib_code, libpq_deps],
link_depends: export_file,
- link_args: export_fmt.format(export_file.full_path()),
+ link_args: [export_fmt.format(export_file.full_path()), aix_link_args],
kwargs: default_lib_args,
)
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index 86a7742b369..19c8b60560f 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -18,9 +18,10 @@ GetOptions(
if (not( $format eq 'darwin'
or $format eq 'gnu'
- or $format eq 'win'))
+ or $format eq 'win'
+ or $format eq 'aix'))
{
- die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
+ die "$0: $format is not yet handled (only darwin, gnu, win, aix are)\n";
}
open(my $input_handle, '<', $input)
@@ -46,6 +47,10 @@ elsif ($format eq 'win')
}
print $output_handle "EXPORTS\n";
}
+elsif ($format eq 'aix')
+{
+ print $output_handle "#!\n";
+}
while (<$input_handle>)
{
@@ -63,6 +68,10 @@ while (<$input_handle>)
{
print $output_handle " $1;\n";
}
+ elsif ($format eq 'aix')
+ {
+ print $output_handle "$1\n";
+ }
elsif ($format eq 'win')
{
print $output_handle "$1 @ $2\n";
--
2.41.0
[application/octet-stream] 0001-Changes-to-add-support-for-AIX.v9.pg19.patch (15.7K, 4-0001-Changes-to-add-support-for-AIX.v9.pg19.patch)
download | inline diff:
From 407b42b1fbe562dff69820f7456dbb32a8a37d79 Mon Sep 17 00:00:00 2001
From: AIX-dev <[email protected]>
Date: Tue, 16 Sep 2025 08:59:22 -0500
Subject: [PATCH] Changes to add support for AIX.
---
Makefile | 2 -
configure | 37 +++++++++++++++---
configure.ac | 29 +++++++++++++-
src/Makefile.shlib | 29 ++++++++++++++
src/backend/Makefile | 20 ++++++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 4 ++
src/include/storage/s_lock.h | 48 +++--------------------
src/makefiles/Makefile.aix | 34 +++++++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 7 ++++
12 files changed, 223 insertions(+), 52 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 507a2437c33..67cad0f5581 100755
--- a/configure
+++ b/configure
@@ -3022,6 +3022,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -17204,13 +17205,37 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+echo "Checking for MAX ALIGN - $PORTNAME"
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $ac_cv_alignof_long_long_int -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ echo "MAX ALIGN ac_cv_alignof_long"
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ echo "MAX ALIGN ac_cv_alignof_double"
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ echo "MAX ALIGN ac_cv_alignof_int64_t"
+ fi
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index 5f4548adc5c..a25aedacef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -2021,7 +2022,33 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 3825af5b228..35adc4174ed 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index b7b9692f8c8..d0c4b7ba3ac 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -905,7 +905,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..7d08480c8c0
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,4 @@
+/*
+ * src/include/port/aix.h
+ */
+
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..ba120c08d14 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -398,56 +398,18 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
-/* On PPC, it's a win to use a non-locking test before the lwarx */
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
-/*
- * The second operand of addi can hold a constant zero or a register number,
- * hence constraint "=&b" to avoid allocating r0. "b" stands for "address
- * base register"; most operands having this register-or-zero property are
- * address bases, e.g. the second operand of lwax.
- *
- * 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.
- * But if the spinlock is in ordinary memory, we can use lwsync instead for
- * better performance.
- */
static __inline__ int
tas(volatile slock_t *lock)
{
- slock_t _t;
- int _res;
-
- __asm__ __volatile__(
-" lwarx %0,0,%3,1 \n"
-" cmpwi %0,0 \n"
-" bne 1f \n"
-" addi %0,%0,1 \n"
-" stwcx. %0,0,%3 \n"
-" beq 2f \n"
-"1: \n"
-" li %1,1 \n"
-" b 3f \n"
-"2: \n"
-" lwsync \n"
-" li %1,0 \n"
-"3: \n"
-: "=&b"(_t), "=r"(_res), "+m"(*lock)
-: "r"(lock)
-: "memory", "cc");
- return _res;
+ return __sync_lock_test_and_set(lock, 1);
}
-/*
- * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
- * But we can use lwsync instead for better performance.
- */
-#define S_UNLOCK(lock) \
-do \
-{ \
- __asm__ __volatile__ (" lwsync \n" ::: "memory"); \
- *((volatile slock_t *) (lock)) = 0; \
-} while (0)
+#define S_UNLOCK(lock) __sync_lock_release(lock)
#endif /* powerpc */
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..4c4de8b0be7
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,34 @@
+# -blibpath:
+# The path to be inserted into the default path (Index 0 path) field of the
+# loader section. When this flag is presented, the -L paths will not be stored.
+# AIX uses a stricter, more explicit approach. The runtime linker expects to
+# tell it exactly where to look using -blibpath.
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..bfc193348f4
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,7 @@
+# This file is referred for specific flags wrt to AIX build process like
+# cflags.
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+# With optimization, the MemSet() and MemSetAlign() perform better.
+CFLAGS_SL=" -O2 "
--
2.41.0
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-10-15 18:15 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2025-10-15 18:15 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; Andres Freund <[email protected]>; AIX PG user <[email protected]>; +Cc: [email protected] <[email protected]>
On 15.10.25 17:58, Srirama Kucherlapati wrote:
> Main AIX changes patch - 0001-Changes-to-add-support-for-
> AIX.v9.pg19.patch (previously submitted one)
>
> Meson AIX changes patch - 0001-AIX-changes-for-meson-build.patch
>
> Looking forward to hearing your thoughts on these changes.
>
> Your feedback on these updates is highly valued.
The largest problem I see in this patch set is that you are making
unexplained changes in src/include/storage/s_lock.h. The code that you
are changing does not only affect AIX but also PPC with other operating
systems. AFAICT, the change you are proposing does not correspond to
the commit that removed AIX support.
Maybe the proposed changes are beneficial for other operating systems as
well. But in that case, propose this as a separate patch in a separate
thread, with supporting information (and probably benchmarks in this case).
If not, then you need to find a way to make this work on AIX without
materially changing the code that exists for already-supported operating
systems.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-10-16 15:28 AIX PG user <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: AIX PG user @ 2025-10-16 15:28 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Peter,
Thank you for your comments.
We’ve had a few discussions in the past regarding the changes related to the
spin lock. Some of those conversations stemmed from this thread:
"https://www.postgresql.org/message-id/95a44be0-b2f8-464a-8984-771d892b1cac%40iki.fi";
The earlier assembly code was generic across the PPC platform. However, based
on previous discussions, we transitioned to using GCC-specific routines to
enhance platform independence and maintain generality.
These are the comments I have added, let me know if you need more info here.
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
For reference, here are some benchmark statistics we gathered earlier:
"https://www.postgresql.org/message-id/CY8PR15MB5602EB54EFE30D4C21F061BEDB722%40CY8PR15MB5602.namprd1...;
I'll run some more benchmarking on this sync_lock and submit the results.
Meanwhile, it would be helpful if you and your team could take a look at the remaining changes.
Thank you,
Sriram.
The new status of this patch is: Needs review
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-10-22 03:52 AIX PG user <[email protected]>
parent: AIX PG user <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: AIX PG user @ 2025-10-22 03:52 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Team,
We look forward to your comments and kindly request you to share your feedback on the proposed changes(in the annotations).
Your input is greatly appreciated and will help us refine the solution while ensuring all aspects are thoughtfully addressed.
Thank you in advance for your time and support.
-Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-10-31 17:33 Heikki Linnakangas <[email protected]>
parent: AIX PG user <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Heikki Linnakangas @ 2025-10-31 17:33 UTC (permalink / raw)
To: AIX PG user <[email protected]>; [email protected]
On 16/10/2025 18:28, AIX PG user wrote:
> diff --git a/src/template/aix b/src/template/aix
> new file mode 100644
> index 00000000000..bfc193348f4
> --- /dev/null
> +++ b/src/template/aix
> @@ -0,0 +1,7 @@
> +# This file is referred for specific flags wrt to AIX build process like
> +# cflags.
> +# src/template/aix
> +
> +# Extra CFLAGS for code that will go into a shared library
> +# With optimization, the MemSet() and MemSetAlign() perform better.
> +CFLAGS_SL=" -O2 "
> --
This looks weird. Sure, "-O2" makes things faster, but we shouldn't
force that here. If you want optimizations, you should use pass
CFLAGS="-O2" or CFLAGS="-O3" to configure. And why the special mention
of MemSet() and MemSetAlign()?
> @@ -95,6 +97,24 @@ libpostgres.a: postgres
>
> endif # win32
>
> +ifeq ($(PORTNAME), aix)
> +
> +postgres: $(POSTGRES_IMP)
> + $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
> +
> +# Linking to a single .o with -r is a lot faster than building a .a or passing
> +# all objects to MKLDEXPORT.
> +#
> +# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
> +# trivially work with gcc, due to gcc specific static libraries linked in with
> +# -r.
> +$(POSTGRES_IMP): $(OBJS)
> + ld -r -o SUBSYS.o $(call expand_subsys,$^)
> + $(MKLDEXPORT) SUBSYS.o . > $@
> + @rm -f SUBSYS.o
> +
> +endif # aix
> +
> $(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
I see there's some references to MAKE_EXPORTS in src/backend/Makefile.
They seem related to MKLDEXPORT, but we never set MAKE_EXPORTS. Are they
still needed?
- Heikki
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-11-03 14:46 AIX PG user <[email protected]>
parent: Heikki Linnakangas <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: AIX PG user @ 2025-11-03 14:46 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Heikki,
Thank you for your feedback.
> This looks weird. Sure, "-O2" makes things faster, but we shouldn't
> force that here. If you want optimizations, you should use pass
> CFLAGS="-O2" or CFLAGS="-O3" to configure. And why the special mention
> of MemSet() and MemSetAlign()?
I have removed these.
> I see there's some references to MAKE_EXPORTS in src/backend/Makefile.
> They seem related to MKLDEXPORT, but we never set MAKE_EXPORTS. Are they
> still needed?
If MAKE_EXPORTS is not being used by any platforms other than AIX, we can
consider removing it. However, I’m not entirely certain whether it might still
be required elsewhere. Since these changes appear to be general and not
strictly AIX-specific, would it be fine to submit them as a separate
patch?
Looking forward to your continued support and guidance.
- Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-11-07 16:28 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2025-11-07 16:28 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; Andres Freund <[email protected]>; AIX PG user <[email protected]>; +Cc: [email protected] <[email protected]>
On 15.10.25 17:58, Srirama Kucherlapati wrote:
> Hi Andres and team,
>
> Please find attached the patch addressing Meson build changes for AIX.
>
> We tried to build using below meson
>
> ## meson -v
>
> 1.6.1
>
> For the following files, the shared_module() function requires
> specifying the
>
> appropriate symbol import file, which is provided via the aix_link_args
>
> variable:
>
> src/backend/jit/llvm/meson.build
>
> src/backend/replication/libpqwalreceiver/meson.build
>
> src/backend/replication/pgoutput/meson.build
>
> src/backend/snowball/meson.build
>
> src/backend/utils/mb/conversion_procs/meson.build
>
> Additionally, with the latest version of Meson, when building static
> libraries,
>
> the library file name must be suffixed with “_static” in the following
> files:
>
> src/interfaces/ecpg/compatlib/meson.build
>
> src/interfaces/ecpg/ecpglib/meson.build
>
> src/interfaces/ecpg/pgtypeslib/meson.build
>
> src/interfaces/libpq/meson.build
It is not going to be acceptable to sprinkle this much AIX-specific code
around. Those changes to the meson.build files were not needed before
AIX support was removed. You should find a way to do it without these
changes.
The changes in src/include/port/aix.h in your patch don't make sense.
This indicates that you are doing something wrong in your local builds.
Please fix that.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-11-10 17:00 AIX PG user <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: AIX PG user @ 2025-11-10 17:00 UTC (permalink / raw)
To: [email protected]; +Cc: AIX PG user <[email protected]>
Hi Peter,
>> Those changes to the meson.build files were not needed before
>> AIX support was removed. You should find a way to do it without these
>> changes.
The change was necessary to ensure that the import file used during the static
PostgreSQL library build begins with the required #! directive and includes the
correct symbol references from the object files. This structure is essential
for compatibility with AIX's linking behaviour, which relies on explicitly
defined symbol import files during static linking. Without this adjustment, the
build process may fail or result in incomplete symbol resolution, particularly
on AIX systems. By aligning the import file format and symbol inclusion with
platform-specific requirements.
We referred to previously removed code that handled similar logic and found it
to be effective. Based on this, we plan to revert the changes in the affected
files and proceed with a more robust solution.
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=0b16bb8776bb834eb1ef8204ca95dd766...
src/backend/jit/llvm/meson.build
src/backend/replication/libpqwalreceiver/meson.build
src/backend/replication/pgoutput/meson.build
src/backend/snowball/meson.build
src/backend/utils/mb/conversion_procs/meson.build
Regarding the archiving of shared and static libraries, the latest version of
Meson raises a conflict as both targets have the same name. This issue
arises because, on AIX, both shared and static libraries are named as same
archive, which leads to naming collisions during the build process. We
would still need the below changes.
src/interfaces/ecpg/compatlib/meson.build
src/interfaces/ecpg/ecpglib/meson.build
ecpglib_st = static_library(libname,
src/interfaces/ecpg/pgtypeslib/meson.build
ecpg_pgtypes_st = static_library(libname,
src/interfaces/libpq/meson.build
libpq_st = static_library(libname
>> The changes in src/include/port/aix.h in your patch don't make sense.
>> This indicates that you are doing something wrong in your local builds.
>> Please fix that.
We had to do these changes in the src/include/c.h,
As the MACROS, are getting undefined by the below sys header files.
We made changes to src/include/c.h because certain macros were being
undefined by the system header files listed below. To address this issue,
we introduced updates in aix.h.
+#ifndef PGDLLIMPORT +#define PGDLLIMPORT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
We are continuing to analyze the impact of these changes and will refine
the solution as needed. Once finalized, we will submit the updated changes accordingly.
-Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-12-09 16:50 Srirama Kucherlapati <[email protected]>
parent: AIX PG user <[email protected]>
0 siblings, 3 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-12-09 16:50 UTC (permalink / raw)
To: AIX PG user <[email protected]>; [email protected] <[email protected]>; Peter Eisentraut <[email protected]>; Heikki Linnakangas <[email protected]>
Hi Team, (Peter/Heikki)
I have implemented the requested modifications in the latest patch. Below are the key technical updates:
• Meson Build Configuration: Adjusted below meson.build scripts to incorporate the suggested changes, ensuring proper dependency resolution and improved build consistency.
Removed the AIX changes in the below from the previous patch.
src/backend/jit/llvm/meson.build
src/backend/replication/libpqwalreceiver/meson.build
src/backend/replication/pgoutput/meson.build
src/backend/snowball/meson.build
src/backend/utils/mb/conversion_procs/meson.build
Added the static_library() changes.
> Regarding the archiving of shared and static libraries, the latest version of
> Meson raises a conflict as both targets have the same name. This issue
> arises because, on AIX, both shared and static libraries are named as same
> archive, which leads to naming collisions during the build process. We
> would still need the below changes.
src/interfaces/ecpg/compatlib/meson.build
src/interfaces/ecpg/ecpglib/meson.build
src/interfaces/ecpg/pgtypeslib/meson.build
src/interfaces/libpq/meson.build
• CFLAGS Optimization Removal: Removed high-level optimization flags from CFLAGS to prevent unpredictable behaviour and maintain stability during compilation.
I would greatly appreciate it if you could review the patch and share your feedback or any additional recommendations.
Apologies for the delayed response; I was occupied with other tasks.
Your insights are greatly appreciated and will help enhance the patch.
Warm regards,
-Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX.pg19.v10.patch (22.5K, 3-0001-Support-for-AIX.pg19.v10.patch)
download | inline diff:
From 98af27c6331c4fe161f7cab5c16768587f7fcb9a Mon Sep 17 00:00:00 2001
From: AIX-dev <[email protected]>
Date: Tue, 9 Dec 2025 09:49:31 -0600
Subject: [PATCH] Support for AIX.
---
Makefile | 2 -
configure | 37 ++++++++++---
configure.ac | 29 +++++++++-
meson.build | 27 ++++++++--
src/Makefile.shlib | 29 ++++++++++
src/backend/Makefile | 20 +++++++
src/backend/meson.build | 18 +++++++
src/backend/port/aix/mkldexport.sh | 61 ++++++++++++++++++++++
src/backend/utils/error/elog.c | 2 +
src/include/port/aix.h | 26 +++++++++
src/include/storage/s_lock.h | 52 +++---------------
src/interfaces/ecpg/compatlib/meson.build | 2 +-
src/interfaces/ecpg/ecpglib/meson.build | 2 +-
src/interfaces/ecpg/pgtypeslib/meson.build | 2 +-
src/interfaces/libpq/meson.build | 2 +-
src/makefiles/Makefile.aix | 34 ++++++++++++
src/port/strerror.c | 2 +
src/template/aix | 6 +++
src/tools/gen_export.pl | 11 +++-
19 files changed, 300 insertions(+), 64 deletions(-)
create mode 100755 src/backend/port/aix/mkldexport.sh
create mode 100644 src/include/port/aix.h
create mode 100644 src/makefiles/Makefile.aix
create mode 100644 src/template/aix
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 3a0ed11fa8e..c4749a8e5b6 100755
--- a/configure
+++ b/configure
@@ -3020,6 +3020,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -17006,13 +17007,37 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+echo "Checking for MAX ALIGN - $PORTNAME"
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $ac_cv_alignof_long_long_int -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ echo "MAX ALIGN ac_cv_alignof_long"
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ echo "MAX ALIGN ac_cv_alignof_double"
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ echo "MAX ALIGN ac_cv_alignof_int64_t"
+ fi
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index c2413720a18..7f1530df2b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -2006,7 +2007,33 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
diff --git a/meson.build b/meson.build
index 6e7ddd74683..304a9184075 100644
--- a/meson.build
+++ b/meson.build
@@ -206,6 +206,25 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ cppflags += '-D_GNU_SOURCE'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # Native memset() is faster, tested on:
+ memset_loop_limit = 0
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1766,9 +1785,9 @@ endforeach
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+#if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+# error('alignment of int64_t is greater than the alignment of double')
+#endif
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -1820,7 +1839,7 @@ if cc.links('''
if not meson.is_cross_build()
r = cc.run('''
/* This must match the corresponding code in c.h: */
- #if defined(__GNUC__)
+ #if defined(__GNUC__) || defined(__IBMC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
#elif defined(_MSC_VER)
#define pg_attribute_aligned(a) __declspec(align(a))
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 3825af5b228..35adc4174ed 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 29643c51439..1c933b5afad 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -914,7 +914,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..dd7cfb197cd
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,26 @@
+/*
+ * src/include/port/aix.h
+ */
+
+/* This change is required for the meson changes as the autoconf is not run and
+ * to resolve the conflicts in picking the float.h details by default from the
+ * postgres defined datatypes.
+ */
+#ifdef _AIX
+#ifndef PGDLLIMPORT
+#define PGDLLIMPORT
+#endif /* PGDLLIMPORT */
+typedef float float4;
+typedef double float8;
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#define pg_noreturn _Noreturn
+#elif defined(__GNUC__)
+#define pg_noreturn __attribute__((noreturn))
+#else
+#define pg_noreturn
+#endif
+
+#include <stdbool.h>
+
+#endif /*_AIX */
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 7f8f566bd40..1a0cd5ec019 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -398,60 +398,20 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
-/* On PPC, it's a win to use a non-locking test before the lwarx */
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
-/*
- * The second operand of addi can hold a constant zero or a register number,
- * hence constraint "=&b" to avoid allocating r0. "b" stands for "address
- * base register"; most operands having this register-or-zero property are
- * address bases, e.g. the second operand of lwax.
- *
- * 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.
- * But if the spinlock is in ordinary memory, we can use lwsync instead for
- * better performance.
- */
static __inline__ int
tas(volatile slock_t *lock)
{
- slock_t _t;
- int _res;
-
- __asm__ __volatile__(
-" lwarx %0,0,%3,1 \n"
-" cmpwi %0,0 \n"
-" bne 1f \n"
-" addi %0,%0,1 \n"
-" stwcx. %0,0,%3 \n"
-" beq 2f \n"
-"1: \n"
-" li %1,1 \n"
-" b 3f \n"
-"2: \n"
-" lwsync \n"
-" li %1,0 \n"
-"3: \n"
-: "=&b"(_t), "=r"(_res), "+m"(*lock)
-: "r"(lock)
-: "memory", "cc");
- return _res;
+ return __sync_lock_test_and_set(lock, 1);
}
-
-/*
- * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
- * But we can use lwsync instead for better performance.
- */
-#define S_UNLOCK(lock) \
-do \
-{ \
- __asm__ __volatile__ (" lwsync \n" ::: "memory"); \
- *((volatile slock_t *) (lock)) = 0; \
-} while (0)
+#define S_UNLOCK(lock) __sync_lock_release(lock)
#endif /* powerpc */
-
-
+
#if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */
#define HAS_TEST_AND_SET
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..3f39187cdcc 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -16,7 +16,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpg_compat_st = static_library('libecpg_compat',
+ecpg_compat_st = static_library('libecpg_compat_static',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..e9faf290a2b 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -25,7 +25,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpglib_st = static_library('libecpg',
+ecpglib_st = static_library('libecpg_static',
ecpglib_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..94d1d0ad1ef 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -21,7 +21,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpg_pgtypes_st = static_library('libpgtypes',
+ecpg_pgtypes_st = static_library('libpgtypes_static',
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..eea175ad14a 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -57,7 +57,7 @@ libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
# We could try to avoid building the source files twice, but it probably adds
# more complexity than its worth (reusing object files requires also linking
# to the library on windows or breaks precompiled headers).
-libpq_st = static_library('libpq',
+libpq_st = static_library('libpq_static',
libpq_sources,
include_directories: [libpq_inc],
c_args: libpq_c_args,
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..e91b250fd19
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,34 @@
+# -blibpath:
+# The path to be inserted into the default path (Index 0 path) field of the
+# loader section. When this flag is presented, the -L paths will not be stored.
+# AIX uses a stricter, more explicit approach. The runtime linker expects to
+# tell it exactly where to look using -blibpath.
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..22f61093b1b
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,6 @@
+# This file is referred for specific flags wrt to AIX build process like
+# cflags.
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+CFLAGS_SL=" "
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index 86a7742b369..25827c42a68 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -18,7 +18,8 @@ GetOptions(
if (not( $format eq 'darwin'
or $format eq 'gnu'
- or $format eq 'win'))
+ or $format eq 'win'
+ or $format eq 'aix'))
{
die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
}
@@ -46,6 +47,10 @@ elsif ($format eq 'win')
}
print $output_handle "EXPORTS\n";
}
+elsif ($format eq 'aix')
+{
+ print $output_handle "#!\n";
+}
while (<$input_handle>)
{
@@ -63,6 +68,10 @@ while (<$input_handle>)
{
print $output_handle " $1;\n";
}
+ elsif ($format eq 'aix')
+ {
+ print $output_handle "$1\n";
+ }
elsif ($format eq 'win')
{
print $output_handle "$1 @ $2\n";
--
2.41.0
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-12-09 21:00 Heikki Linnakangas <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 0 replies; 73+ messages in thread
From: Heikki Linnakangas @ 2025-12-09 21:00 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; AIX PG user <[email protected]>; [email protected] <[email protected]>; Peter Eisentraut <[email protected]>
On 09/12/2025 18:50, Srirama Kucherlapati wrote:
> @@ -1766,9 +1785,9 @@ endforeach
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +#if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> +# error('alignment of int64_t is greater than the alignment of double')
> +#endif
> cdata.set('MAXIMUM_ALIGNOF', alignof_double)
>
> cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
This is unfinished.
> @@ -1820,7 +1839,7 @@ if cc.links('''
> if not meson.is_cross_build()
> r = cc.run('''
> /* This must match the corresponding code in c.h: */
> - #if defined(__GNUC__)
> + #if defined(__GNUC__) || defined(__IBMC__)
> #define pg_attribute_aligned(a) __attribute__((aligned(a)))
> #elif defined(_MSC_VER)
> #define pg_attribute_aligned(a) __declspec(align(a))
There's a comment right there that it must match the corresponding code
in c.h, but you didn't modify c.h.
> + # Native memset() is faster, tested on:
> + memset_loop_limit = 0
Incomplete sentence: tested on what?
We talked about this before. I'm reluctant to have a special case for
AIX, because I suspect this has little to do with the operating system,
and more with the compiler and the CPU architecture. I could be wrong;
maybe the libc memset() implementation on AIX is superior to that on
linux, for example. I'd love to see thorough performance testing of
MemSetAligned() vs memset() on common combinations of CPUs and libc
implementations. Ideally, we can just replace MemSetAligned() with
memset() everywhere.
If you do such testing, please start a separate thread for that. On this
thread, it will get lost with all the AIX-specific stuff.
> +/* This change is required for the meson changes as the autoconf is not run and
> + * to resolve the conflicts in picking the float.h details by default from the
> + * postgres defined datatypes.
> + */
> +#ifdef _AIX
> +#ifndef PGDLLIMPORT
> +#define PGDLLIMPORT
> +#endif /* PGDLLIMPORT */
> +typedef float float4;
> +typedef double float8;
I don't understand these typedefs. What is the conflict the comment
talks about?
> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
> +#define pg_noreturn _Noreturn
> +#elif defined(__GNUC__)
> +#define pg_noreturn __attribute__((noreturn))
> +#else
> +#define pg_noreturn
> +#endif
Isn't this just duplicating the snippet in c.h?
> +#include <stdbool.h>
This is in c.h too.
> src/include/storage/s_lock.h
> [ switches to __sync_lock_release(lock) on all powerpc systems ]
We talked about this before.
> @@ -18,7 +18,8 @@ GetOptions(
>
> if (not( $format eq 'darwin'
> or $format eq 'gnu'
> - or $format eq 'win'))
> + or $format eq 'win'
> + or $format eq 'aix'))
> {
> die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
> }
Forgot to update the error message.
I didn't review the autoconf / Makefile changes.
> Apologies for the delayed response; I was occupied with other tasks.
Oh no worries, I'm not in any hurry with this. On the contrary to be honest.
- Heikki
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-12-09 21:08 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2025-12-09 21:08 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; AIX PG user <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>
On 09.12.25 17:50, Srirama Kucherlapati wrote:
> Hi Team, (Peter/Heikki)
>
> I have implemented the requested modifications in the latest patch.
> Below are the key technical updates:
>
> • Meson Build Configuration: Adjusted below meson.build scripts to
> incorporate the suggested changes, ensuring proper dependency resolution
> and improved build consistency.
>
> Removed the AIX changes in the below from the previous patch.
>
> src/backend/jit/llvm/meson.build
> src/backend/replication/libpqwalreceiver/meson.build
> src/backend/replication/pgoutput/meson.build
> src/backend/snowball/meson.build
> src/backend/utils/mb/conversion_procs/meson.build
>
> Added the static_library() changes.
>
> > Regarding the archiving of shared and static libraries, the
> latest version of
>> Meson raises a conflict as both targets have the same name. This issue
>> arises because, on AIX, both shared and static libraries are named as same
>> archive, which leads to naming collisions during the build process. We
>> would still need the below changes.
>
> src/interfaces/ecpg/compatlib/meson.build
> src/interfaces/ecpg/ecpglib/meson.build
> src/interfaces/ecpg/pgtypeslib/meson.build
> src/interfaces/libpq/meson.build
>
> • CFLAGS Optimization Removal: Removed high-level optimization flags
> from CFLAGS to prevent unpredictable behaviour and maintain stability
> during compilation.
>
> I would greatly appreciate it if you could review the patch and share
> your feedback or any additional recommendations.
>
> Apologies for the delayed response; I was occupied with other tasks.
>
> Your insights are greatly appreciated and will help enhance the patch.
>
>
> Warm regards,
> -Sriram.
>
>
1) In meson.build:
+ cppflags += '-D_GNU_SOURCE'
I don't think this symbol is applicable to AIX.
2) In meson.build:
+ # Native memset() is faster, tested on:
+ memset_loop_limit = 0
The comment sentence appears to be truncated.
3) In meson.build:
+#if cc.alignment('int64_t', args: test_c_args, prefix: '#include
<stdint.h>') > alignof_double
+# error('alignment of int64_t is greater than the alignment of double')
+#endif
This commented out code cannot be left like this. Either remove it or
adjust it as required.
4) In meson.build:
/* This must match the corresponding code in c.h: */
- #if defined(__GNUC__)
+ #if defined(__GNUC__) || defined(__IBMC__)
You code does not observe what the comment says.
5) The changes in src/include/port/aix.h are nonsense. This was
previously pointed out and you said you would address this.
6) I had previously pointed out that the changes in
src/include/storage/s_lock.h are not acceptable like that and you had
said that you would address that.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-12-09 21:56 Tristan Partin <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 1 reply; 73+ messages in thread
From: Tristan Partin @ 2025-12-09 21:56 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; AIX PG user <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers <[email protected]>
Howdy,
Heikki asked me to look at the renames of the static Meson targets.
I don't understand the reasoning for the changes. I am completely
unfamiliar with AIX, so maybe it's obvious. Does Meson produce a static
library and a shared library with the same file extension? If so, why is
that? That's the only reason I can think of for making those changes. Is
it AIX-specific or whatever OS you are testing on?
In your patch, I found a link to
https://www.postgresql.org/message-id/[email protected]....
> -> On AIX, you can do a static as well as a dynamic
> -> link against a shared library, it depends on how you
> -> invoke the linker.
>
> When you link statically, the shared objects from
> the library are added to your executable as required;
> when you link dynamically, only references
> to the shared objects are included in the executable.
>
> Consequently you do not need a separate static library
> on AIX if you have a dynamic library.
This seems to imply that we don't need a static library at all on AIX.
However this email is also nearing 20 years old :D. Could we get away
without the renames on the Meson targets by just not defining the static
library targets?
--
Tristan Partin
Databricks (https://databricks.com)
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-12-10 14:31 Srirama Kucherlapati <[email protected]>
parent: Tristan Partin <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-12-10 14:31 UTC (permalink / raw)
To: Tristan Partin <[email protected]>; AIX PG user <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers <[email protected]>
Hi Tristan,
Thank you for reviewing the patch.
We encountered the following error when building without the "_static" suffix in the library name:
Found ninja-1.12.1 at /opt/freeware/bin/ninja
ERROR: Multiple producers for Ninja target "src/interfaces/ecpg/compatlib/libecpg_compat.a”.
Please rename your targets.
On AIX, shared libraries are archived in a way that allows multiple versions to
coexist within the same archive. This is primarily because shared library(.so)
is archived into .a, which leads to naming conflicts between static and shared
libraries. To address this, we suffixed the library with “_static".
However, we later tested by completely skipping the static library build, and
this approach worked successfully since it eliminates the conflict between
static and shared libraries. I'm working on the changes and will validate
further on this.
BTW, thank you, Heikki and Peter, for your comments. I’m working on the comments
and I’ll keep you updated.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-12-10 18:37 Tristan Partin <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Tristan Partin @ 2025-12-10 18:37 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; AIX PG user <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers <[email protected]>
On Wed Dec 10, 2025 at 8:32 AM CST, Srirama Kucherlapati wrote:
> We encountered the following error when building without the "_static" suffix in the library name:
> Found ninja-1.12.1 at /opt/freeware/bin/ninja
> ERROR: Multiple producers for Ninja target "src/interfaces/ecpg/compatlib/libecpg_compat.a”.
> Please rename your targets.
>
> On AIX, shared libraries are archived in a way that allows multiple versions to
> coexist within the same archive. This is primarily because shared library(.so)
> is archived into .a, which leads to naming conflicts between static and shared
> libraries. To address this, we suffixed the library with “_static".
>
> However, we later tested by completely skipping the static library build, and
> this approach worked successfully since it eliminates the conflict between
> static and shared libraries. I'm working on the changes and will validate
> further on this.
Thanks for the explanation. I'm glad we can workaround this without
renaming the targets!
--
Tristan Partin
Databricks (https://databricks.com)
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-12-19 15:34 Srirama Kucherlapati <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-12-19 15:34 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Hi Peter/Heikki/Tristan
Please find the attached changes for the below comments. Along with comments from Tristan.
Please let me know if these meson specific changes are fine.
0001-Support-for-AIX-meson-updates.pg19.patch - has the changes for the below comments only.
0001-Support-for-AIX-all-meson.pg19.patch - has all the meson specific changes.
>> 1) In meson.build:
>> + cppflags += '-D_GNU_SOURCE’
>> I don't think this symbol is applicable to AIX.
AIX provides certain functions similar to Linux, but with different names and
signatures. To align them with Linux behaviour, the GNU_SOURCE macro is defined,
which enables AIX functions to behave like their Linux counterparts.
You are right, this is not needed for AIX. I have removed and everything got build.
>> 2) In meson.build:
>> + # Native memset() is faster, tested on:
>> + memset_loop_limit = 0
>> The comment sentence appears to be truncated.
For now, removed this, I’ll provide statistics in a different thread as Heikki suggested.
>> 3) In meson.build:
>> +#if cc.alignment('int64_t', args: test_c_args, prefix: ‘#include
>> <stdint.h>') > alignof_double
>>+# error('alignment of int64_t is greater than the alignment of double’)
>> +#endif
>> This commented out code cannot be left like this. Either remove it or
>> adjust it as required.
I have updated the similar logic as in regular GNU configure file.
>> 4) In meson.build:
>> /* This must match the corresponding code in c.h: */
>> - #if defined(__GNUC__)
>> + #if defined(__GNUC__) || defined(__IBMC__)
>> You code does not observe what the comment says.
You are right, I have removed this as this is relevant only if we are compiling with XLC. Right now, its compiled with gcc
>> 5) The changes in src/include/port/aix.h are nonsense. This was
>> previously pointed out and you said you would address this.
The changes are irrelevant now, removed them. As all these additional definitions are covered by the postgres defined header file (src/include/utils/float.h). We can use “_H_FLOAT” to skip the system header "float.h”.
I’d like to finalize all Meson-specific changes first. Meanwhile, I’m also working on the other comments.
Kindly let me know your thoughts and feedback on the changes.
Thanks,
Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX-all-meson.pg19.patch (8.1K, 3-0001-Support-for-AIX-all-meson.pg19.patch)
download | inline diff:
diff --git a/meson.build b/meson.build
index 6e7ddd74683..6ba24187d15 100644
--- a/meson.build
+++ b/meson.build
@@ -206,6 +206,26 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1785,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3525,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# The static libpq is skipped in AIX. This is not required.
+if host_system != 'aix'
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
@@ -3816,7 +3879,13 @@ add_test_setup('running',
###############################################################
alias_target('backend', backend_targets)
-alias_target('bin', bin_targets + [libpq_st])
+if host_system != 'aix'
+ alias_target('bin', bin_targets + [libpq_st])
+else
+ # The static libpq is skipped in AIX. This is not required.
+ alias_target('bin', bin_targets)
+endif
+
alias_target('pl', pl_targets)
alias_target('contrib', contrib_targets)
alias_target('testprep', testprep_targets)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..af96e375a9b 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -16,6 +16,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
+if host_system != 'aix'
ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
@@ -25,6 +26,7 @@ ecpg_compat_st = static_library('libecpg_compat',
kwargs: default_lib_args,
)
ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..7d28cd67388 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -25,6 +25,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
+if host_system != 'aix'
ecpglib_st = static_library('libecpg',
ecpglib_sources,
include_directories: ecpglib_inc,
@@ -35,6 +36,7 @@ ecpglib_st = static_library('libecpg',
kwargs: default_lib_args,
)
ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..97f4e1c6eda 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -21,6 +21,7 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
+if host_system != 'aix'
ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
@@ -30,6 +31,7 @@ ecpg_pgtypes_st = static_library('libpgtypes',
kwargs: default_lib_args,
)
ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..98ced9376d9 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -57,6 +57,7 @@ libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
# We could try to avoid building the source files twice, but it probably adds
# more complexity than its worth (reusing object files requires also linking
# to the library on windows or breaks precompiled headers).
+if host_system != 'aix'
libpq_st = static_library('libpq',
libpq_sources,
include_directories: [libpq_inc],
@@ -65,6 +66,7 @@ libpq_st = static_library('libpq',
dependencies: [frontend_stlib_code, libpq_deps],
kwargs: default_lib_args,
)
+endif
libpq_so = shared_library('libpq',
libpq_sources + libpq_so_sources,
[application/octet-stream] 0001-Support-for-AIX-meson-updates.pg19.patch (8.9K, 4-0001-Support-for-AIX-meson-updates.pg19.patch)
download | inline diff:
diff --git a/meson.build b/meson.build
index 304a9184075..6ba24187d15 100644
--- a/meson.build
+++ b/meson.build
@@ -215,15 +215,16 @@ elif host_system == 'aix'
mod_link_with_dir = 'libdir'
mod_link_with_name = '@[email protected]'
dl_suffix = '.a'
- cppflags += '-D_GNU_SOURCE'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
# M:SRE sets a flag indicating that an object is a shared library. Seems to
# work in some circumstances without, but required in others.
ldflags_sl += '-Wl,-bM:SRE'
ldflags_be += '-Wl,-brtllib'
- # Native memset() is faster, tested on:
- memset_loop_limit = 0
elif host_system == 'darwin'
dlsuffix = '.dylib'
@@ -1784,10 +1785,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-#if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
-# error('alignment of int64_t is greater than the alignment of double')
-#endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -1839,7 +1879,7 @@ if cc.links('''
if not meson.is_cross_build()
r = cc.run('''
/* This must match the corresponding code in c.h: */
- #if defined(__GNUC__) || defined(__IBMC__)
+ #if defined(__GNUC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
#elif defined(_MSC_VER)
#define pg_attribute_aligned(a) __declspec(align(a))
@@ -3485,13 +3525,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# The static libpq is skipped in AIX. This is not required.
+if host_system != 'aix'
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
@@ -3835,7 +3879,13 @@ add_test_setup('running',
###############################################################
alias_target('backend', backend_targets)
-alias_target('bin', bin_targets + [libpq_st])
+if host_system != 'aix'
+ alias_target('bin', bin_targets + [libpq_st])
+else
+ # The static libpq is skipped in AIX. This is not required.
+ alias_target('bin', bin_targets)
+endif
+
alias_target('pl', pl_targets)
alias_target('contrib', contrib_targets)
alias_target('testprep', testprep_targets)
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
index dd7cfb197cd..c86983a4452 100644
--- a/src/include/port/aix.h
+++ b/src/include/port/aix.h
@@ -1,26 +1,3 @@
/*
* src/include/port/aix.h
*/
-
-/* This change is required for the meson changes as the autoconf is not run and
- * to resolve the conflicts in picking the float.h details by default from the
- * postgres defined datatypes.
- */
-#ifdef _AIX
-#ifndef PGDLLIMPORT
-#define PGDLLIMPORT
-#endif /* PGDLLIMPORT */
-typedef float float4;
-typedef double float8;
-
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
-#define pg_noreturn _Noreturn
-#elif defined(__GNUC__)
-#define pg_noreturn __attribute__((noreturn))
-#else
-#define pg_noreturn
-#endif
-
-#include <stdbool.h>
-
-#endif /*_AIX */
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 3f39187cdcc..af96e375a9b 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -16,7 +16,8 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpg_compat_st = static_library('libecpg_compat_static',
+if host_system != 'aix'
+ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
@@ -25,6 +26,7 @@ ecpg_compat_st = static_library('libecpg_compat_static',
kwargs: default_lib_args,
)
ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index e9faf290a2b..7d28cd67388 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -25,7 +25,8 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpglib_st = static_library('libecpg_static',
+if host_system != 'aix'
+ecpglib_st = static_library('libecpg',
ecpglib_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
@@ -35,6 +36,7 @@ ecpglib_st = static_library('libecpg_static',
kwargs: default_lib_args,
)
ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 94d1d0ad1ef..97f4e1c6eda 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -21,7 +21,8 @@ if host_system == 'windows'
endif
# see src/interfaces/libpq/meson.build
-ecpg_pgtypes_st = static_library('libpgtypes_static',
+if host_system != 'aix'
+ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
@@ -30,6 +31,7 @@ ecpg_pgtypes_st = static_library('libpgtypes_static',
kwargs: default_lib_args,
)
ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index eea175ad14a..98ced9376d9 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -57,7 +57,8 @@ libpq_so_c_args = ['-DUSE_DYNAMIC_OAUTH']
# We could try to avoid building the source files twice, but it probably adds
# more complexity than its worth (reusing object files requires also linking
# to the library on windows or breaks precompiled headers).
-libpq_st = static_library('libpq_static',
+if host_system != 'aix'
+libpq_st = static_library('libpq',
libpq_sources,
include_directories: [libpq_inc],
c_args: libpq_c_args,
@@ -65,6 +66,7 @@ libpq_st = static_library('libpq_static',
dependencies: [frontend_stlib_code, libpq_deps],
kwargs: default_lib_args,
)
+endif
libpq_so = shared_library('libpq',
libpq_sources + libpq_so_sources,
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index 25827c42a68..19c8b60560f 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -21,7 +21,7 @@ if (not( $format eq 'darwin'
or $format eq 'win'
or $format eq 'aix'))
{
- die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
+ die "$0: $format is not yet handled (only darwin, gnu, win, aix are)\n";
}
open(my $input_handle, '<', $input)
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2025-12-21 08:19 Tristan Partin <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Tristan Partin @ 2025-12-21 08:19 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
Thanks for your continued push for AIX support! Here are a few comments:
> # The static libpq is skipped in AIX. This is not required.
For comments like this, I would generally like to see some links or
inline documentation to why this is the case. Maybe Peter or Heikki
disagree.
There are a few places in the Meson code like the following:
if AIX:
don't define the static library target
endif
Make sure that the innards of the if statements are indented.
Alternatively, you could define something like:
static_library_dependencies = []
if host_machine.system() == 'AIX'
# TODO: Document this
AIX_poison_pill = disabler()
static_library_dependencies += AIX_poison_pill
endif
And then for all static library definitions, you would just make sure
that they all depend on the poison pill. You could document the AIX
shared/static library situation where the AIX_poison_pill variable is
defined. I'd like to see if Peter thinks this is a good idea before
implementing it.
I'm also a little confused by the second patch. Some of it seems to be
the same, and some other parts seem to be new. Should we consolidate all
Meson AIX support into one patch? Overall, I think the size of the patch
is good, and seem pretty maintainable.
--
Tristan Partin
Databricks (https://databricks.com)
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2025-12-24 15:34 Srirama Kucherlapati <[email protected]>
parent: Tristan Partin <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2025-12-24 15:34 UTC (permalink / raw)
To: Tristan Partin <[email protected]>; Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
Hi Tristan,
Thank you for your feedback and suggestions.
As suggested, we have tried to implement a dependency-driven approach for static library builds, rather than using AIX platform tags.
modified: meson.build
dep_static_lib = declare_dependency() << new dependency
if host_system == 'aix'
dep_static_lib = disabler()
endif
modified: src/interfaces/ecpg/compatlib/meson.build
ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
dependencies: [frontend_stlib_code, thread_dep, dep_static_lib], << new dependency
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
modified: src/interfaces/ecpg/ecpglib/meson.build
ecpglib_st = static_library('libecpg',
ecpglib_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib], << new dependency
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
modified: src/interfaces/ecpg/pgtypeslib/meson.build
ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
dependencies: [frontend_stlib_code, dep_static_lib], << new dependency
kwargs: default_lib_args,
)
modified: src/interfaces/libpq/meson.build
libpq_st = static_library('libpq',
libpq_sources,
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib], << new dependency
kwargs: default_lib_args,
)
> I'd like to see if Peter thinks this is a good idea before implementing it.
Also I would like to understand Peter/Heikki thoughts as well on this new implementation.
> Should we consolidate all Meson AIX support into one patch?
> Overall, I think the size of the patch is good, and seem pretty maintainable.
Thank you, Tristan, for your assistance. At present, the build appears stable
with the recent changes, however, the new dependency is causing impacts
elsewhere(with tmp_install). I will provide the consolidated patch after addressing these concerns.
Thanks,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-02 14:43 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-02 14:43 UTC (permalink / raw)
To: Tristan Partin <[email protected]>; Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
Hi Tristan/Peter/Heikki,
Please find attached meson changes wrt to the comments from Tristan regarding the dependency approach.
Kindly let me know your thoughts and suggestions.
Warm regards,
Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX-pg19-meson.diff (8.1K, 3-0001-Support-for-AIX-pg19-meson.diff)
download | inline diff:
diff --git a/meson.build b/meson.build
index 6e7ddd74683..0c03481d721 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,8 @@ endif
# that purpose.
portname = host_system
+dep_static_lib = declare_dependency()
+
if host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
@@ -206,6 +208,32 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # https://mesonbuild.com/Release-notes-for-1-6-0.html
+ # According to Mesons documentation for AIX, both shared and static libraries
+ # are typically archived, and they should have distinct names if a project
+ # requires building both. However, in this case, only shared libraries are
+ # used on AIX, so we are skipping the build for static libraries.
+ dep_static_lib = disabler()
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1793,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3533,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# Include the libpq only if its build. For AIX its skipped.
+if not dep_static_lib.disabled()
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..5d32636c1e3 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -20,11 +20,13 @@ ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
- dependencies: [frontend_stlib_code, thread_dep],
+ dependencies: [frontend_stlib_code, thread_dep, dep_static_lib],
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_compat_st
+if not dep_static_lib.disabled()
+ ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..3c61bdeeffd 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -30,11 +30,13 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, thread_dep, libpq],
+ dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpglib_st
+if not ecpglib_st.disabled()
+ ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..b6fc20e9db6 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -26,10 +26,12 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: frontend_stlib_code,
+ dependencies: [frontend_stlib_code, dep_static_lib],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_pgtypes_st
+if not ecpg_pgtypes_st.disabled()
+ ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..ea3f540f8bc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -62,7 +62,7 @@ libpq_st = static_library('libpq',
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, libpq_deps],
+ dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib],
kwargs: default_lib_args,
)
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-13 16:06 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-13 16:06 UTC (permalink / raw)
To: Tristan Partin <[email protected]>; Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
Hi Tristan, Heikki, Peter,
Greetings!
As suggested, we have addressed all your comments(wrt to meson) and incorporated the dependency-based approach for static libraries in this patch. We believe this solution provides a more generic and maintainable approach.
• Implemented a dependency-driven mechanism for static library builds instead of platform-specific tags.
I kindly request you to review the attached Meson changes based on your earlier feedback. Your input is highly valued and will help us further refine and improve these changes.
Thank you for your time and consideration. I look forward to your valuable feedback.
Warm regards,
Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX-pg19-meson.diff (8.1K, 3-0001-Support-for-AIX-pg19-meson.diff)
download | inline diff:
diff --git a/meson.build b/meson.build
index 6e7ddd74683..0c03481d721 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,8 @@ endif
# that purpose.
portname = host_system
+dep_static_lib = declare_dependency()
+
if host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
@@ -206,6 +208,32 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # https://mesonbuild.com/Release-notes-for-1-6-0.html
+ # According to Mesons documentation for AIX, both shared and static libraries
+ # are typically archived, and they should have distinct names if a project
+ # requires building both. However, in this case, only shared libraries are
+ # used on AIX, so we are skipping the build for static libraries.
+ dep_static_lib = disabler()
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1793,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3533,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# Include the libpq only if its build. For AIX its skipped.
+if not dep_static_lib.disabled()
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..5d32636c1e3 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -20,11 +20,13 @@ ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
- dependencies: [frontend_stlib_code, thread_dep],
+ dependencies: [frontend_stlib_code, thread_dep, dep_static_lib],
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_compat_st
+if not dep_static_lib.disabled()
+ ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..3c61bdeeffd 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -30,11 +30,13 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, thread_dep, libpq],
+ dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpglib_st
+if not ecpglib_st.disabled()
+ ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..b6fc20e9db6 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -26,10 +26,12 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: frontend_stlib_code,
+ dependencies: [frontend_stlib_code, dep_static_lib],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_pgtypes_st
+if not ecpg_pgtypes_st.disabled()
+ ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..ea3f540f8bc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -62,7 +62,7 @@ libpq_st = static_library('libpq',
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, libpq_deps],
+ dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib],
kwargs: default_lib_args,
)
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-14 21:33 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2026-01-14 21:33 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; Tristan Partin <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
On 13.01.26 17:06, Srirama Kucherlapati wrote:
> As suggested, we have addressed all your comments(wrt to meson) and
> incorporated the dependency-based approach for static libraries in this
> patch. We believe this solution provides a more generic and maintainable
> approach.
This patch appears to be incomplete. It references a file mkldexport.sh
but that file does not exist and is not included in the patch.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-15 05:51 Srirama Kucherlapati <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-15 05:51 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; Tristan Partin <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: AIX PG user <[email protected]>
Hi Peter,
Thank you for taking the time to review this patch.
> This patch appears to be incomplete. It references a file mkldexport.sh
> but that file does not exist and is not included in the patch.
The initial patch contained only Meson-specific changes addressing the comments provided regarding Meson in this discussion.
https://www.postgresql.org/message-id/DF3QX1B91OKO.182K0IH9QDQUY%40partin.io
As requested, I have now included the mkldexport.sh changes in the attached file. We want to initially close all the meson review comments.
Please review the changes and let me know your thoughts or if any further adjustments are needed.
Looking forward to your feedback.
Warm regards,
Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX-pg19-meson.1.diff (9.8K, 3-0001-Support-for-AIX-pg19-meson.1.diff)
download | inline diff:
diff --git a/meson.build b/meson.build
index 6e7ddd74683..0c03481d721 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,8 @@ endif
# that purpose.
portname = host_system
+dep_static_lib = declare_dependency()
+
if host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
@@ -206,6 +208,32 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # https://mesonbuild.com/Release-notes-for-1-6-0.html
+ # According to Mesons documentation for AIX, both shared and static libraries
+ # are typically archived, and they should have distinct names if a project
+ # requires building both. However, in this case, only shared libraries are
+ # used on AIX, so we are skipping the build for static libraries.
+ dep_static_lib = disabler()
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1793,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3533,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# Include the libpq only if its build. For AIX its skipped.
+if not dep_static_lib.disabled()
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..5d32636c1e3 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -20,11 +20,13 @@ ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
- dependencies: [frontend_stlib_code, thread_dep],
+ dependencies: [frontend_stlib_code, thread_dep, dep_static_lib],
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_compat_st
+if not dep_static_lib.disabled()
+ ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..3c61bdeeffd 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -30,11 +30,13 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, thread_dep, libpq],
+ dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpglib_st
+if not ecpglib_st.disabled()
+ ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..b6fc20e9db6 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -26,10 +26,12 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: frontend_stlib_code,
+ dependencies: [frontend_stlib_code, dep_static_lib],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_pgtypes_st
+if not ecpg_pgtypes_st.disabled()
+ ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..ea3f540f8bc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -62,7 +62,7 @@ libpq_st = static_library('libpq',
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, libpq_deps],
+ dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib],
kwargs: default_lib_args,
)
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-21 14:19 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2026-01-21 14:19 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: AIX PG user <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; [email protected] <[email protected]>
On 15.01.26 06:51, Srirama Kucherlapati wrote:
>> This patch appears to be incomplete. It references a file mkldexport.sh
>> but that file does not exist and is not included in the patch.
>
> The initial patch contained only Meson-specific changes addressing the
> comments provided regarding Meson in this discussion.
> https://www.postgresql.org/message-id/
> DF3QX1B91OKO.182K0IH9QDQUY%40partin.io <https://www.postgresql.org/
> message-id/DF3QX1B91OKO.182K0IH9QDQUY%40partin.io>
>
> As requested, I have now included the mkldexport.sh changes in the
> attached file. We want to initially close all the meson review comments.
>
> Please review the changes and let me know your thoughts or if any
> further adjustments are needed.
I took this idea of disabling static libraries in meson and made it a
separate patch; see [0]. It looks like this patch is getting close to
consensus, so we could commit it soon. Then you could rebase your patch
over it, which would make it quite a bit simpler.
I think in general, the meson changes are ok. But I needed some
changes, for example, your patch contains
+if not dep_static_lib.disabled()
but the method .disabled() doesn't exist, it should be .found(). So I'm
wondering how this patch was tested.
Another patch of interest to you could be [1], which moves the
MAXIMUM_ALIGNOF computation into c.h. This should also simplify your
patch. But that patch has not received any discussion so far.
In any case, you should post complete patch series. It's ok to split
changes into multiple patches, and then recommend which parts you want
reviewed first. But we need to see at least a rough outline of the
complete plan before spending significant effort on reviewing the pieces.
[0]:
https://www.postgresql.org/message-id/e8aa97db-872b-4087-b073-f296baae948d%40eisentraut.org
[1]:
https://www.postgresql.org/message-id/58cedbc7-5658-468d-868e-a4d06de04ca6%40eisentraut.org
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-22 16:08 Srirama Kucherlapati <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-22 16:08 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: AIX PG user <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; [email protected] <[email protected]>
Hi Peter,
Thanks for looking into this and providing your feedback.
> I took this idea of disabling static libraries in meson and made it a
> separate patch; see [0]. It looks like this patch is getting close to
> consensus, so we could commit it soon. Then you could rebase your patch
> over it, which would make it quite a bit simpler.
That’s a great idea and will definitely help simplify the overall changes.
Once that patch is committed, I’ll rebase my changes accordingly to align with the new approach.
> I think in general, the meson changes are ok. But I needed some
> changes, for example, your patch contains
Thanks for reviewing the changes.
> but the method .disabled() doesn't exist, it should be .found(). So I’m
> wondering how this patch was tested.
You’re correct — the method .disabled() doesn’t exist; it should be .found(). We initially tried to follow the same approach used for other dependencies (like docs, docs_pdf, gssapi), and didn’t encounter any errors during testing.
In Meson, the option() class implements disabled(), but the disabler() object does not. When we ran a sample test, we observed that Meson’s behaviour on AIX/Linux seems to ignore any unknown methods. As a result, the .disabled() conditional check was silently skipped, which explains why it didn’t fail during our tests.
> Another patch of interest to you could be [1], which moves the
> MAXIMUM_ALIGNOF computation into c.h. This should also simplify your
> patch. But that patch has not received any discussion so far.
This is a better approach. This would simplify the changes in both configure and meson.build.
> It's ok to split changes into multiple patches, and then recommend which parts you want
> reviewed first. But we need to see at least a rough outline of the
> complete plan before spending significant effort on reviewing the pieces.
Sure. We are working on the changes. I’ll submit the full patch accordingly.
Thanks again for your guidance and support!
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-23 16:11 Srirama Kucherlapati <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 3 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-23 16:11 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Hi Peter,
> It's ok to split changes into multiple patches, and then recommend which parts you want
> reviewed first. But we need to see at least a rough outline of the
> complete plan before spending significant effort on reviewing the pieces.
Please find attached patches.
Meson changes - 0001-Support-for-AIX-pg19-meson.2.diff
Complete changes - 0001-Support-for-AIX.pg19.v11.patch
We have updated couple of changes in the full patch wrt to your previous
comments as well. Also, we are working to get the stats for the s_lock.h wrt
TAS. Will submit in a different thread.
Kindly request you to review the meson related changes.
Warm regards,
Sriram.
Attachments:
[application/octet-stream] 0001-Support-for-AIX-pg19-meson.2.diff (8.1K, 3-0001-Support-for-AIX-pg19-meson.2.diff)
download | inline diff:
diff --git a/meson.build b/meson.build
index 6e7ddd74683..17ad9c6ca32 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,8 @@ endif
# that purpose.
portname = host_system
+dep_static_lib = declare_dependency()
+
if host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
@@ -206,6 +208,32 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # https://mesonbuild.com/Release-notes-for-1-6-0.html
+ # According to Mesons documentation for AIX, both shared and static libraries
+ # are typically archived, and they should have distinct names if a project
+ # requires building both. However, in this case, only shared libraries are
+ # used on AIX, so we are skipping the build for static libraries.
+ dep_static_lib = disabler()
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1793,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3533,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# Include the libpq only if its build. For AIX its skipped.
+if dep_static_lib.found()
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..4bc47153896 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -20,11 +20,13 @@ ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
- dependencies: [frontend_stlib_code, thread_dep],
+ dependencies: [frontend_stlib_code, thread_dep, dep_static_lib],
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_compat_st
+if ecpg_compat_st.found()
+ ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..c5ee8e80cd1 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -30,11 +30,13 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, thread_dep, libpq],
+ dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpglib_st
+if ecpglib_st.found()
+ ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..2b7d80ddfb1 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -26,10 +26,12 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: frontend_stlib_code,
+ dependencies: [frontend_stlib_code, dep_static_lib],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_pgtypes_st
+if ecpg_pgtypes_st.found()
+ ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..ea3f540f8bc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -62,7 +62,7 @@ libpq_st = static_library('libpq',
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, libpq_deps],
+ dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib],
kwargs: default_lib_args,
)
[application/octet-stream] 0001-Support-for-AIX.pg19.v11.patch (23.6K, 4-0001-Support-for-AIX.pg19.v11.patch)
download | inline diff:
diff --git a/Makefile b/Makefile
index 8a2ec9396b6..9bc1a4ec17b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,6 @@
# AIX make defaults to building *every* target of the first rule. Start with
# a single-target, empty rule to make the other targets non-default.
-# (We don't support AIX anymore, but if someone tries to build on AIX anyway,
-# at least they'll get the instructions to run 'configure' first.)
all:
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world:
diff --git a/configure b/configure
index 3a0ed11fa8e..c4749a8e5b6 100755
--- a/configure
+++ b/configure
@@ -3020,6 +3020,7 @@ else
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -17006,13 +17007,37 @@ _ACEOF
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+echo "Checking for MAX ALIGN - $PORTNAME"
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
-if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
-fi
-if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
- as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $ac_cv_alignof_long_long_int -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ echo "MAX ALIGN ac_cv_alignof_long"
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ echo "MAX ALIGN ac_cv_alignof_double"
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ echo "MAX ALIGN ac_cv_alignof_int64_t"
+ fi
fi
cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index c2413720a18..7f1530df2b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ PGAC_ARG_REQ(with, template, [NAME], [override operating system template],
# --with-template not given
case $host_os in
+ aix*) template=aix ;;
cygwin*|msys*) template=cygwin ;;
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
@@ -2006,7 +2007,33 @@ AC_CHECK_ALIGNOF(double)
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
-MAX_ALIGNOF=$ac_cv_alignof_double
+if test "$PORTNAME" != "aix"; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+
+ if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
+ as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+ if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF; then
+ as_fn_error $? "alignment of 'long long int' is greater than the alignment of 'double'" "$LINENO" 5
+ fi
+else
+# The AIX 'power' alignment rules apply the natural alignment of the "first
+# member" if it is of a floating-point data type (or is an aggregate whose
+# recursively "first" member or element is such a type). The alignment
+# associated with these types for subsequent members use an alignment value
+# where the floating-point data type is considered to have 4-byte alignment.
+# More info
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+#
+# The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+# alignement across platforms the max alignment of long should be considered.
+ MAX_ALIGNOF=$ac_cv_alignof_long
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_double ; then
+ MAX_ALIGNOF=$ac_cv_alignof_double
+ fi
+ if test $MAX_ALIGNOF -lt $ac_cv_alignof_int64_t ; then
+ MAX_ALIGNOF="$ac_cv_alignof_int64_t"
+ fi
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
AC_MSG_ERROR([alignment of 'long' is greater than the alignment of 'double'])
diff --git a/meson.build b/meson.build
index 6e7ddd74683..17ad9c6ca32 100644
--- a/meson.build
+++ b/meson.build
@@ -198,6 +198,8 @@ endif
# that purpose.
portname = host_system
+dep_static_lib = declare_dependency()
+
if host_system == 'cygwin'
sema_kind = 'unnamed_posix'
cppflags += '-D_GNU_SOURCE'
@@ -206,6 +208,32 @@ if host_system == 'cygwin'
mod_link_with_name = 'lib@[email protected]'
mod_link_with_dir = 'libdir'
+elif host_system == 'aix'
+ sema_kind = 'unnamed_posix'
+ library_path_var = 'LIBPATH'
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@[email protected]'
+ dl_suffix = '.a'
+ # This flag is required to make sure the user spefic float.h is
+ # picked instead of the system float.h header file, which doesnot
+ # have definition like float8, etc
+ cflags += '-D_H_FLOAT'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # https://mesonbuild.com/Release-notes-for-1-6-0.html
+ # According to Mesons documentation for AIX, both shared and static libraries
+ # are typically archived, and they should have distinct names if a project
+ # requires building both. However, in this case, only shared libraries are
+ # used on AIX, so we are skipping the build for static libraries.
+ dep_static_lib = disabler()
+
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
@@ -1765,10 +1793,49 @@ endforeach
# as long, char, short, or int. Note that we intentionally do not consider
# any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
# would be too much of a penalty for disk and memory space.
-alignof_double = cdata.get('ALIGNOF_DOUBLE')
-if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
- error('alignment of int64_t is greater than the alignment of double')
-endif
+if host_system != 'aix'
+ alignof_double = cdata.get('ALIGNOF_DOUBLE')
+ if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
+ error('alignment of int64_t is greater than the alignment of double')
+ endif
+else
+ # The AIX 'power' alignment rules apply the natural alignment of the "first
+ # member" if it is of a floating-point data type (or is an aggregate whose
+ # recursively "first" member or element is such a type). The alignment
+ # associated with these types for subsequent members use an alignment value
+ # where the floating-point data type is considered to have 4-byte alignment.
+ # More info
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
+ #
+ # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
+ # alignement across platforms the max alignment of long should be considered.
+
+ # Get the alignment values
+ ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
+ ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
+
+ message('Alignment of long : @0@'.format(ac_cv_alignof_long))
+ message('Alignment of double : @0@'.format(ac_cv_alignof_double))
+ message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
+
+ # Start with long
+ alignof_double = ac_cv_alignof_long
+ message('MAX ALIGN ac_cv_alignof_long')
+
+ # Compare with double
+ if alignof_double < ac_cv_alignof_double
+ alignof_double = ac_cv_alignof_double
+ message('MAX ALIGN ac_cv_alignof_double')
+ endif
+
+ # Compare with int64_t
+ if alignof_double < ac_cv_alignof_int64_t
+ alignof_double = ac_cv_alignof_int64_t
+ message('MAX ALIGN ac_cv_alignof_int64_t')
+ endif
+endif
+message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
cdata.set('MAXIMUM_ALIGNOF', alignof_double)
cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))
@@ -3466,13 +3533,17 @@ endif
installed_targets = [
backend_targets,
bin_targets,
- libpq_st,
pl_targets,
contrib_targets,
nls_mo_targets,
ecpg_targets,
]
+# Include the libpq only if its build. For AIX its skipped.
+if dep_static_lib.found()
+ installed_targets += [libpq_st]
+endif
+
if oauth_flow_supported
installed_targets += [
libpq_oauth_so,
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 3825af5b228..35adc4174ed 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,6 +106,20 @@ ifdef SO_MAJOR_VERSION
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
endif
+ifeq ($(PORTNAME), aix)
+ LINK.shared = $(COMPILER)
+ ifdef SO_MAJOR_VERSION
+ shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ endif
+ haslibarule = yes
+ # $(exports_file) is also usable as an import file
+ exports_file = lib$(NAME).exp
+ BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
+ ifneq (,$(SHLIB_EXPORTS))
+ LINK.shared += -Wl,-bE:$(exports_file)
+ endif
+endif
+
ifeq ($(PORTNAME), darwin)
ifdef soname
# linkable library
@@ -254,6 +268,14 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
touch $@
endif #haslibarule
+# AIX wraps both shared libraries and static library, which can be used both
+# for static and shared linking
+ifeq ($(PORTNAME), aix)
+$(stlib): $(shlib)
+ rm -f $(stlib)
+ $(AR) $(AROPT) $(stlib) $(shlib)
+endif # aix
+
ifeq (,$(filter cygwin win32,$(PORTNAME)))
# Normal case
@@ -267,8 +289,11 @@ ifneq ($(shlib), $(shlib_major))
endif
# Make sure we have a link to a name without any version numbers
ifneq ($(shlib), $(shlib_bare))
+# except on AIX, where that's not a thing
+ifneq ($(PORTNAME), aix)
rm -f $(shlib_bare)
$(LN_S) $(shlib) $(shlib_bare)
+endif # aix
endif # shlib_bare
endif # shlib_major
@@ -376,6 +401,9 @@ install-lib-static: $(stlib) installdirs-lib
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
+# we don't install $(shlib) on AIX
+# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
+ifneq ($(PORTNAME), aix)
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
@@ -391,6 +419,7 @@ ifneq ($(shlib), $(shlib_bare))
endif
endif # not win32
endif # not cygwin
+endif # not aix
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
endif
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 7344c8c7f5c..572f5430a60 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -63,12 +63,14 @@ all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(
ifneq ($(PORTNAME), cygwin)
ifneq ($(PORTNAME), win32)
+ifneq ($(PORTNAME), aix)
postgres: $(OBJS)
$(CC) $(CFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LIBS) -o $@
endif
endif
+endif
ifeq ($(PORTNAME), cygwin)
@@ -95,6 +97,24 @@ libpostgres.a: postgres
endif # win32
+ifeq ($(PORTNAME), aix)
+
+postgres: $(POSTGRES_IMP)
+ $(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+
+# Linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT.
+#
+# It looks alluring to use $(CC) -r instead of ld -r, but that doesn't
+# trivially work with gcc, due to gcc specific static libraries linked in with
+# -r.
+$(POSTGRES_IMP): $(OBJS)
+ ld -r -o SUBSYS.o $(call expand_subsys,$^)
+ $(MKLDEXPORT) SUBSYS.o . > $@
+ @rm -f SUBSYS.o
+
+endif # aix
+
$(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport
diff --git a/src/backend/meson.build b/src/backend/meson.build
index b831a541652..4838f245ab3 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -125,6 +125,24 @@ if host_system == 'windows'
'--FILEDESC', 'PostgreSQL Server',])
endif
+if host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+
postgres = executable('postgres',
backend_input,
sources: post_export_backend_sources,
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
new file mode 100755
index 00000000000..adf3793e868
--- /dev/null
+++ b/src/backend/port/aix/mkldexport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# mkldexport
+# create an AIX exports file from an object file
+#
+# src/backend/port/aix/mkldexport.sh
+#
+# Usage:
+# mkldexport objectfile [location]
+# where
+# objectfile is the current location of the object file.
+# location is the eventual (installed) location of the
+# object file (if different from the current
+# working directory).
+#
+# [This file comes from the Postgres 4.2 distribution. - ay 7/95]
+#
+# Header: /usr/local/devel/postgres/src/tools/mkldexport/RCS/mkldexport.sh,v 1.2 1994/03/13 04:59:12 aoki Exp
+#
+
+# setting this to nm -B might be better
+# ... due to changes in AIX 4.x ...
+# ... let us search in different directories - Gerhard Reithofer
+if [ -x /usr/ucb/nm ]
+then NM=/usr/ucb/nm
+elif [ -x /usr/bin/nm ]
+then NM=/usr/bin/nm
+elif [ -x /usr/ccs/bin/nm ]
+then NM=/usr/ccs/bin/nm
+elif [ -x /usr/usg/bin/nm ]
+then NM=/usr/usg/bin/nm
+else echo "Fatal error: cannot find `nm' ... please check your installation."
+ exit 1
+fi
+
+CMDNAME=`basename $0`
+if [ -z "$1" ]; then
+ echo "Usage: $CMDNAME object [location]"
+ exit 1
+fi
+OBJNAME=`basename $1`
+if [ "`basename $OBJNAME`" != "`basename $OBJNAME .o`" ]; then
+ OBJNAME=`basename $OBJNAME .o`.so
+fi
+if [ -z "$2" ]; then
+ echo '#!'
+else
+ if [ "$2" = "." ]; then
+ # for the base executable (AIX 4.2 and up)
+ echo '#! .'
+ else
+ echo '#!' $2
+ fi
+fi
+$NM -BCg $1 | \
+ egrep ' [TDB] ' | \
+ sed -e 's/.* //' | \
+ egrep -v '\$' | \
+ sed -e 's/^[.]//' | \
+ sort | \
+ uniq
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 29643c51439..1c933b5afad 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -914,7 +914,9 @@ errcode_for_file_access(void)
/* Wrong object type or state */
case ENOTDIR: /* Not a directory */
case EISDIR: /* Is a directory */
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY: /* Directory not empty */
+#endif
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
break;
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
new file mode 100644
index 00000000000..c86983a4452
--- /dev/null
+++ b/src/include/port/aix.h
@@ -0,0 +1,3 @@
+/*
+ * src/include/port/aix.h
+ */
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 7f8f566bd40..1a0cd5ec019 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -398,60 +398,20 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
-/* On PPC, it's a win to use a non-locking test before the lwarx */
+/* On PPC, use the compiler provided Built-in functions for atomic memory
+ * exchange operations.
+ */
#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
-/*
- * The second operand of addi can hold a constant zero or a register number,
- * hence constraint "=&b" to avoid allocating r0. "b" stands for "address
- * base register"; most operands having this register-or-zero property are
- * address bases, e.g. the second operand of lwax.
- *
- * 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.
- * But if the spinlock is in ordinary memory, we can use lwsync instead for
- * better performance.
- */
static __inline__ int
tas(volatile slock_t *lock)
{
- slock_t _t;
- int _res;
-
- __asm__ __volatile__(
-" lwarx %0,0,%3,1 \n"
-" cmpwi %0,0 \n"
-" bne 1f \n"
-" addi %0,%0,1 \n"
-" stwcx. %0,0,%3 \n"
-" beq 2f \n"
-"1: \n"
-" li %1,1 \n"
-" b 3f \n"
-"2: \n"
-" lwsync \n"
-" li %1,0 \n"
-"3: \n"
-: "=&b"(_t), "=r"(_res), "+m"(*lock)
-: "r"(lock)
-: "memory", "cc");
- return _res;
+ return __sync_lock_test_and_set(lock, 1);
}
-
-/*
- * PowerPC S_UNLOCK is almost standard but requires a "sync" instruction.
- * But we can use lwsync instead for better performance.
- */
-#define S_UNLOCK(lock) \
-do \
-{ \
- __asm__ __volatile__ (" lwsync \n" ::: "memory"); \
- *((volatile slock_t *) (lock)) = 0; \
-} while (0)
+#define S_UNLOCK(lock) __sync_lock_release(lock)
#endif /* powerpc */
-
-
+
#if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */
#define HAS_TEST_AND_SET
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 56e0a21651b..4bc47153896 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -20,11 +20,13 @@ ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
include_directories: ecpg_compat_inc,
c_args: ecpg_compat_c_args,
- dependencies: [frontend_stlib_code, thread_dep],
+ dependencies: [frontend_stlib_code, thread_dep, dep_static_lib],
link_with: [ecpglib_st, ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_compat_st
+if ecpg_compat_st.found()
+ ecpg_targets += ecpg_compat_st
+endif
ecpg_compat_so = shared_library('libecpg_compat',
ecpg_compat_sources + ecpg_compat_so_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 8f478c6a73e..c5ee8e80cd1 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -30,11 +30,13 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, thread_dep, libpq],
+ dependencies: [frontend_stlib_code, thread_dep, libpq, dep_static_lib],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
)
-ecpg_targets += ecpglib_st
+if ecpglib_st.found()
+ ecpg_targets += ecpglib_st
+endif
ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 02301ec9acb..2b7d80ddfb1 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -26,10 +26,12 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: frontend_stlib_code,
+ dependencies: [frontend_stlib_code, dep_static_lib],
kwargs: default_lib_args,
)
-ecpg_targets += ecpg_pgtypes_st
+if ecpg_pgtypes_st.found()
+ ecpg_targets += ecpg_pgtypes_st
+endif
ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a74e885b169..ea3f540f8bc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -62,7 +62,7 @@ libpq_st = static_library('libpq',
include_directories: [libpq_inc],
c_args: libpq_c_args,
c_pch: pch_postgres_fe_h,
- dependencies: [frontend_stlib_code, libpq_deps],
+ dependencies: [frontend_stlib_code, libpq_deps, dep_static_lib],
kwargs: default_lib_args,
)
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
new file mode 100644
index 00000000000..e91b250fd19
--- /dev/null
+++ b/src/makefiles/Makefile.aix
@@ -0,0 +1,34 @@
+# -blibpath:
+# The path to be inserted into the default path (Index 0 path) field of the
+# loader section. When this flag is presented, the -L paths will not be stored.
+# AIX uses a stricter, more explicit approach. The runtime linker expects to
+# tell it exactly where to look using -blibpath.
+# -blibpath must contain ALL directories where we should look for libraries
+libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
+
+# AIX uses a stricter, more explicit approach. The runtime linker expects
+# to tell it exactly where to look using -blibpath.
+rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
+
+# gcc needs to know it's building a shared lib, otherwise it'll not emit
+# correct code / link to the right support libraries
+ifeq ($(GCC), yes)
+LDFLAGS_SL += -shared
+endif
+
+# env var name to use in place of LD_LIBRARY_PATH
+ld_library_path_var = LIBPATH
+
+POSTGRES_IMP= postgres.imp
+
+ifdef PGXS
+BE_DLLLIBS= -Wl,-bI:$(pkglibdir)/$(POSTGRES_IMP)
+else
+BE_DLLLIBS= -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP)
+endif
+
+MKLDEXPORT_DIR=src/backend/port/aix
+MKLDEXPORT=$(top_srcdir)/$(MKLDEXPORT_DIR)/mkldexport.sh
+
+%$(DLSUFFIX): %.o
+ $(CC) $(CFLAGS) $*.o $(LDFLAGS) $(LDFLAGS_SL) -o $@ $(BE_DLLLIBS)
diff --git a/src/port/strerror.c b/src/port/strerror.c
index f0746517770..c46b9dc91fc 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,8 +214,10 @@ get_errno_symbol(int errnum)
return "ENOTCONN";
case ENOTDIR:
return "ENOTDIR";
+#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */
case ENOTEMPTY:
return "ENOTEMPTY";
+#endif
case ENOTSOCK:
return "ENOTSOCK";
#ifdef ENOTSUP
diff --git a/src/template/aix b/src/template/aix
new file mode 100644
index 00000000000..22f61093b1b
--- /dev/null
+++ b/src/template/aix
@@ -0,0 +1,6 @@
+# This file is referred for specific flags wrt to AIX build process like
+# cflags.
+# src/template/aix
+
+# Extra CFLAGS for code that will go into a shared library
+CFLAGS_SL=" "
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index 86a7742b369..19c8b60560f 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -18,9 +18,10 @@ GetOptions(
if (not( $format eq 'darwin'
or $format eq 'gnu'
- or $format eq 'win'))
+ or $format eq 'win'
+ or $format eq 'aix'))
{
- die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
+ die "$0: $format is not yet handled (only darwin, gnu, win, aix are)\n";
}
open(my $input_handle, '<', $input)
@@ -46,6 +47,10 @@ elsif ($format eq 'win')
}
print $output_handle "EXPORTS\n";
}
+elsif ($format eq 'aix')
+{
+ print $output_handle "#!\n";
+}
while (<$input_handle>)
{
@@ -63,6 +68,10 @@ while (<$input_handle>)
{
print $output_handle " $1;\n";
}
+ elsif ($format eq 'aix')
+ {
+ print $output_handle "$1\n";
+ }
elsif ($format eq 'win')
{
print $output_handle "$1 @ $2\n";
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-26 12:22 Peter Eisentraut <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 1 reply; 73+ messages in thread
From: Peter Eisentraut @ 2026-01-26 12:22 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
On 23.01.26 17:11, Srirama Kucherlapati wrote:
> Hi Peter,
>
> > It's ok to split changes into multiple patches, and then recommend
> which parts you want
>> reviewed first. But we need to see at least a rough outline of the
> > complete plan before spending significant effort on reviewing the pieces.
> Please find attached patches.
> Meson changes - 0001-Support-for-AIX-pg19-meson.2.diff
> Complete changes - 0001-Support-for-AIX.pg19.v11.patch
>
> We have updated couple of changes in the full patch wrt to your previous
> comments as well. Also, we are working to get the stats for the s_lock.h wrt
> TAS. Will submit in a different thread.
Ok, that patch set looks pretty reasonable now.
Can you confirm that this is the complete patch set required for AIX
support?
What version of AIX are you testing with?
What compilers are you testing with?
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-26 14:59 Srirama Kucherlapati <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-26 14:59 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; +Cc: Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
> Ok, that patch set looks pretty reasonable now.
Thank you, Peter, for taking the time to review the patches. I really appreciate your feedback, and it’s great to hear your positive assessment.
> Can you confirm that this is the complete patch set required for AIX support?
Yes, the complete patch attached in the previous mail has all the changes for AIX support.
Complete changes - 0001-Support-for-AIX.pg19.v11.patch
> What version of AIX are you testing with?
We are testing on an AIX 73F node.
oslevel - 7300-03-01-2520
> What compilers are you testing with?
We are compiling the source with gcc.
gcc-12 (GCC) 12.3.0
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-26 15:41 Andres Freund <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 2 replies; 73+ messages in thread
From: Andres Freund @ 2026-01-26 15:41 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Hi,
From what I can tell the meson patch *AGAIN* is missing mkldexport.sh. Also,
you seem to reference the script as files('port/aix/mkldexport.sh'), but that
that's not a path that makes sense for our source code structure (nor where
the "complete" patch adds it).
You really need to actually start testing your patches.
Doesn't the meson patch also require the changes to src/tools/gen_export.pl?
On 2026-01-23 16:11:25 +0000, Srirama Kucherlapati wrote:
> diff --git a/meson.build b/meson.build
> index 6e7ddd74683..17ad9c6ca32 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -198,6 +198,8 @@ endif
> # that purpose.
> portname = host_system
>
> +dep_static_lib = declare_dependency()
Add a comment saying something like
# In some configurations we don't want to install static libraries. For those
# dep_static_lib can be set to disabler() below.
The introduction of dep_static_lib should be broken out into its own patch.
> + # This flag is required to make sure the user spefic float.h is
> + # picked instead of the system float.h header file, which doesnot
> + # have definition like float8, etc
> + cflags += '-D_H_FLOAT'
I don't understand this one - how does defining _H_FLOAT lead to a different
header being picked? Also, float8 is defined in c.h, so it hardly could be
influenced by a system float.h header?
Our float.h header is only included as "utils/float.h", so it really shouldn't
be confused with a system header?
> @@ -1765,10 +1793,49 @@ endforeach
> # as long, char, short, or int. Note that we intentionally do not consider
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> -alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +if host_system != 'aix'
> + alignof_double = cdata.get('ALIGNOF_DOUBLE')
> + if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> + error('alignment of int64_t is greater than the alignment of double')
> + endif
> +else
> + # The AIX 'power' alignment rules apply the natural alignment of the "first
> + # member" if it is of a floating-point data type (or is an aggregate whose
> + # recursively "first" member or element is such a type). The alignment
> + # associated with these types for subsequent members use an alignment value
> + # where the floating-point data type is considered to have 4-byte alignment.
> + # More info
> + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
> + #
> + # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
> + # alignement across platforms the max alignment of long should be considered.
How are these "AIX 'power' alignment rules" for float not just completely
broken?
I assume this means that 4 byte aligned floats work just fine, but have
degraded peformance?
Is there documentation about this that isn't an already fixed bug report in gcc?
Maybe I'm confused, but doesn't this power alignment rule mean that the
cc.alignment('double') will always return 8? That computation won't apply the
"subsequent member" rule, and therefore will have an alignment of 8. Which in
turn seems to make this entire change pointless?
> + # Get the alignment values
> + ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
I've previously complained about these av_cv_ variable names. This isn't
autoconf. What is this doing here?
Why do we need a platform specific alignment determination for long, int64?
> + message('Alignment of long : @0@'.format(ac_cv_alignof_long))
> + message('Alignment of double : @0@'.format(ac_cv_alignof_double))
> + message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
These are already going to be output by cc.alignment, this is just redundant,
no?
> + # Start with long
> + alignof_double = ac_cv_alignof_long
> + message('MAX ALIGN ac_cv_alignof_long')
> +
> + # Compare with double
> + if alignof_double < ac_cv_alignof_double
> + alignof_double = ac_cv_alignof_double
> + message('MAX ALIGN ac_cv_alignof_double')
> + endif
> +
> + # Compare with int64_t
> + if alignof_double < ac_cv_alignof_int64_t
> + alignof_double = ac_cv_alignof_int64_t
> + message('MAX ALIGN ac_cv_alignof_int64_t')
> + endif
> +endif
> +message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
This is a lot of output for something that's just computing a maximum of three
variables.
> diff --git a/src/backend/meson.build b/src/backend/meson.build
> index b831a541652..4838f245ab3 100644
> --- a/src/backend/meson.build
> +++ b/src/backend/meson.build
> @@ -125,6 +125,24 @@ if host_system == 'windows'
> '--FILEDESC', 'PostgreSQL Server',])
> endif
>
> +if host_system == 'aix'
> + # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
> + # main executable, allowing extension libraries to resolve their undefined
> + # symbols to symbols in the postgres binary.
> + postgres_imp = custom_target('postgres.imp',
> + command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
> + input: postgres_lib,
> + output: 'postgres.imp',
> + capture: true,
> + install: true,
> + install_dir: dir_lib,
> + build_by_default: false,
> + )
> + backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
> + backend_link_depends += postgres_imp
> +endif
This should be moved next to the msvc specific block (the one about
postgres_def) and should use an elif.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-26 17:45 Tom Lane <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
2 siblings, 1 reply; 73+ messages in thread
From: Tom Lane @ 2026-01-26 17:45 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; +Cc: Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Peter Eisentraut <[email protected]> writes:
> Ok, that patch set looks pretty reasonable now.
> Can you confirm that this is the complete patch set required for AIX
> support?
> What version of AIX are you testing with?
> What compilers are you testing with?
I tried to build HEAD with 0001-Support-for-AIX.pg19.v11.patch
on the GCC compile farm (cfarm119.cfarm.net, which is running
AIX 7.3); I used gcc 13.3.0. I observed the following problems:
* The patch's changes to configure do not match those to configure.ac.
I used configure as-patched, so I don't know if it'd work after
re-running autoconf.
* In my tree, mkldexport.sh was created without execute permissions,
causing a build failure. I see that the patch says
new file mode 100755
so this is arguably the fault of the rather hoary version of
patch(1) that cfarm119 has. I mention it mainly to remind the
eventual committer to make sure mkldexport.sh is committed with
the correct permissions.
* I got this:
In file included from ../../../../src/include/postgres.h:48,
from pgstat_slru.c:18:
pgstat_slru.c:60:11: warning: no previous prototype for 'pgstat_count_slru_truncate64' [-Wmissing-prototypes]
60 | CppConcat(pgstat_count_slru_,stat)(int slru_idx) \
| ^~~~~~~~~~~~~~~~~~
../../../../src/include/c.h:429:41: note: in definition of macro 'CppConcat'
429 | #define CppConcat(x, y) x##y
| ^
pgstat_slru.c:84:1: note: in expansion of macro 'PGSTAT_COUNT_SLRU'
84 | PGSTAT_COUNT_SLRU(truncate)
| ^~~~~~~~~~~~~~~~~
and then
ld: 0711-317 ERROR: Undefined symbol: .pgstat_count_slru_truncate
On investigation, this is happening because <unistd.h> has
#define truncate truncate64
which causes "PGSTAT_COUNT_SLRU(truncate)" to expand as
"pgstat_count_slru_truncate64", which is not the name declared in
pgstat.h. An even more unfortunate result is that the "truncate"
field in PgStat_SLRUStats might actually be named "truncate64",
depending on whether <unistd.h> was read before pgstat.h.
I got around that by partially reverting eccba079c2ea:
diff --git a/src/backend/utils/activity/pgstat_slru.c b/src/backend/utils/activity/pgstat_slru.c
index 2190f388eae..4d8ad3f20fc 100644
--- a/src/backend/utils/activity/pgstat_slru.c
+++ b/src/backend/utils/activity/pgstat_slru.c
@@ -81,7 +81,11 @@ PGSTAT_COUNT_SLRU(blocks_written)
PGSTAT_COUNT_SLRU(flush)
/* pgstat_count_slru_truncate */
-PGSTAT_COUNT_SLRU(truncate)
+void
+pgstat_count_slru_truncate(int slru_idx)
+{
+ get_slru_entry(slru_idx)->truncate += 1;
+}
I didn't have to make any other changes, so it seems that we are
currently consistent about always reading <unistd.h> first, but this
seems terribly fragile. We probably need some more-invasive answer,
like changing both the function and field name to "trunc" or something
like that.
* I also got some warnings:
auth.c: In function 'auth_peer':
auth.c:1877:13: warning: implicit declaration of function 'getpeereid' [-Wimplicit-function-declaration]
1877 | if (getpeereid(port->sock, &uid, &gid) != 0)
pg_locale_libc.c: In function 'wchar2char':
pg_locale_libc.c:1243:26: warning: implicit declaration of function 'wcstombs_l'; did you mean 'wcstombs'? [-Wimplicit-function-declaration]
1243 | result = wcstombs_l(to, from, tolen, loc);
fe-connect.c: In function 'PQconnectPoll':
fe-connect.c:3598:45: warning: implicit declaration of function 'getpeereid'; did you mean 'getpwuid'? [-Wimplicit-function-declaration]
3598 | if (getpeereid(conn->sock, &uid, &gid) != 0)
These did not break the build (so the functions do exist...) but
they need to be fixed.
After all that I was able to get through "make" and "make install",
but testing failed immediately:
bash-5.3$ initdb
exec(): 0509-036 Cannot load program initdb because of the following errors:
0509-022 Cannot load module /home/tgl/testversion/lib/libpq.a(libpq.so.5).
0509-150 Dependent module libgcc_s.a(shr.o) could not be loaded.
0509-022 Cannot load module libgcc_s.a(shr.o).
0509-026 System error: A file or directory in the path name does not exist.
So there's something wrong with the make rules for using libpq.so.
I do not know anything about AIX, so I can't debug this.
I was unable to test the meson patches, because meson isn't installed
on this machine.
I haven't actually read the patch, so don't take this as an
endorsement of the changes otherwise.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-27 16:21 Srirama Kucherlapati <[email protected]>
parent: Tom Lane <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-27 16:21 UTC (permalink / raw)
To: Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; +Cc: [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Hi Tom,
We have tested this patch on our environment, and we see all the basic tests are passing and Postgres binary is up.
ok 226 + eager_aggregate 921 ms
# parallel group (2 tests): oidjoins event_trigger
ok 227 + oidjoins 199 ms
ok 228 + event_trigger 255 ms
ok 229 - event_trigger_login 55 ms
ok 230 - fast_default 207 ms
ok 231 - tablespace 533 ms
1..231
# All 231 tests passed.
We have set the below flags for building the source
export OBJECT_MODE=64
export FLAG64="-maix64"
export CC__=/opt/freeware/bin//gcc-12
export CXX__=/opt/freeware/bin//g++-12
export CC64="${CC__}"
export CFLAGS="${FLAG64} -O2 "
export GLOBAL_CC_OPTIONS="-O2"
export CC="${CC64} "
export LDFLAGS="-L/opt/freeware/lib64 -L/usr/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"
export LDFLAGS=$LDFLAGS:/opt/freeware/lib64/perl5/5.38/CORE/:
export PYTHON=/opt/freeware/bin/python3.9
export AR='/usr/bin/ar -X64’
The patch is build on top of this commit, which is older
commit c581c9a7ac2af2c75567013f25125bd294d49ff2
We are trying to integrate the changes to the latest HEAD
I would like to know if there are any specific environment variables are set on your build machine.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-27 20:26 Tom Lane <[email protected]>
parent: Srirama Kucherlapati <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Tom Lane @ 2026-01-27 20:26 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
Srirama Kucherlapati <[email protected]> writes:
> We have set the below flags for building the source
> export OBJECT_MODE=64
> export FLAG64="-maix64"
> export CC__=/opt/freeware/bin//gcc-12
> export CXX__=/opt/freeware/bin//g++-12
> export CC64="${CC__}"
> export CFLAGS="${FLAG64} -O2 "
> export GLOBAL_CC_OPTIONS="-O2"
> export CC="${CC64} "
> export LDFLAGS="-L/opt/freeware/lib64 -L/usr/lib64 -L/opt/freeware/lib -L/usr/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"
> export LDFLAGS=$LDFLAGS:/opt/freeware/lib64/perl5/5.38/CORE/:
> export PYTHON=/opt/freeware/bin/python3.9
> export AR='/usr/bin/ar -X64’
Ouch. Our normal expectation is that you can build a working
Postgres with nothing more complicated than
./configure && make && make install
(well, maybe you want a nondefault --prefix and some feature
options, but getting to a working executable shouldn't take
much more than that). It's totally not okay to expect users
to preset a bunch of environment variables, especially not if
that requirement appears nowhere in the documentation.
So one TODO item for your patch is to restore (and update)
the AIX-specific portions of the documentation, particularly
the build instructions. But I do not want to see anything as
messy as the above in the build instructions.
After re-reading what used to be in installation.sgml, I'm inclined
to suggest that we just say that only 64-bit builds using gcc are
supported on AIX. Surely the number of users still wanting 32-bit
Postgres on AIX is indistinguishable from zero. Then we could remove
the documentation about likely failure modes of a 32-bit build.
(Also, perhaps we could bake the bits about OBJECT_MODE=64 and -maix64
into the autoconf/meson logic and not burden users with dealing with
those?)
After some digging, I realized that the cause of my build failure with
not finding libgcc_s.a was that you'd removed this stanza that
Makefile.aix used to have:
# when building with gcc, need to make sure that libgcc can be found
ifeq ($(GCC), yes)
libpath := $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
endif
I don't really understand how it works for you without that.
I suppose that your explicit setting of LDFLAGS masked the problem,
but doing that did not work for me, which I found was because our
rpath logic overrides any externally-given -Wl,-blibpath setting.
Were you perhaps building with --disable-rpath? In any case, manually
putting every required directory into LDFLAGS is not sustainable.
There's a reason our makefiles work so hard to build that list
automatically.
In any case, once I put back the missing Makefile.aix bit, I was
able to get a working 64-bit build after doing what installation.sgml
used to tell people:
For a 64-bit build, set <envar>OBJECT_MODE</envar> to 64 and
pass <literal>CC="gcc -maix64"</literal>
to <command>configure</command>.
(It also said to set LDFLAGS="-Wl,-bbigtoc", but that doesn't
seem to be necessary anymore?)
However, my build doesn't pass the core regression tests. There
is one failure in float8.out, which on investigation is because
lgamma(NaN) is failing (returning ERANGE) instead of silently
returning NaN. That behavior is directly contradictory to what
"man lgamma" says, so I guess they fixed it in recent AIX, but we
probably need a workaround for AIXen that are still in the field.
cfarm119 is running a just slightly back-rev AIX:
$ oslevel -s
7300-01-02-2320
With the patch attached, I can get through "make installcheck".
However, I'm unable to attempt "make check-world" because
src/test/modules/test_cplusplusext doesn't compile:
g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fvisibility=hidden -fvisibility-inlines-hidden -I. -I. -I../../../../src/include -c -o test_cplusplusext.o test_cplusplusext.cpp
In file included from ../../../../src/include/c.h:57,
from ../../../../src/include/postgres.h:48,
from test_cplusplusext.cpp:18:
../../../../src/include/pg_config.h:588:24: error: expected unqualified-id before '__int128'
588 | #define PG_INT128_TYPE __int128
| ^~~~~~~~
../../../../src/include/c.h:580:9: note: in expansion of macro 'PG_INT128_TYPE'
580 | typedef PG_INT128_TYPE int128
| ^~~~~~~~~~~~~~
../../../../src/include/pg_config.h:588:24: error: expected unqualified-id before '__int128'
588 | #define PG_INT128_TYPE __int128
| ^~~~~~~~
../../../../src/include/c.h:586:18: note: in expansion of macro 'PG_INT128_TYPE'
586 | typedef unsigned PG_INT128_TYPE uint128
| ^~~~~~~~~~~~~~
make: *** [<builtin>: test_cplusplusext.o] Error 1
| ^~~~~~~~~~~~~~
make[5]: *** [<builtin>: test_cplusplusext.o] Error 1
I poked at trying to fix that, without success. This is a
reasonably late-model g++:
$ g++ --version
g++ (GCC) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
so I don't know why it doesn't like __int128. This is very new code,
so there may be a non-AIX-specific issue for us to fix. (But I
could not reproduce the issue on the nearest version I have at hand,
g++ (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7)
from Fedora 38.)
Another thing I noticed: ps status isn't working. (All the postmaster
child processes look the same in "ps auxww".) I suppose you need to
restore the AIX support in ps_status.c.
FWIW, attached is a delta patch showing where I am now (on top of
your v11 patch and the pgstat_slru.c hack I showed earlier).
regards, tom lane
Attachments:
[text/x-diff] mydelta.patch (1.3K, 2-mydelta.patch)
download | inline diff:
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index b5a7c57e53a..641e7de21a0 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -2852,6 +2852,12 @@ dlgamma(PG_FUNCTION_ARGS)
float8 arg1 = PG_GETARG_FLOAT8(0);
float8 result;
+ /* On some versions of AIX, lgamma(NaN) fails with ERANGE */
+#if defined(_AIX)
+ if (isnan(arg1))
+ PG_RETURN_FLOAT8(arg1);
+#endif
+
/*
* Note: lgamma may not be thread-safe because it may write to a global
* variable signgam, which may not be thread-local. However, this doesn't
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index e91b250fd19..d8d8a4d68b0 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -6,8 +6,11 @@
# -blibpath must contain ALL directories where we should look for libraries
libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
-# AIX uses a stricter, more explicit approach. The runtime linker expects
-# to tell it exactly where to look using -blibpath.
+# when building with gcc, need to make sure that libgcc can be found
+ifeq ($(GCC), yes)
+libpath := $(libpath):$(dir $(shell gcc -print-libgcc-file-name))
+endif
+
rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
# gcc needs to know it's building a shared lib, otherwise it'll not emit
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-27 21:42 Tom Lane <[email protected]>
parent: Tom Lane <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Tom Lane @ 2026-01-27 21:42 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
... btw, I was annoyed to notice that AIX still does this in
64-bit builds:
checking size of void *... 8
checking size of size_t... 8
checking size of long... 8
checking size of long long... 8
checking size of intmax_t... 8
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of int64_t... 8
checking alignment of double... 4
Normally we reject alignof(double) < alignof(int64), for the reasons
explained in configure.ac:
# We require 'double' to have the strictest alignment among the basic types,
# because otherwise the C ABI might impose 8-byte alignment on some of the
# other C types that correspond to TYPALIGN_DOUBLE SQL types. That could
# cause a mismatch between the tuple layout and the C struct layout of a
# catalog tuple. We used to carefully order catalog columns such that any
# fixed-width, attalign=4 columns were at offsets divisible by 8 regardless
# of MAXIMUM_ALIGNOF to avoid that, but we no longer support any platforms
# where TYPALIGN_DOUBLE != MAXIMUM_ALIGNOF.
I see that your patch summarily overrides that restriction (without
bothering to touch this comment), but I fear that the chances of
that being acceptable as-is are zero. We're not going to go back to
having to count bytes every time we change a system catalog rowtype
that involves an 'int8' or 'float8' column.
I think the only way we could deal with this in a maintainable
fashion would be to remove the assumption that int64 and double
have the same alignment requirement. That is tech debt that
we really should have cleaned up years ago anyway. The main
thing that's discouraged people from pursuing it is the fear
of adding overhead to tuple assembly/disassembly loops. But
I think maybe we could avoid adding such overhead by mapping
two different type alignment symbols at the source-code level
into appropriate values at runtime. Or a bunch of conditional
compilation, or whatever. Any modern machine is going to have
to be able to deal with both 4-byte and 8-byte alignment
requirements, it's just a question of which datatypes have
which requirement.
While I don't foresee that being an enormous patch, it's not trivial
either. I'd encourage you to write and submit it as a separate patch
rather than something directly tied to the AIX-restoration patch.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-27 21:50 Tom Lane <[email protected]>
parent: Tom Lane <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: Tom Lane @ 2026-01-27 21:50 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
I wrote:
> With the patch attached, I can get through "make installcheck".
> However, I'm unable to attempt "make check-world" because
> src/test/modules/test_cplusplusext doesn't compile:
Ah, I figured out that bit: g++ will take this if you specify -maix64
to it too. The built module would not have worked anyway without
that, since it'd be 32-bit (AFAICT neither gcc nor g++ react to
the OBJECT_MODE environment variable).
It's not exactly clear why gcc will accept __int128 in 32-bit mode
while g++ won't, but that seems like another good reason to decide
that we won't support 32-bit builds on AIX anymore.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-28 10:25 Aditya Kamath <[email protected]>
parent: Andres Freund <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Aditya Kamath @ 2026-01-28 10:25 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; +Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Hi Andrew,
Thank you for your review comments for AIX so far.
While we are working on the rest of the comments you had sent here is our explanation for using the '-D_H_FLOAT’ flag in the source directory meson.build file.
>> + # This flag is required to make sure the user spefic float.h is
>> + # picked instead of the system float.h header file, which doesnot
>> + # have definition like float8, etc
>> + cflags += '-D_H_FLOAT’
>I don't understand this one - how does defining _H_FLOAT lead to a >different
>header being picked? Also, float8 is defined in c.h, so it hardly could >be
>influenced by a system float.h header?
>Our float.h header is only included as "utils/float.h", so it really >shouldn’t
>be confused with a system header?
So If we do not use the flag the error we get is as follows,
FAILED: src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o
gcc -Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils -I../src/include/utils -Isrc/include -I../src/include -I/opt/freeware/include -I/opt/freeware/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation -maix64 -fPIC -pthread -DBUILDING_DLL1233 -MD -MQ src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -MF src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o.d -o src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -c ../src/backend/utils/activity/wait_event_funcs.c
In file included from /usr/include/sys/limits.h:307,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/include-fixed/stdio.h:589,
from ../src/include/c.h:65,
from ../src/include/postgres.h:48,
from ../src/backend/utils/activity/wait_event_funcs.c:15:
../src/include/utils/float.h:28:19: error: expected ';' before 'int'
28 | extern PGDLLIMPORT int extra_float_digits;
../src/include/utils/float.h:289:37: error: unknown type name 'float4'
289 | float4_min(const float4 val1, const float4 val2)
../src/include/utils/float.h:294:15: error: unknown type name 'float8'
294 | static inline float8
The reason this happened is because -I../src/include/utils argument in the command included the float.h header first before the ./src/include/c.h header of postgresql which actually has the
PGDLLIMPORT, float4 and float8 definitions.
So, the header files have mismatched in the order they are processed. If we eliminate -I../src/include/utils in the command, then it will work.
But that will not happen automatically since we use include_directories() everywhere which adds both the source and the build directory includes. If we can get meson to not use
-I../src/include/ in AIX while including headers we will be able to compile.
We are currently experimenting with implicit_include_directories from the document below to see if we can remove the same
https://mesonbuild.com/Include-directories.html.
Reason for -D_H_FLOAT
This prevents AIX libc’s float.h to be included via c.h -> stdio.h -> limits.h -> float.h. The real problem is header include order in AIX. Compiler sees src/include/utils/float.h first and then c.h. This is a problem. When this flag is set, AIX’s float.h is skipped causing system header include chain to change. AIX no longer injects float.h early which results in c.h included before utils/float.h. the way Postgres expects.
Let us know what you think.
Is there a preferred or cleaner way you know to ensure the correct include ordering like using implicit_include_directories so that utils/float.h is not included before c.h?
Have a nice day ahead.
Thanks and regards,
Aditya.
From: Srirama Kucherlapati <[email protected]>
Date: Wednesday, 28 January 2026 at 9:34 AM
To: Aditya Kamath <[email protected]>
Subject: FW: [EXTERNAL] Re: AIX support
FYI
Warm regards,
Sriram.
------------------------------------------
VIOS/SSP Development,
ISDL, IBM India Pvt Ltd.
From: Andres Freund <[email protected]>
Date: Monday, 26 January 2026 at 21:11
To: Srirama Kucherlapati <[email protected]>
Cc: Peter Eisentraut <[email protected]>, [email protected] <[email protected]>, Heikki Linnakangas <[email protected]>, Tristan Partin <[email protected]>, AIX PG user <[email protected]>
Subject: [EXTERNAL] Re: AIX support
Hi,
From what I can tell the meson patch *AGAIN* is missing mkldexport.sh. Also,
you seem to reference the script as files('port/aix/mkldexport.sh'), but that
that's not a path that makes sense for our source code structure (nor where
the "complete" patch adds it).
You really need to actually start testing your patches.
Doesn't the meson patch also require the changes to src/tools/gen_export.pl?
On 2026-01-23 16:11:25 +0000, Srirama Kucherlapati wrote:
> diff --git a/meson.build b/meson.build
> index 6e7ddd74683..17ad9c6ca32 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -198,6 +198,8 @@ endif
> # that purpose.
> portname = host_system
>
> +dep_static_lib = declare_dependency()
Add a comment saying something like
# In some configurations we don't want to install static libraries. For those
# dep_static_lib can be set to disabler() below.
The introduction of dep_static_lib should be broken out into its own patch.
> + # This flag is required to make sure the user spefic float.h is
> + # picked instead of the system float.h header file, which doesnot
> + # have definition like float8, etc
> + cflags += '-D_H_FLOAT'
I don't understand this one - how does defining _H_FLOAT lead to a different
header being picked? Also, float8 is defined in c.h, so it hardly could be
influenced by a system float.h header?
Our float.h header is only included as "utils/float.h", so it really shouldn't
be confused with a system header?
> @@ -1765,10 +1793,49 @@ endforeach
> # as long, char, short, or int. Note that we intentionally do not consider
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> -alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +if host_system != 'aix'
> + alignof_double = cdata.get('ALIGNOF_DOUBLE')
> + if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> + error('alignment of int64_t is greater than the alignment of double')
> + endif
> +else
> + # The AIX 'power' alignment rules apply the natural alignment of the "first
> + # member" if it is of a floating-point data type (or is an aggregate whose
> + # recursively "first" member or element is such a type). The alignment
> + # associated with these types for subsequent members use an alignment value
> + # where the floating-point data type is considered to have 4-byte alignment.
> + # More info
> + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
> + #
> + # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
> + # alignement across platforms the max alignment of long should be considered.
How are these "AIX 'power' alignment rules" for float not just completely
broken?
I assume this means that 4 byte aligned floats work just fine, but have
degraded peformance?
Is there documentation about this that isn't an already fixed bug report in gcc?
Maybe I'm confused, but doesn't this power alignment rule mean that the
cc.alignment('double') will always return 8? That computation won't apply the
"subsequent member" rule, and therefore will have an alignment of 8. Which in
turn seems to make this entire change pointless?
> + # Get the alignment values
> + ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
I've previously complained about these av_cv_ variable names. This isn't
autoconf. What is this doing here?
Why do we need a platform specific alignment determination for long, int64?
> + message('Alignment of long : @0@'.format(ac_cv_alignof_long))
> + message('Alignment of double : @0@'.format(ac_cv_alignof_double))
> + message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
These are already going to be output by cc.alignment, this is just redundant,
no?
> + # Start with long
> + alignof_double = ac_cv_alignof_long
> + message('MAX ALIGN ac_cv_alignof_long')
> +
> + # Compare with double
> + if alignof_double < ac_cv_alignof_double
> + alignof_double = ac_cv_alignof_double
> + message('MAX ALIGN ac_cv_alignof_double')
> + endif
> +
> + # Compare with int64_t
> + if alignof_double < ac_cv_alignof_int64_t
> + alignof_double = ac_cv_alignof_int64_t
> + message('MAX ALIGN ac_cv_alignof_int64_t')
> + endif
> +endif
> +message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
This is a lot of output for something that's just computing a maximum of three
variables.
> diff --git a/src/backend/meson.build b/src/backend/meson.build
> index b831a541652..4838f245ab3 100644
> --- a/src/backend/meson.build
> +++ b/src/backend/meson.build
> @@ -125,6 +125,24 @@ if host_system == 'windows'
> '--FILEDESC', 'PostgreSQL Server',])
> endif
>
> +if host_system == 'aix'
> + # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
> + # main executable, allowing extension libraries to resolve their undefined
> + # symbols to symbols in the postgres binary.
> + postgres_imp = custom_target('postgres.imp',
> + command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
> + input: postgres_lib,
> + output: 'postgres.imp',
> + capture: true,
> + install: true,
> + install_dir: dir_lib,
> + build_by_default: false,
> + )
> + backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
> + backend_link_depends += postgres_imp
> +endif
This should be moved next to the msvc specific block (the one about
postgres_def) and should use an elif.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-28 15:20 Aditya Kamath <[email protected]>
parent: Aditya Kamath <[email protected]>
0 siblings, 2 replies; 73+ messages in thread
From: Aditya Kamath @ 2026-01-28 15:20 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; +Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Hi Andres,
I can explain this differently as well.
We know that include_directories property in meson will include the source and the build directory in the command. Ex: If we give “src/include” then “-Isrc/include” and “-I../src/include” are added.
>> + # This flag is required to make sure the user spefic float.h is
>> + # picked instead of the system float.h header file, which doesnot
>> + # have definition like float8, etc
>> + cflags += '-D_H_FLOAT’
>I don't understand this one - how does defining _H_FLOAT lead to a >different
>header being picked?
Below is the error message we get in AIX if we do not use '-D_H_FLOAT’
FAILED: src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o
gcc -Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils -I../src/include/utils -Isrc/include -I../src/include -I/opt/freeware/include -I/opt/freeware/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation -maix64 -fPIC -pthread -DBUILDING_DLL1233 -MD -MQ
./src/include/utils/float.h:28:19: error: expected ';' before 'int'
28 | extern PGDLLIMPORT int extra_float_digits;
There is a clear missing of float.h definitions, the reason being float.h got included before "src/include/c.h”.
Kindly observe the command "-I../src/include/utils” flag came in the front.
Now in c.h when stdio.h is called in AIX at line 65, then AIX system limits.h is called and then within that AIX system float.h is called.
But here is the catch. It won’t pick the AIX system float.h. It will pick the Postgres "src/include/utilsfloat.h”.
The reason being the compiler is designed to pick what comes first in -I flag. One proof of that is here. https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html
I am assuming all systems behave like this.
This is the root cause of the problem. That "-I../src/include/utils” which meson adds.
So now "src/include/utils/float.h”.is picked up first even before "src/include/c.h”.
That is why we saw the error. When we define “_H_FLOAT” we essentially force the system header to be ignored in the system limits.h where it is called and then the Postgres "src/include/utils/float.h” takes over.
Hope this explains Andres.
There are multiple things we can do here.
One being define “_H_FLOAT”
The other being use #include_next float.h under ifdef _AIX guard
The third we are experimenting is to have implicit_include_directories: false as per document here https://mesonbuild.com/Include-directories.html, but that might difficult since recursive include directories exists in Postgres.
Kindly let us know if this explanation helps and what you think. Also If there is a preferred or cleaner way you know let us know.
Have a nice day ahead.
Thanks and regards,
Aditya.
From: Aditya Kamath <[email protected]>
Date: Wednesday, 28 January 2026 at 3:55 PM
To: Srirama Kucherlapati <[email protected]>, [email protected] <[email protected]>, [email protected] <[email protected]>
Cc: [email protected] <[email protected]>, [email protected] <[email protected]>, [email protected] <[email protected]>, [email protected] <[email protected]>
Subject: Re: [EXTERNAL] Re: AIX support
Hi Andrew,
Thank you for your review comments for AIX so far.
While we are working on the rest of the comments you had sent here is our explanation for using the '-D_H_FLOAT’ flag in the source directory meson.build file.
>> + # This flag is required to make sure the user spefic float.h is
>> + # picked instead of the system float.h header file, which doesnot
>> + # have definition like float8, etc
>> + cflags += '-D_H_FLOAT’
>I don't understand this one - how does defining _H_FLOAT lead to a >different
>header being picked? Also, float8 is defined in c.h, so it hardly could >be
>influenced by a system float.h header?
>Our float.h header is only included as "utils/float.h", so it really >shouldn’t
>be confused with a system header?
So If we do not use the flag the error we get is as follows,
FAILED: src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o
gcc -Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils -I../src/include/utils -Isrc/include -I../src/include -I/opt/freeware/include -I/opt/freeware/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation -maix64 -fPIC -pthread -DBUILDING_DLL1233 -MD -MQ src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -MF src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o.d -o src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -c ../src/backend/utils/activity/wait_event_funcs.c
In file included from /usr/include/sys/limits.h:307,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/include-fixed/stdio.h:589,
from ../src/include/c.h:65,
from ../src/include/postgres.h:48,
from ../src/backend/utils/activity/wait_event_funcs.c:15:
../src/include/utils/float.h:28:19: error: expected ';' before 'int'
28 | extern PGDLLIMPORT int extra_float_digits;
../src/include/utils/float.h:289:37: error: unknown type name 'float4'
289 | float4_min(const float4 val1, const float4 val2)
../src/include/utils/float.h:294:15: error: unknown type name 'float8'
294 | static inline float8
The reason this happened is because -I../src/include/utils argument in the command included the float.h header first before the ./src/include/c.h header of postgresql which actually has the
PGDLLIMPORT, float4 and float8 definitions.
So, the header files have mismatched in the order they are processed. If we eliminate -I../src/include/utils in the command, then it will work.
But that will not happen automatically since we use include_directories() everywhere which adds both the source and the build directory includes. If we can get meson to not use
-I../src/include/ in AIX while including headers we will be able to compile.
We are currently experimenting with implicit_include_directories from the document below to see if we can remove the same
https://mesonbuild.com/Include-directories.html.
Reason for -D_H_FLOAT
This prevents AIX libc’s float.h to be included via c.h -> stdio.h -> limits.h -> float.h. The real problem is header include order in AIX. Compiler sees src/include/utils/float.h first and then c.h. This is a problem. When this flag is set, AIX’s float.h is skipped causing system header include chain to change. AIX no longer injects float.h early which results in c.h included before utils/float.h. the way Postgres expects.
Let us know what you think.
Is there a preferred or cleaner way you know to ensure the correct include ordering like using implicit_include_directories so that utils/float.h is not included before c.h?
Have a nice day ahead.
Thanks and regards,
Aditya.
From: Srirama Kucherlapati <[email protected]>
Date: Wednesday, 28 January 2026 at 9:34 AM
To: Aditya Kamath <[email protected]>
Subject: FW: [EXTERNAL] Re: AIX support
FYI
Warm regards,
Sriram.
------------------------------------------
VIOS/SSP Development,
ISDL, IBM India Pvt Ltd.
From: Andres Freund <[email protected]>
Date: Monday, 26 January 2026 at 21:11
To: Srirama Kucherlapati <[email protected]>
Cc: Peter Eisentraut <[email protected]>, [email protected] <[email protected]>, Heikki Linnakangas <[email protected]>, Tristan Partin <[email protected]>, AIX PG user <[email protected]>
Subject: [EXTERNAL] Re: AIX support
Hi,
From what I can tell the meson patch *AGAIN* is missing mkldexport.sh. Also,
you seem to reference the script as files('port/aix/mkldexport.sh'), but that
that's not a path that makes sense for our source code structure (nor where
the "complete" patch adds it).
You really need to actually start testing your patches.
Doesn't the meson patch also require the changes to src/tools/gen_export.pl?
On 2026-01-23 16:11:25 +0000, Srirama Kucherlapati wrote:
> diff --git a/meson.build b/meson.build
> index 6e7ddd74683..17ad9c6ca32 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -198,6 +198,8 @@ endif
> # that purpose.
> portname = host_system
>
> +dep_static_lib = declare_dependency()
Add a comment saying something like
# In some configurations we don't want to install static libraries. For those
# dep_static_lib can be set to disabler() below.
The introduction of dep_static_lib should be broken out into its own patch.
> + # This flag is required to make sure the user spefic float.h is
> + # picked instead of the system float.h header file, which doesnot
> + # have definition like float8, etc
> + cflags += '-D_H_FLOAT'
I don't understand this one - how does defining _H_FLOAT lead to a different
header being picked? Also, float8 is defined in c.h, so it hardly could be
influenced by a system float.h header?
Our float.h header is only included as "utils/float.h", so it really shouldn't
be confused with a system header?
> @@ -1765,10 +1793,49 @@ endforeach
> # as long, char, short, or int. Note that we intentionally do not consider
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> -alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +if host_system != 'aix'
> + alignof_double = cdata.get('ALIGNOF_DOUBLE')
> + if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> + error('alignment of int64_t is greater than the alignment of double')
> + endif
> +else
> + # The AIX 'power' alignment rules apply the natural alignment of the "first
> + # member" if it is of a floating-point data type (or is an aggregate whose
> + # recursively "first" member or element is such a type). The alignment
> + # associated with these types for subsequent members use an alignment value
> + # where the floating-point data type is considered to have 4-byte alignment.
> + # More info
> + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99557
> + #
> + # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
> + # alignement across platforms the max alignment of long should be considered.
How are these "AIX 'power' alignment rules" for float not just completely
broken?
I assume this means that 4 byte aligned floats work just fine, but have
degraded peformance?
Is there documentation about this that isn't an already fixed bug report in gcc?
Maybe I'm confused, but doesn't this power alignment rule mean that the
cc.alignment('double') will always return 8? That computation won't apply the
"subsequent member" rule, and therefore will have an alignment of 8. Which in
turn seems to make this entire change pointless?
> + # Get the alignment values
> + ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
I've previously complained about these av_cv_ variable names. This isn't
autoconf. What is this doing here?
Why do we need a platform specific alignment determination for long, int64?
> + message('Alignment of long : @0@'.format(ac_cv_alignof_long))
> + message('Alignment of double : @0@'.format(ac_cv_alignof_double))
> + message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
These are already going to be output by cc.alignment, this is just redundant,
no?
> + # Start with long
> + alignof_double = ac_cv_alignof_long
> + message('MAX ALIGN ac_cv_alignof_long')
> +
> + # Compare with double
> + if alignof_double < ac_cv_alignof_double
> + alignof_double = ac_cv_alignof_double
> + message('MAX ALIGN ac_cv_alignof_double')
> + endif
> +
> + # Compare with int64_t
> + if alignof_double < ac_cv_alignof_int64_t
> + alignof_double = ac_cv_alignof_int64_t
> + message('MAX ALIGN ac_cv_alignof_int64_t')
> + endif
> +endif
> +message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
This is a lot of output for something that's just computing a maximum of three
variables.
> diff --git a/src/backend/meson.build b/src/backend/meson.build
> index b831a541652..4838f245ab3 100644
> --- a/src/backend/meson.build
> +++ b/src/backend/meson.build
> @@ -125,6 +125,24 @@ if host_system == 'windows'
> '--FILEDESC', 'PostgreSQL Server',])
> endif
>
> +if host_system == 'aix'
> + # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
> + # main executable, allowing extension libraries to resolve their undefined
> + # symbols to symbols in the postgres binary.
> + postgres_imp = custom_target('postgres.imp',
> + command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
> + input: postgres_lib,
> + output: 'postgres.imp',
> + capture: true,
> + install: true,
> + install_dir: dir_lib,
> + build_by_default: false,
> + )
> + backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
> + backend_link_depends += postgres_imp
> +endif
This should be moved next to the msvc specific block (the one about
postgres_def) and should use an elif.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-28 15:25 Robert Haas <[email protected]>
parent: Andres Freund <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: Robert Haas @ 2026-01-28 15:25 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Srirama Kucherlapati <[email protected]>; Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
On Mon, Jan 26, 2026 at 10:41 AM Andres Freund <[email protected]> wrote:
> You really need to actually start testing your patches.
+1. The quality of the patches posted to this thread is very
noticeably lower than what we typically expect or accept. They are
missing files, or they don't work, or the changes are not properly
explained, or they do things that are clearly unlike anything else we
do anywhere in the source tree, or they change how things work for
other platforms rather than just being AIX-specific, or they don't
work unless you follow a bunch of undocumented steps, or whatever the
case may be.
--
Robert Haas
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-28 15:41 Robert Haas <[email protected]>
parent: Aditya Kamath <[email protected]>
1 sibling, 1 reply; 73+ messages in thread
From: Robert Haas @ 2026-01-28 15:41 UTC (permalink / raw)
To: Aditya Kamath <[email protected]>; +Cc: Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
On Wed, Jan 28, 2026 at 10:20 AM Aditya Kamath <[email protected]> wrote:
> But here is the catch. It won’t pick the AIX system float.h. It will pick the Postgres "src/include/utilsfloat.h”.
PostgreSQL's header should always be included as "utils/float.h" and
the system header should always be included as "float.h" (or, well,
<float.h>, presumably). So this confusion should not exist unless the
include paths are messed up. It doesn't seem correct to me that the
include path includes src/include/utils rather than just src/include,
but I see the same thing here:
"command": "ccache clang
-Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils
-I../pgsql/src/include/utils -Isrc/include -I../pgsql/src/include
-I/opt/local/include -I/opt/local/include/libxml2
-I/opt/local/libexec/openssl3/include -fdiagnostics-color=always -Wall
-Winvalid-pch -O2 -g -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wmissing-prototypes -Wpointer-arith -Werror=vla
-Werror=unguarded-availability-new -Wendif-labels
-Wmissing-format-attribute -Wcast-function-type -Wformat-security
-Wdeclaration-after-statement -Wmissing-variable-declarations
-Wno-unused-command-line-argument -Wno-compound-token-split-by-macro
-Wno-format-truncation -Wno-cast-function-type-strict -DBUILDING_DLL
-MD -MQ src/backend/utils/activity/wait_event_names.a.p/wait_event.c.o
-MF src/backend/utils/activity/wait_event_names.a.p/wait_event.c.o.d
-o src/backend/utils/activity/wait_event_names.a.p/wait_event.c.o -c
../pgsql/src/backend/utils/activity/wait_event.c",
which happens because of:
wait_event = static_library('wait_event_names',
waitevent_sources,
dependencies: [backend_code],
include_directories: include_directories('../../../include/utils'),
kwargs: internal_lib_args,
)
which happens because wait_event_funcs.c contains:
#include "wait_event_funcs_data.c"
and for some reason, that file gets placed in src/include/utils.
The attached patch, which also adjusts wait_events.c, fixes it for me.
This is kind of a good example of how you are not pursuing your goals
here in the best way possible. The issue here is legitimate, in the
sense that including src/include/utils in the include path for some
file doesn't seem legit to me. But fixing that problem by defining,
just on AIX, the same symbol that the system header defines seems like
clearly the wrong fix. What if we needed to include the actual float.h
somewhere? What if the problem also occurred on some other platform?
Please put a bit more thought into the right ways to (1) describe the
things you find to us and (2) fix them.
Thanks,
--
Robert Haas
EDB: http://www.enterprisedb.com
Attachments:
[application/octet-stream] dont-include-include-utils.patch (1.3K, 2-dont-include-include-utils.patch)
download | inline diff:
diff --git a/src/backend/utils/activity/meson.build b/src/backend/utils/activity/meson.build
index 9f48d5970e1..53bd5a246ca 100644
--- a/src/backend/utils/activity/meson.build
+++ b/src/backend/utils/activity/meson.build
@@ -30,7 +30,6 @@ waitevent_sources = files(
wait_event = static_library('wait_event_names',
waitevent_sources,
dependencies: [backend_code],
- include_directories: include_directories('../../../include/utils'),
kwargs: internal_lib_args,
)
diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c
index e4f2c440257..aca2c8fc742 100644
--- a/src/backend/utils/activity/wait_event.c
+++ b/src/backend/utils/activity/wait_event.c
@@ -503,4 +503,4 @@ pgstat_get_wait_event(uint32 wait_event_info)
return event_name;
}
-#include "pgstat_wait_event.c"
+#include "utils/pgstat_wait_event.c"
diff --git a/src/backend/utils/activity/wait_event_funcs.c b/src/backend/utils/activity/wait_event_funcs.c
index b62ee83ef73..fa10a80b088 100644
--- a/src/backend/utils/activity/wait_event_funcs.c
+++ b/src/backend/utils/activity/wait_event_funcs.c
@@ -31,7 +31,7 @@ static const struct
waitEventData[] =
{
-#include "wait_event_funcs_data.c"
+#include "utils/wait_event_funcs_data.c"
/* end of list */
{NULL, NULL, NULL}
};
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-28 17:33 Andres Freund <[email protected]>
parent: Robert Haas <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Andres Freund @ 2026-01-28 17:33 UTC (permalink / raw)
To: Robert Haas <[email protected]>; Michael Paquier <[email protected]>; +Cc: Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Hi,
On 2026-01-28 10:41:52 -0500, Robert Haas wrote:
> On Wed, Jan 28, 2026 at 10:20 AM Aditya Kamath <[email protected]> wrote:
> > But here is the catch. It won’t pick the AIX system float.h. It will pick the Postgres "src/include/utilsfloat.h”.
>
> PostgreSQL's header should always be included as "utils/float.h" and
> the system header should always be included as "float.h" (or, well,
> <float.h>, presumably). So this confusion should not exist unless the
> include paths are messed up. It doesn't seem correct to me that the
> include path includes src/include/utils rather than just src/include,
> but I see the same thing here:
I agree that this is wrong.
CCing Michael and Bertrand, they added this in fa88928470b5 and 1e68e43d3f0f.
> which happens because of:
>
> wait_event = static_library('wait_event_names',
> waitevent_sources,
> dependencies: [backend_code],
> include_directories: include_directories('../../../include/utils'),
> kwargs: internal_lib_args,
> )
>
> which happens because wait_event_funcs.c contains:
>
> #include "wait_event_funcs_data.c"
>
> and for some reason, that file gets placed in src/include/utils.
The reason for that is that the same invocation also generates
wait_event_types.h, which is included by other headers.
> The attached patch, which also adjusts wait_events.c, fixes it for me.
Unfortunately I suspect that'll cause issues with make builds, because there
the files are generated in a different place (src/backend/activity) and then
only wait_event_types.h is copied to src/include. So including the files as
utils/ won't work.
I'd fix that aspect by doing the same thing in the autoconf build as we do in
meson, i.e. keep the file in the include dir. We already do that e.g. for
guc_tables.inc.c, see this src/backend/utils/Makefile stanza:
# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than fmgr-stamp.
$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c
cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c; do \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
Alternatively: I'm not a fan of including .c files that are not actually
working C. You could just make wait_event_funcs_data.c be a complete C file,
defining waitEventData, that is then built as a standalone file.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-29 01:36 Tom Lane <[email protected]>
parent: Tom Lane <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Tom Lane @ 2026-01-29 01:36 UTC (permalink / raw)
To: Srirama Kucherlapati <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>
I wrote:
> I think the only way we could deal with this in a maintainable
> fashion would be to remove the assumption that int64 and double
> have the same alignment requirement. That is tech debt that
> we really should have cleaned up years ago anyway.
In hopes of moving this effort along, I've posted a draft patch
for that part here:
https://www.postgresql.org/message-id/1127261.1769649624%40sss.pgh.pa.us
We are running out of time to make this happen for v19, so
I suggest focusing your effort if you don't want to see
AIX support slide for another year.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-01-29 03:43 Srirama Kucherlapati <[email protected]>
parent: Tom Lane <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Srirama Kucherlapati @ 2026-01-29 03:43 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; [email protected] <[email protected]>; Heikki Linnakangas <[email protected]>; Tristan Partin <[email protected]>; AIX PG user <[email protected]>; Aditya Kamath <[email protected]>
> In hopes of moving this effort along, I've posted a draft patch
> for that part here:
Thanks Tom, for your support and suggestions we are working on the addressing the review comments. I will integrate the patch with our changes and will update you.
Warm regards,
Sriram.
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-29 23:24 Michael Paquier <[email protected]>
parent: Andres Freund <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Michael Paquier @ 2026-01-29 23:24 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Robert Haas <[email protected]>; Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
On Wed, Jan 28, 2026 at 12:33:01PM -0500, Andres Freund wrote:
> Unfortunately I suspect that'll cause issues with make builds, because there
> the files are generated in a different place (src/backend/activity) and then
> only wait_event_types.h is copied to src/include. So including the files as
> utils/ won't work.
Sorry for the crickets and the delay in replying.
> I'd fix that aspect by doing the same thing in the autoconf build as we do in
> meson, i.e. keep the file in the include dir. We already do that e.g. for
> guc_tables.inc.c, see this src/backend/utils/Makefile stanza:
>
> # These generated headers must be symlinked into src/include/.
> # We use header-stamp to record that we've done this because the symlinks
> # themselves may appear older than fmgr-stamp.
> $(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c
> cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c; do \
> rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
> done
> touch $@
Yeah, using this route would be sensible, removing the trick with the
incorrect include dir. Let me a couple of hours to see if I can sort
out a patch..
Should any of these be backpatched, actually? Based on the lack of
complaints, it does not seem so to me, but if we are targetting a
backpatch of the AIX port, that would be required.
> Alternatively: I'm not a fan of including .c files that are not actually
> working C. You could just make wait_event_funcs_data.c be a complete C file,
> defining waitEventData, that is then built as a standalone file.
FWIW, that does not strike me as an issue. We do some of that already
in src/backend/nodes/ for the switch files. It comes down to simpler
scripts generating the code.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, 2-signature.asc)
download
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-29 23:48 Tom Lane <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Tom Lane @ 2026-01-29 23:48 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Robert Haas <[email protected]>; Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Michael Paquier <[email protected]> writes:
> Should any of these be backpatched, actually? Based on the lack of
> complaints, it does not seem so to me, but if we are targetting a
> backpatch of the AIX port, that would be required.
There's no plan to backpatch the AIX port ... but if we can clean
up this include-path mess not too invasively, I think it might be
a good idea to back-patch that much. I'm concerned that confusion
between <float.h> and utils/float.h might be a problem on other
platforms too.
regards, tom lane
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-30 04:38 Michael Paquier <[email protected]>
parent: Tom Lane <[email protected]>
0 siblings, 1 reply; 73+ messages in thread
From: Michael Paquier @ 2026-01-30 04:38 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Robert Haas <[email protected]>; Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
On Thu, Jan 29, 2026 at 06:48:37PM -0500, Tom Lane wrote:
> Michael Paquier <[email protected]> writes:
>> Should any of these be backpatched, actually? Based on the lack of
>> complaints, it does not seem so to me, but if we are targetting a
>> backpatch of the AIX port, that would be required.
>
> There's no plan to backpatch the AIX port ... but if we can clean
> up this include-path mess not too invasively, I think it might be
> a good idea to back-patch that much. I'm concerned that confusion
> between <float.h> and utils/float.h might be a problem on other
> platforms too.
Noted. Attached is the patch I am finishing with, tested with meson
and configure/make with and without VPATH.
While looking at the whole object dependency tree in the builds, I
have settled down to a reuse of the same logic as guc_tables.inc.c for
configure/make, by pushing down one level the generation of the three
wait event files. These are not anymore saved in
src/backend/utils/activity/, just src/backend/utils/, including them
under header-stamp. Building directly in src/backend/utils/activity/
also works, with two rules in src/backend/utils/activity/Makefile to
force a rebuild. The files are then included as if they were in
include/utils/, with the generation of links from src/backend/utils/
to src/include/utils/, just like guc_tables.inc.c. That's the least
invasive method I could come up with.
I have run out of tokens for the CI this month, so I have not been
able to check it there. My manual tests across all three build
methods are working.
--
Michael
Attachments:
[text/x-diff] 0001-Fix-incorrect-generation-of-wait-event-files.patch (9.1K, 2-0001-Fix-incorrect-generation-of-wait-event-files.patch)
download | inline diff:
From 08916ab93b47bb87936afce9ae5fcc46dc2070dc Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Fri, 30 Jan 2026 13:25:29 +0900
Subject: [PATCH] Fix incorrect generation of wait-event files
In a meson build, include/utils was incorrectly listed in the set of
include_directories. This would conflict with the headers pulled in by
an environment. This issue has not been an issue in the buildfarm; it
has been noted with AIX and a conflict with float.h.
Combo oversight in fa88928470b5 and 1e68e43d3f0f.
blah, blah..
Discussion: https://postgr.es/m/vua2n6svb6fac3fmz42ahqxndmgbgor7vpxtemis5evasfpzb3@ogs4ewexkpjm
Backpatch-through: 17
---
src/include/Makefile | 1 +
src/include/utils/.gitignore | 2 ++
src/backend/Makefile | 10 +---------
src/backend/utils/.gitignore | 3 +++
src/backend/utils/Makefile | 13 ++++++++++---
src/backend/utils/activity/.gitignore | 3 ---
src/backend/utils/activity/Makefile | 17 ++++-------------
src/backend/utils/activity/meson.build | 1 -
src/backend/utils/activity/wait_event.c | 2 +-
src/backend/utils/activity/wait_event_funcs.c | 2 +-
10 files changed, 23 insertions(+), 31 deletions(-)
delete mode 100644 src/backend/utils/activity/.gitignore
diff --git a/src/include/Makefile b/src/include/Makefile
index 4ef060e90503..ac673f4cf17b 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -105,6 +105,7 @@ uninstall:
clean:
rm -f utils/fmgroids.h utils/fmgrprotos.h utils/guc_tables.inc.c utils/errcodes.h utils/header-stamp
+ rm -f utils/pgstat_wait_event.c utils/wait_event_funcs_data.c
rm -f storage/lwlocknames.h utils/probes.h utils/wait_event_types.h
rm -f nodes/nodetags.h nodes/header-stamp
$(MAKE) -C catalog clean
diff --git a/src/include/utils/.gitignore b/src/include/utils/.gitignore
index 30f921429c6f..ff6f61cd7ee7 100644
--- a/src/include/utils/.gitignore
+++ b/src/include/utils/.gitignore
@@ -4,4 +4,6 @@
/probes.h
/errcodes.h
/header-stamp
+/pgstat_wait_event.c
+/wait_event_funcs_data.c
/wait_event_types.h
diff --git a/src/backend/Makefile b/src/backend/Makefile
index baa9b05d0211..05642dc02e39 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -136,9 +136,6 @@ parser/gram.h: parser/gram.y
storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl ../include/storage/lwlocklist.h utils/activity/wait_event_names.txt
$(MAKE) -C storage/lmgr lwlocknames.h
-utils/activity/wait_event_types.h: utils/activity/generate-wait_event_types.pl utils/activity/wait_event_names.txt
- $(MAKE) -C utils/activity wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
-
# run this unconditionally to avoid needing to know its dependencies here:
submake-catalog-headers:
$(MAKE) -C ../include/catalog generated-headers
@@ -163,18 +160,13 @@ submake-utils-headers:
.PHONY: generated-headers
-generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/wait_event_types.h submake-catalog-headers submake-nodes-headers submake-utils-headers parser/gram.h
+generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h submake-catalog-headers submake-nodes-headers submake-utils-headers parser/gram.h
$(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" .
-$(top_builddir)/src/include/utils/wait_event_types.h: utils/activity/wait_event_types.h
- prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
- cd '$(dir $@)' && rm -f $(notdir $@) && \
- $(LN_S) "$$prereqdir/$(notdir $<)" .
-
utils/probes.o: utils/probes.d $(SUBDIROBJS)
$(DTRACE) $(DTRACEFLAGS) -C -G -s $(call expand_subsys,$^) -o $@
diff --git a/src/backend/utils/.gitignore b/src/backend/utils/.gitignore
index 303c01d05151..fa9cfb39693d 100644
--- a/src/backend/utils/.gitignore
+++ b/src/backend/utils/.gitignore
@@ -5,3 +5,6 @@
/guc_tables.inc.c
/probes.h
/errcodes.h
+/pgstat_wait_event.c
+/wait_event_funcs_data.c
+/wait_event_types.h
diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index 6df31504f328..81b4a956bda3 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -43,7 +43,7 @@ generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp submak
submake-adt-headers:
$(MAKE) -C adt jsonpath_gram.h
-$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h guc_tables.inc.c
+$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h
# fmgr-stamp records the last time we ran Gen_fmgrtab.pl. We don't rely on
# the timestamps of the individual output files, because the Perl script
@@ -58,6 +58,12 @@ errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
guc_tables.inc.c: $(top_srcdir)/src/backend/utils/misc/guc_parameters.dat $(top_srcdir)/src/backend/utils/misc/gen_guc_tables.pl
$(PERL) $(top_srcdir)/src/backend/utils/misc/gen_guc_tables.pl $< $@
+pgstat_wait_event.c: wait_event_types.h
+wait_event_funcs_data.c: wait_event_types.h
+
+wait_event_types.h: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
+ $(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --code $<
+
ifeq ($(enable_dtrace), yes)
probes.h: postprocess_dtrace.sed probes.h.tmp
sed -f $^ >$@
@@ -73,8 +79,8 @@ endif
# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than fmgr-stamp.
-$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c
- cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c; do \
+$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h
+ cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h; do \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
@@ -93,3 +99,4 @@ uninstall-data:
clean:
rm -f probes.h probes.h.tmp
rm -f fmgroids.h fmgrprotos.h fmgrtab.c fmgr-stamp errcodes.h guc_tables.inc.c
+ rm -f wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/.gitignore b/src/backend/utils/activity/.gitignore
deleted file mode 100644
index bd0c0c777298..000000000000
--- a/src/backend/utils/activity/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/pgstat_wait_event.c
-/wait_event_types.h
-/wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/Makefile b/src/backend/utils/activity/Makefile
index 0eb29ee78aa0..c37bfb350bbc 100644
--- a/src/backend/utils/activity/Makefile
+++ b/src/backend/utils/activity/Makefile
@@ -36,17 +36,8 @@ OBJS = \
wait_event.o \
wait_event_funcs.o
+# Force these dependencies to be known even without dependency info built:
+wait_event.o: wait_event.c $(top_builddir)/src/backend/utils/pgstat_wait_event.c
+wait_event_funcs.o: wait_event_funcs.c $(top_builddir)/src/backend/utils/wait_event_funcs_data.c
+
include $(top_srcdir)/src/backend/common.mk
-
-wait_event_funcs.o: wait_event_funcs_data.c
-wait_event_funcs_data.c: wait_event_types.h
-
-wait_event.o: pgstat_wait_event.c
-pgstat_wait_event.c: wait_event_types.h
- touch $@
-
-wait_event_types.h: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt generate-wait_event_types.pl
- $(PERL) $(srcdir)/generate-wait_event_types.pl --code $<
-
-clean:
- rm -f wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/meson.build b/src/backend/utils/activity/meson.build
index 9f48d5970e17..53bd5a246cab 100644
--- a/src/backend/utils/activity/meson.build
+++ b/src/backend/utils/activity/meson.build
@@ -30,7 +30,6 @@ waitevent_sources = files(
wait_event = static_library('wait_event_names',
waitevent_sources,
dependencies: [backend_code],
- include_directories: include_directories('../../../include/utils'),
kwargs: internal_lib_args,
)
diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c
index e4f2c440257d..aca2c8fc742a 100644
--- a/src/backend/utils/activity/wait_event.c
+++ b/src/backend/utils/activity/wait_event.c
@@ -503,4 +503,4 @@ pgstat_get_wait_event(uint32 wait_event_info)
return event_name;
}
-#include "pgstat_wait_event.c"
+#include "utils/pgstat_wait_event.c"
diff --git a/src/backend/utils/activity/wait_event_funcs.c b/src/backend/utils/activity/wait_event_funcs.c
index b62ee83ef73c..fa10a80b0887 100644
--- a/src/backend/utils/activity/wait_event_funcs.c
+++ b/src/backend/utils/activity/wait_event_funcs.c
@@ -31,7 +31,7 @@ static const struct
waitEventData[] =
{
-#include "wait_event_funcs_data.c"
+#include "utils/wait_event_funcs_data.c"
/* end of list */
{NULL, NULL, NULL}
};
--
2.51.0
[application/pgp-signature] signature.asc (833B, 3-signature.asc)
download
^ permalink raw reply [nested|flat] 73+ messages in thread
* Re: AIX support
@ 2026-01-30 05:06 Michael Paquier <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 0 replies; 73+ messages in thread
From: Michael Paquier @ 2026-01-30 05:06 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Robert Haas <[email protected]>; Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
On Fri, Jan 30, 2026 at 01:38:42PM +0900, Michael Paquier wrote:
> While looking at the whole object dependency tree in the builds, I
> have settled down to a reuse of the same logic as guc_tables.inc.c for
> configure/make, by pushing down one level the generation of the three
> wait event files. These are not anymore saved in
> src/backend/utils/activity/, just src/backend/utils/, including them
> under header-stamp. Building directly in src/backend/utils/activity/
> also works, with two rules in src/backend/utils/activity/Makefile to
> force a rebuild. The files are then included as if they were in
> include/utils/, with the generation of links from src/backend/utils/
> to src/include/utils/, just like guc_tables.inc.c. That's the least
> invasive method I could come up with.
>
> I have run out of tokens for the CI this month, so I have not been
> able to check it there. My manual tests across all three build
> methods are working.
Scratch that a bit.. Some grepping is pointing out that
generated_sources_ac would become incorrect in
src/include/utils/meson.build.
Three paths in wait_event_names.txt were also inconsistent. It is
worth noting that the sgml path is entirely wrong, this is generated
in doc/src/sgml/.
Comments and thoughts are welcome.
--
Michael
Attachments:
[text/x-diff] v2-0001-Fix-incorrect-generation-of-wait-event-files.patch (10.7K, 2-v2-0001-Fix-incorrect-generation-of-wait-event-files.patch)
download | inline diff:
From ac7b085172c054914bd3557bd1330681fadc68ac Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Fri, 30 Jan 2026 13:51:15 +0900
Subject: [PATCH v2] Fix incorrect generation of wait-event files
In a meson build, include/utils was incorrectly listed in the set of
include_directories. This would conflict with the headers pulled in by
an environment. This issue has not been an issue in the buildfarm; it
has been noted with AIX and a conflict with float.h.
Combo oversight in fa88928470b5 and 1e68e43d3f0f.
blah, blah..
Discussion: https://postgr.es/m/vua2n6svb6fac3fmz42ahqxndmgbgor7vpxtemis5evasfpzb3@ogs4ewexkpjm
Backpatch-through: 17
---
src/include/Makefile | 1 +
src/include/utils/.gitignore | 2 ++
src/include/utils/meson.build | 4 +---
src/backend/Makefile | 10 +---------
src/backend/utils/.gitignore | 3 +++
src/backend/utils/Makefile | 13 ++++++++++---
src/backend/utils/activity/.gitignore | 3 ---
src/backend/utils/activity/Makefile | 17 ++++-------------
src/backend/utils/activity/meson.build | 1 -
src/backend/utils/activity/wait_event.c | 2 +-
src/backend/utils/activity/wait_event_funcs.c | 2 +-
src/backend/utils/activity/wait_event_names.txt | 6 +++---
12 files changed, 27 insertions(+), 37 deletions(-)
delete mode 100644 src/backend/utils/activity/.gitignore
diff --git a/src/include/Makefile b/src/include/Makefile
index 4ef060e90503..ac673f4cf17b 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -105,6 +105,7 @@ uninstall:
clean:
rm -f utils/fmgroids.h utils/fmgrprotos.h utils/guc_tables.inc.c utils/errcodes.h utils/header-stamp
+ rm -f utils/pgstat_wait_event.c utils/wait_event_funcs_data.c
rm -f storage/lwlocknames.h utils/probes.h utils/wait_event_types.h
rm -f nodes/nodetags.h nodes/header-stamp
$(MAKE) -C catalog clean
diff --git a/src/include/utils/.gitignore b/src/include/utils/.gitignore
index 30f921429c6f..ff6f61cd7ee7 100644
--- a/src/include/utils/.gitignore
+++ b/src/include/utils/.gitignore
@@ -4,4 +4,6 @@
/probes.h
/errcodes.h
/header-stamp
+/pgstat_wait_event.c
+/wait_event_funcs_data.c
/wait_event_types.h
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
index 318a6aec0d06..fd3a2352df5d 100644
--- a/src/include/utils/meson.build
+++ b/src/include/utils/meson.build
@@ -79,8 +79,6 @@ generated_backend_headers += fmgrtab_target[1]
# autoconf generates the file there, ensure we get a conflict
generated_sources_ac += {
- 'src/backend/utils': fmgrtab_output + ['errcodes.h', 'probes.h', 'fmgr-stamp'],
+ 'src/backend/utils': fmgrtab_output + ['errcodes.h', 'wait_event_types.h', 'probes.h', 'fmgr-stamp'],
'src/include/utils': ['header-stamp'],
}
-
-generated_sources_ac += {'src/backend/utils/activity': ['wait_event_types.h']}
diff --git a/src/backend/Makefile b/src/backend/Makefile
index baa9b05d0211..05642dc02e39 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -136,9 +136,6 @@ parser/gram.h: parser/gram.y
storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl ../include/storage/lwlocklist.h utils/activity/wait_event_names.txt
$(MAKE) -C storage/lmgr lwlocknames.h
-utils/activity/wait_event_types.h: utils/activity/generate-wait_event_types.pl utils/activity/wait_event_names.txt
- $(MAKE) -C utils/activity wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
-
# run this unconditionally to avoid needing to know its dependencies here:
submake-catalog-headers:
$(MAKE) -C ../include/catalog generated-headers
@@ -163,18 +160,13 @@ submake-utils-headers:
.PHONY: generated-headers
-generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/wait_event_types.h submake-catalog-headers submake-nodes-headers submake-utils-headers parser/gram.h
+generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h submake-catalog-headers submake-nodes-headers submake-utils-headers parser/gram.h
$(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
cd '$(dir $@)' && rm -f $(notdir $@) && \
$(LN_S) "$$prereqdir/$(notdir $<)" .
-$(top_builddir)/src/include/utils/wait_event_types.h: utils/activity/wait_event_types.h
- prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
- cd '$(dir $@)' && rm -f $(notdir $@) && \
- $(LN_S) "$$prereqdir/$(notdir $<)" .
-
utils/probes.o: utils/probes.d $(SUBDIROBJS)
$(DTRACE) $(DTRACEFLAGS) -C -G -s $(call expand_subsys,$^) -o $@
diff --git a/src/backend/utils/.gitignore b/src/backend/utils/.gitignore
index 303c01d05151..fa9cfb39693d 100644
--- a/src/backend/utils/.gitignore
+++ b/src/backend/utils/.gitignore
@@ -5,3 +5,6 @@
/guc_tables.inc.c
/probes.h
/errcodes.h
+/pgstat_wait_event.c
+/wait_event_funcs_data.c
+/wait_event_types.h
diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index 6df31504f328..81b4a956bda3 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -43,7 +43,7 @@ generated-header-symlinks: $(top_builddir)/src/include/utils/header-stamp submak
submake-adt-headers:
$(MAKE) -C adt jsonpath_gram.h
-$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h guc_tables.inc.c
+$(SUBDIRS:%=%-recursive): fmgr-stamp errcodes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h
# fmgr-stamp records the last time we ran Gen_fmgrtab.pl. We don't rely on
# the timestamps of the individual output files, because the Perl script
@@ -58,6 +58,12 @@ errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
guc_tables.inc.c: $(top_srcdir)/src/backend/utils/misc/guc_parameters.dat $(top_srcdir)/src/backend/utils/misc/gen_guc_tables.pl
$(PERL) $(top_srcdir)/src/backend/utils/misc/gen_guc_tables.pl $< $@
+pgstat_wait_event.c: wait_event_types.h
+wait_event_funcs_data.c: wait_event_types.h
+
+wait_event_types.h: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
+ $(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --code $<
+
ifeq ($(enable_dtrace), yes)
probes.h: postprocess_dtrace.sed probes.h.tmp
sed -f $^ >$@
@@ -73,8 +79,8 @@ endif
# These generated headers must be symlinked into src/include/.
# We use header-stamp to record that we've done this because the symlinks
# themselves may appear older than fmgr-stamp.
-$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c
- cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c; do \
+$(top_builddir)/src/include/utils/header-stamp: fmgr-stamp errcodes.h probes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h
+ cd '$(dir $@)' && for file in fmgroids.h fmgrprotos.h errcodes.h probes.h guc_tables.inc.c pgstat_wait_event.c wait_event_funcs_data.c wait_event_types.h; do \
rm -f $$file && $(LN_S) "../../../$(subdir)/$$file" . ; \
done
touch $@
@@ -93,3 +99,4 @@ uninstall-data:
clean:
rm -f probes.h probes.h.tmp
rm -f fmgroids.h fmgrprotos.h fmgrtab.c fmgr-stamp errcodes.h guc_tables.inc.c
+ rm -f wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/.gitignore b/src/backend/utils/activity/.gitignore
deleted file mode 100644
index bd0c0c777298..000000000000
--- a/src/backend/utils/activity/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/pgstat_wait_event.c
-/wait_event_types.h
-/wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/Makefile b/src/backend/utils/activity/Makefile
index 0eb29ee78aa0..c37bfb350bbc 100644
--- a/src/backend/utils/activity/Makefile
+++ b/src/backend/utils/activity/Makefile
@@ -36,17 +36,8 @@ OBJS = \
wait_event.o \
wait_event_funcs.o
+# Force these dependencies to be known even without dependency info built:
+wait_event.o: wait_event.c $(top_builddir)/src/backend/utils/pgstat_wait_event.c
+wait_event_funcs.o: wait_event_funcs.c $(top_builddir)/src/backend/utils/wait_event_funcs_data.c
+
include $(top_srcdir)/src/backend/common.mk
-
-wait_event_funcs.o: wait_event_funcs_data.c
-wait_event_funcs_data.c: wait_event_types.h
-
-wait_event.o: pgstat_wait_event.c
-pgstat_wait_event.c: wait_event_types.h
- touch $@
-
-wait_event_types.h: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt generate-wait_event_types.pl
- $(PERL) $(srcdir)/generate-wait_event_types.pl --code $<
-
-clean:
- rm -f wait_event_types.h pgstat_wait_event.c wait_event_funcs_data.c
diff --git a/src/backend/utils/activity/meson.build b/src/backend/utils/activity/meson.build
index 9f48d5970e17..53bd5a246cab 100644
--- a/src/backend/utils/activity/meson.build
+++ b/src/backend/utils/activity/meson.build
@@ -30,7 +30,6 @@ waitevent_sources = files(
wait_event = static_library('wait_event_names',
waitevent_sources,
dependencies: [backend_code],
- include_directories: include_directories('../../../include/utils'),
kwargs: internal_lib_args,
)
diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c
index e4f2c440257d..aca2c8fc742a 100644
--- a/src/backend/utils/activity/wait_event.c
+++ b/src/backend/utils/activity/wait_event.c
@@ -503,4 +503,4 @@ pgstat_get_wait_event(uint32 wait_event_info)
return event_name;
}
-#include "pgstat_wait_event.c"
+#include "utils/pgstat_wait_event.c"
diff --git a/src/backend/utils/activity/wait_event_funcs.c b/src/backend/utils/activity/wait_event_funcs.c
index b62ee83ef73c..fa10a80b0887 100644
--- a/src/backend/utils/activity/wait_event_funcs.c
+++ b/src/backend/utils/activity/wait_event_funcs.c
@@ -31,7 +31,7 @@ static const struct
waitEventData[] =
{
-#include "wait_event_funcs_data.c"
+#include "utils/wait_event_funcs_data.c"
/* end of list */
{NULL, NULL, NULL}
};
diff --git a/src/backend/utils/activity/wait_event_names.txt b/src/backend/utils/activity/wait_event_names.txt
index 5537a2d25301..efde48e76b72 100644
--- a/src/backend/utils/activity/wait_event_names.txt
+++ b/src/backend/utils/activity/wait_event_names.txt
@@ -14,13 +14,13 @@
#
# The files generated from this one are:
#
-# src/backend/utils/activity/wait_event_types.h
+# wait_event_types.h
# typedef enum definitions for wait events.
#
-# src/backend/utils/activity/pgstat_wait_event.c
+# pgstat_wait_event.c
# C functions to get the wait event name based on the enum.
#
-# src/backend/utils/activity/wait_event_types.sgml
+# wait_event_types.sgml
# SGML tables of wait events for inclusion in the documentation.
#
# When adding a new wait event, make sure it is placed in the appropriate
--
2.51.0
[application/pgp-signature] signature.asc (833B, 3-signature.asc)
download
^ permalink raw reply [nested|flat] 73+ messages in thread
* RE: AIX support
@ 2026-03-12 12:05 Joe Hatcher <[email protected]>
parent: Aditya Kamath <[email protected]>
1 sibling, 0 replies; 73+ messages in thread
From: Joe Hatcher @ 2026-03-12 12:05 UTC (permalink / raw)
To: Aditya Kamath <[email protected]>; Srirama Kucherlapati <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; +Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Attesting to the demand for Postgres support on AIX, associated with the use of SAS, I am aware of ~200 Customers running Postgres on AIX on some 600 unique deployments.
SAS is engaged with IBM regarding Postgres on AX and is a strong advocate to have support for this operating system restored.
-------------------------------------------------------------------
Joe Hatcher
SAS Cloud and Platform - Compute Services ▪ Product Manager
Tel: 919-531-0692 ▪ Mobile: 919-624-6149
www.sas.com<http://www.sas.com/;
SAS® … THE POWER TO KNOW®
From: Aditya Kamath <[email protected]>
Sent: Wednesday, January 28, 2026 10:20 AM
To: Srirama Kucherlapati <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: AIX support
EXTERNAL
Hi Andres,
I can explain this differently as well.
We know that include_directories property in meson will include the source and the build directory in the command. Ex: If we give “src/include” then “-Isrc/include” and “-I../src/include” are added.
>> + # This flag is required to make sure the user spefic float.h is
>> + # picked instead of the system float.h header file, which doesnot
>> + # have definition like float8, etc
>> + cflags += '-D_H_FLOAT’
>I don't understand this one - how does defining _H_FLOAT lead to a >different
>header being picked?
Below is the error message we get in AIX if we do not use '-D_H_FLOAT’
FAILED: src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o
gcc -Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils -I../src/include/utils -Isrc/include -I../src/include -I/opt/freeware/include -I/opt/freeware/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation -maix64 -fPIC -pthread -DBUILDING_DLL1233 -MD -MQ
./src/include/utils/float.h:28:19: error: expected ';' before 'int'
28 | extern PGDLLIMPORT int extra_float_digits;
There is a clear missing of float.h definitions, the reason being float.h got included before "src/include/c.h”.
Kindly observe the command "-I../src/include/utils” flag came in the front.
Now in c.h when stdio.h is called in AIX at line 65, then AIX system limits.h is called and then within that AIX system float.h is called.
But here is the catch. It won’t pick the AIX system float.h. It will pick the Postgres "src/include/utilsfloat.h”.
The reason being the compiler is designed to pick what comes first in -I flag. One proof of that is here. https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html<https://protect.checkpoint.com/v2/r01/___...;
I am assuming all systems behave like this.
This is the root cause of the problem. That "-I../src/include/utils” which meson adds.
So now "src/include/utils/float.h”.is picked up first even before "src/include/c.h”.
That is why we saw the error. When we define “_H_FLOAT” we essentially force the system header to be ignored in the system limits.h where it is called and then the Postgres "src/include/utils/float.h” takes over.
Hope this explains Andres.
There are multiple things we can do here.
One being define “_H_FLOAT”
The other being use #include_next float.h under ifdef _AIX guard
The third we are experimenting is to have implicit_include_directories: false as per document here https://mesonbuild.com/Include-directories.html<https://protect.checkpoint.com/v2/r01/___https://...;, but that might difficult since recursive include directories exists in Postgres.
Kindly let us know if this explanation helps and what you think. Also If there is a preferred or cleaner way you know let us know.
Have a nice day ahead.
Thanks and regards,
Aditya.
From: Aditya Kamath <[email protected]<mailto:[email protected]>>
Date: Wednesday, 28 January 2026 at 3:55 PM
To: Srirama Kucherlapati <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: Re: [EXTERNAL] Re: AIX support
Hi Andrew,
Thank you for your review comments for AIX so far.
While we are working on the rest of the comments you had sent here is our explanation for using the '-D_H_FLOAT’ flag in the source directory meson.build file.
>> + # This flag is required to make sure the user spefic float.h is
>> + # picked instead of the system float.h header file, which doesnot
>> + # have definition like float8, etc
>> + cflags += '-D_H_FLOAT’
>I don't understand this one - how does defining _H_FLOAT lead to a >different
>header being picked? Also, float8 is defined in c.h, so it hardly could >be
>influenced by a system float.h header?
>Our float.h header is only included as "utils/float.h", so it really >shouldn’t
>be confused with a system header?
So If we do not use the flag the error we get is as follows,
FAILED: src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o
gcc -Isrc/backend/utils/activity/wait_event_names.a.p -Isrc/include/utils -I../src/include/utils -Isrc/include -I../src/include -I/opt/freeware/include -I/opt/freeware/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation -maix64 -fPIC -pthread -DBUILDING_DLL1233 -MD -MQ src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -MF src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o.d -o src/backend/utils/activity/wait_event_names.a.p/wait_event_funcs.c.o -c ../src/backend/utils/activity/wait_event_funcs.c
In file included from /usr/include/sys/limits.h:307,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/13/include-fixed/stdio.h:589,
from ../src/include/c.h:65,
from ../src/include/postgres.h:48,
from ../src/backend/utils/activity/wait_event_funcs.c:15:
../src/include/utils/float.h:28:19: error: expected ';' before 'int'
28 | extern PGDLLIMPORT int extra_float_digits;
../src/include/utils/float.h:289:37: error: unknown type name 'float4'
289 | float4_min(const float4 val1, const float4 val2)
../src/include/utils/float.h:294:15: error: unknown type name 'float8'
294 | static inline float8
The reason this happened is because -I../src/include/utils argument in the command included the float.h header first before the ./src/include/c.h header of postgresql which actually has the
PGDLLIMPORT, float4 and float8 definitions.
So, the header files have mismatched in the order they are processed. If we eliminate -I../src/include/utils in the command, then it will work.
But that will not happen automatically since we use include_directories() everywhere which adds both the source and the build directory includes. If we can get meson to not use
-I../src/include/ in AIX while including headers we will be able to compile.
We are currently experimenting with implicit_include_directories from the document below to see if we can remove the same
https://mesonbuild.com/Include-directories.html<https://protect.checkpoint.com/v2/r01/___https://...;.
Reason for -D_H_FLOAT
This prevents AIX libc’s float.h to be included via c.h -> stdio.h -> limits.h -> float.h. The real problem is header include order in AIX. Compiler sees src/include/utils/float.h first and then c.h. This is a problem. When this flag is set, AIX’s float.h is skipped causing system header include chain to change. AIX no longer injects float.h early which results in c.h included before utils/float.h. the way Postgres expects.
Let us know what you think.
Is there a preferred or cleaner way you know to ensure the correct include ordering like using implicit_include_directories so that utils/float.h is not included before c.h?
Have a nice day ahead.
Thanks and regards,
Aditya.
From: Srirama Kucherlapati <[email protected]<mailto:[email protected]>>
Date: Wednesday, 28 January 2026 at 9:34 AM
To: Aditya Kamath <[email protected]<mailto:[email protected]>>
Subject: FW: [EXTERNAL] Re: AIX support
FYI
Warm regards,
Sriram.
------------------------------------------
VIOS/SSP Development,
ISDL, IBM India Pvt Ltd.
From: Andres Freund <[email protected]<mailto:[email protected]>>
Date: Monday, 26 January 2026 at 21:11
To: Srirama Kucherlapati <[email protected]<mailto:[email protected]>>
Cc: Peter Eisentraut <[email protected]<mailto:[email protected]>>, [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>, Heikki Linnakangas <[email protected]<mailto:[email protected]>>, Tristan Partin <[email protected]<mailto:[email protected]>>, AIX PG user <[email protected]<mailto:[email protected]>>
Subject: [EXTERNAL] Re: AIX support
Hi,
From what I can tell the meson patch *AGAIN* is missing mkldexport.sh. Also,
you seem to reference the script as files('port/aix/mkldexport.sh'), but that
that's not a path that makes sense for our source code structure (nor where
the "complete" patch adds it).
You really need to actually start testing your patches.
Doesn't the meson patch also require the changes to src/tools/gen_export.pl?
On 2026-01-23 16:11:25 +0000, Srirama Kucherlapati wrote:
> diff --git a/meson.build b/meson.build
> index 6e7ddd74683..17ad9c6ca32 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -198,6 +198,8 @@ endif
> # that purpose.
> portname = host_system
>
> +dep_static_lib = declare_dependency()
Add a comment saying something like
# In some configurations we don't want to install static libraries. For those
# dep_static_lib can be set to disabler() below.
The introduction of dep_static_lib should be broken out into its own patch.
> + # This flag is required to make sure the user spefic float.h is
> + # picked instead of the system float.h header file, which doesnot
> + # have definition like float8, etc
> + cflags += '-D_H_FLOAT'
I don't understand this one - how does defining _H_FLOAT lead to a different
header being picked? Also, float8 is defined in c.h, so it hardly could be
influenced by a system float.h header?
Our float.h header is only included as "utils/float.h", so it really shouldn't
be confused with a system header?
> @@ -1765,10 +1793,49 @@ endforeach
> # as long, char, short, or int. Note that we intentionally do not consider
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> -alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +if host_system != 'aix'
> + alignof_double = cdata.get('ALIGNOF_DOUBLE')
> + if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> + error('alignment of int64_t is greater than the alignment of double')
> + endif
> +else
> + # The AIX 'power' alignment rules apply the natural alignment of the "first
> + # member" if it is of a floating-point data type (or is an aggregate whose
> + # recursively "first" member or element is such a type). The alignment
> + # associated with these types for subsequent members use an alignment value
> + # where the floating-point data type is considered to have 4-byte alignment.
> + # More info
> + # https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_bugzilla_show-5Fbug.cgi-3Fid-3D9955...;
> + #
> + # The double is aligned to 4-bytes on AIX in aggregates. But to maintain
> + # alignement across platforms the max alignment of long should be considered.
How are these "AIX 'power' alignment rules" for float not just completely
broken?
I assume this means that 4 byte aligned floats work just fine, but have
degraded peformance?
Is there documentation about this that isn't an already fixed bug report in gcc?
Maybe I'm confused, but doesn't this power alignment rule mean that the
cc.alignment('double') will always return 8? That computation won't apply the
"subsequent member" rule, and therefore will have an alignment of 8. Which in
turn seems to make this entire change pointless?
> + # Get the alignment values
> + ac_cv_alignof_long = cc.alignment('long', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_double = cc.alignment('double', args: test_c_args, prefix: '#include <stdint.h>')
> + ac_cv_alignof_int64_t = cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>')
I've previously complained about these av_cv_ variable names. This isn't
autoconf. What is this doing here?
Why do we need a platform specific alignment determination for long, int64?
> + message('Alignment of long : @0@'.format(ac_cv_alignof_long))
> + message('Alignment of double : @0@'.format(ac_cv_alignof_double))
> + message('Alignment of int64_t : @0@'.format(ac_cv_alignof_int64_t))
These are already going to be output by cc.alignment, this is just redundant,
no?
> + # Start with long
> + alignof_double = ac_cv_alignof_long
> + message('MAX ALIGN ac_cv_alignof_long')
> +
> + # Compare with double
> + if alignof_double < ac_cv_alignof_double
> + alignof_double = ac_cv_alignof_double
> + message('MAX ALIGN ac_cv_alignof_double')
> + endif
> +
> + # Compare with int64_t
> + if alignof_double < ac_cv_alignof_int64_t
> + alignof_double = ac_cv_alignof_int64_t
> + message('MAX ALIGN ac_cv_alignof_int64_t')
> + endif
> +endif
> +message('MAX ALIGN OF DOUBLE : @0@'.format(alignof_double))
This is a lot of output for something that's just computing a maximum of three
variables.
> diff --git a/src/backend/meson.build b/src/backend/meson.build
> index b831a541652..4838f245ab3 100644
> --- a/src/backend/meson.build
> +++ b/src/backend/meson.build
> @@ -125,6 +125,24 @@ if host_system == 'windows'
> '--FILEDESC', 'PostgreSQL Server',])
> endif
>
> +if host_system == 'aix'
> + # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
> + # main executable, allowing extension libraries to resolve their undefined
> + # symbols to symbols in the postgres binary.
> + postgres_imp = custom_target('postgres.imp',
> + command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
> + input: postgres_lib,
> + output: 'postgres.imp',
> + capture: true,
> + install: true,
> + install_dir: dir_lib,
> + build_by_default: false,
> + )
> + backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
> + backend_link_depends += postgres_imp
> +endif
This should be moved next to the msvc specific block (the one about
postgres_def) and should use an elif.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 73+ messages in thread
end of thread, other threads:[~2026-03-12 12:05 UTC | newest]
Thread overview: 73+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21 12:55 AIX support Sriram RK <[email protected]>
2024-03-21 13:57 ` Alvaro Herrera <[email protected]>
2024-03-21 13:57 ` Tom Lane <[email protected]>
2024-03-21 16:35 ` Sriram RK <[email protected]>
2024-03-28 11:09 ` Sriram RK <[email protected]>
2024-03-29 02:48 ` Noah Misch <[email protected]>
2024-03-29 03:07 ` Tom Lane <[email protected]>
2025-03-07 14:11 RE: AIX support Srirama Kucherlapati <[email protected]>
2025-03-07 16:20 ` Robert Haas <[email protected]>
2025-03-17 16:58 ` Srirama Kucherlapati <[email protected]>
2025-04-03 13:45 ` Srirama Kucherlapati <[email protected]>
2025-04-04 19:31 ` Srirama Kucherlapati <[email protected]>
2025-04-05 18:29 ` Srirama Kucherlapati <[email protected]>
2025-04-12 16:41 ` Srirama Kucherlapati <[email protected]>
2025-04-12 17:09 ` Srirama Kucherlapati <[email protected]>
2025-04-15 16:20 ` Srirama Kucherlapati <[email protected]>
2025-09-03 16:44 ` Srirama Kucherlapati <[email protected]>
2025-09-11 05:20 ` Vamshikrishna T <[email protected]>
2025-09-11 06:12 ` Laurenz Albe <[email protected]>
2025-09-11 10:48 ` Vamshikrishna T <[email protected]>
2025-09-15 23:44 ` Bruce Momjian <[email protected]>
2025-09-16 15:13 ` Srirama Kucherlapati <[email protected]>
2025-09-18 06:21 ` Vamshikrishna T <[email protected]>
2025-09-20 15:20 ` Alvaro Herrera <[email protected]>
2025-09-22 11:09 ` AIX PG user <[email protected]>
2025-09-22 12:27 ` Andres Freund <[email protected]>
2025-09-23 14:26 ` AIX PG user <[email protected]>
2025-09-23 14:36 ` Andres Freund <[email protected]>
2025-09-23 15:28 ` Srirama Kucherlapati <[email protected]>
2025-10-15 15:58 ` Srirama Kucherlapati <[email protected]>
2025-10-15 18:15 ` Peter Eisentraut <[email protected]>
2025-10-16 15:28 ` AIX PG user <[email protected]>
2025-10-22 03:52 ` AIX PG user <[email protected]>
2025-10-31 17:33 ` Heikki Linnakangas <[email protected]>
2025-11-03 14:46 ` AIX PG user <[email protected]>
2025-11-07 16:28 ` Peter Eisentraut <[email protected]>
2025-11-10 17:00 ` AIX PG user <[email protected]>
2025-12-09 16:50 ` Srirama Kucherlapati <[email protected]>
2025-12-09 21:00 ` Heikki Linnakangas <[email protected]>
2025-12-09 21:08 ` Peter Eisentraut <[email protected]>
2025-12-19 15:34 ` Srirama Kucherlapati <[email protected]>
2025-12-21 08:19 ` Tristan Partin <[email protected]>
2025-12-24 15:34 ` Srirama Kucherlapati <[email protected]>
2026-01-02 14:43 ` Srirama Kucherlapati <[email protected]>
2026-01-13 16:06 ` Srirama Kucherlapati <[email protected]>
2026-01-14 21:33 ` Peter Eisentraut <[email protected]>
2026-01-15 05:51 ` Srirama Kucherlapati <[email protected]>
2026-01-21 14:19 ` Peter Eisentraut <[email protected]>
2026-01-22 16:08 ` Srirama Kucherlapati <[email protected]>
2026-01-23 16:11 ` Srirama Kucherlapati <[email protected]>
2026-01-26 12:22 ` Peter Eisentraut <[email protected]>
2026-01-26 14:59 ` Srirama Kucherlapati <[email protected]>
2026-01-26 15:41 ` Andres Freund <[email protected]>
2026-01-28 10:25 ` Aditya Kamath <[email protected]>
2026-01-28 15:20 ` Aditya Kamath <[email protected]>
2026-01-28 15:41 ` Robert Haas <[email protected]>
2026-01-28 17:33 ` Andres Freund <[email protected]>
2026-01-29 23:24 ` Michael Paquier <[email protected]>
2026-01-29 23:48 ` Tom Lane <[email protected]>
2026-01-30 04:38 ` Michael Paquier <[email protected]>
2026-01-30 05:06 ` Michael Paquier <[email protected]>
2026-03-12 12:05 ` Joe Hatcher <[email protected]>
2026-01-28 15:25 ` Robert Haas <[email protected]>
2026-01-26 17:45 ` Tom Lane <[email protected]>
2026-01-27 16:21 ` Srirama Kucherlapati <[email protected]>
2026-01-27 20:26 ` Tom Lane <[email protected]>
2026-01-27 21:42 ` Tom Lane <[email protected]>
2026-01-29 01:36 ` Tom Lane <[email protected]>
2026-01-29 03:43 ` Srirama Kucherlapati <[email protected]>
2026-01-27 21:50 ` Tom Lane <[email protected]>
2025-12-09 21:56 ` Tristan Partin <[email protected]>
2025-12-10 14:31 ` Srirama Kucherlapati <[email protected]>
2025-12-10 18:37 ` Tristan Partin <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox