On 26/02/2024 06:18, Michael Paquier wrote:
On Mon, Feb 26, 2024 at 09:42:03AM +0530, Robert Haas wrote:
On Mon, Feb 26, 2024 at 1:21 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
So, we now need to strip the remnants of AIX support from the code and
docs?  I don't see that much of it, but it's misleading to leave it
there.

(BTW, I still want to nuke the remaining snippets of HPPA support.
I don't think it does anybody any good to make it look like that's
still expected to work.)

+1 for removing things that don't work (or that we think probably don't work).

Seeing this stuff eat developer time because of the debugging of weird
issues while having a very limited impact for end-users is sad, so +1
for a cleanup of any remnants if this disappears.

Here's a patch to fully remove AIX support.

One small issue that warrants some discussion (in sanity_check.sql):

--- When ALIGNOF_DOUBLE==4 (e.g. AIX), the C ABI may impose 8-byte alignment on
+-- When MAXIMUM_ALIGNOF==8 but ALIGNOF_DOUBLE==4, the C ABI may impose 8-byte 
alignment
 -- some of the C types that correspond to TYPALIGN_DOUBLE SQL types.  To ensure
 -- catalog C struct layout matches catalog tuple layout, arrange for the tuple
 -- offset of each fixed-width, attalign='d' catalog column to be divisible by 8
 -- unconditionally.  Keep such columns before the first NameData column of the
 -- catalog, since packagers can override NAMEDATALEN to an odd number.
+-- (XXX: I'm not sure if any of the supported platforms have 
MAXIMUM_ALIGNOF==8 and
+-- ALIGNOF_DOUBLE==4.  Perhaps we should just require that
+-- ALIGNOF_DOUBLE==MAXIMUM_ALIGNOF)

What do y'all think of adding a check for ALIGNOF_DOUBLE==MAXIMUM_ALIGNOF to configure.ac and meson.build? It's not a requirement today, but I believe AIX was the only platform where that was not true. With AIX gone, that combination won't be tested, and we will probably break it sooner or later.

--
Heikki Linnakangas
Neon (https://neon.tech)
From 59a66f507365ff9cb8c462d8206be285e3e2632d Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakan...@iki.fi>
Date: Wed, 28 Feb 2024 00:22:23 +0400
Subject: [PATCH 1/1] Remove AIX support

There isn't a lot of user demand for AIX support, no one has stepped
up to the plate to properly maintain it, so it's best to remove it
altogether. AIX is still supported for stable versions.

The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:

    TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728

Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
(linker?) for values larger than PG_IO_ALIGN_SIZE. That could be
worked around, but we decided to just drop the AIX support instead.

Discussion: https://www.postgresql.org/message-id/20240224172345.32%40rfd.leadboat.com
---
 Makefile                                      |   2 +
 config/c-compiler.m4                          |   2 +-
 configure                                     | 301 +-----------------
 configure.ac                                  |  34 +-
 doc/src/sgml/dfunc.sgml                       |  19 --
 doc/src/sgml/installation.sgml                | 119 +------
 doc/src/sgml/runtime.sgml                     |  23 --
 meson.build                                   |  27 +-
 src/Makefile.shlib                            |  30 --
 src/backend/Makefile                          |  20 --
 src/backend/meson.build                       |  15 -
 src/backend/port/aix/mkldexport.sh            |  61 ----
 src/backend/utils/error/elog.c                |   2 -
 src/backend/utils/misc/ps_status.c            |   4 +-
 src/bin/pg_basebackup/t/010_pg_basebackup.pl  |   3 -
 src/bin/pg_verifybackup/t/008_untar.pl        |   3 -
 src/bin/pg_verifybackup/t/010_client_untar.pl |   3 -
 src/include/c.h                               |  18 +-
 src/include/port/aix.h                        |  14 -
 src/include/port/atomics.h                    |   6 +-
 src/include/storage/s_lock.h                  |  31 +-
 src/interfaces/libpq/Makefile                 |   2 +-
 src/interfaces/libpq/meson.build              |   5 +-
 src/makefiles/Makefile.aix                    |  39 ---
 src/port/README                               |   2 +-
 src/port/strerror.c                           |   2 -
 src/template/aix                              |  25 --
 src/test/regress/Makefile                     |   5 -
 src/test/regress/expected/sanity_check.out    |   5 +-
 src/test/regress/sql/sanity_check.sql         |   5 +-
 src/tools/gen_export.pl                       |  11 +-
 src/tools/pginclude/cpluspluscheck            |   1 -
 src/tools/pginclude/headerscheck              |   1 -
 33 files changed, 52 insertions(+), 788 deletions(-)
 delete mode 100755 src/backend/port/aix/mkldexport.sh
 delete mode 100644 src/include/port/aix.h
 delete mode 100644 src/makefiles/Makefile.aix
 delete mode 100644 src/template/aix

diff --git a/Makefile b/Makefile
index 9bc1a4ec17b..8a2ec9396b6 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,8 @@
 
 # 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/config/c-compiler.m4 b/config/c-compiler.m4
index 5db02b2ab75..3268a780bb0 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -137,7 +137,7 @@ if test x"$pgac_cv__128bit_int" = xyes ; then
   AC_CACHE_CHECK([for __int128 alignment bug], [pgac_cv__128bit_int_bug],
   [AC_RUN_IFELSE([AC_LANG_PROGRAM([
 /* This must match the corresponding code in c.h: */
-#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+#if defined(__GNUC__) || defined(__SUNPRO_C)
 #define pg_attribute_aligned(a) __attribute__((aligned(a)))
 #elif defined(_MSC_VER)
 #define pg_attribute_aligned(a) __declspec(align(a))
diff --git a/configure b/configure
index 6b87e5c9a8c..4e2dba338be 100755
--- a/configure
+++ b/configure
@@ -2987,7 +2987,6 @@ else
 # --with-template not given
 
 case $host_os in
-     aix*) template=aix ;;
   cygwin*|msys*) template=cygwin ;;
   darwin*) template=darwin ;;
 dragonfly*) template=netbsd ;;
@@ -3917,10 +3916,10 @@ fi
 
 
 
-case $template in
-  aix) pgac_cc_list="gcc xlc"; pgac_cxx_list="g++ xlC";;
-    *) pgac_cc_list="gcc cc"; pgac_cxx_list="g++ c++";;
-esac
+# If you don't specify a list of compilers to test, the AC_PROG_CC and
+# AC_PROG_CXX macros test for a long list of unsupported compilers.
+pgac_cc_list="gcc cc"
+pgac_cxx_list="g++ c++"
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -6874,190 +6873,6 @@ if test x"$pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" = x"yes"; then
 fi
 
 
-elif test "$PORTNAME" = "aix"; then
-  # AIX's xlc has to have strict aliasing turned off too
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -qnoansialias, for CFLAGS" >&5
-$as_echo_n "checking whether ${CC} supports -qnoansialias, for CFLAGS... " >&6; }
-if ${pgac_cv_prog_CC_cflags__qnoansialias+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CFLAGS=$CFLAGS
-pgac_save_CC=$CC
-CC=${CC}
-CFLAGS="${CFLAGS} -qnoansialias"
-ac_save_c_werror_flag=$ac_c_werror_flag
-ac_c_werror_flag=yes
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_CC_cflags__qnoansialias=yes
-else
-  pgac_cv_prog_CC_cflags__qnoansialias=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_c_werror_flag=$ac_save_c_werror_flag
-CFLAGS="$pgac_save_CFLAGS"
-CC="$pgac_save_CC"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__qnoansialias" >&5
-$as_echo "$pgac_cv_prog_CC_cflags__qnoansialias" >&6; }
-if test x"$pgac_cv_prog_CC_cflags__qnoansialias" = x"yes"; then
-  CFLAGS="${CFLAGS} -qnoansialias"
-fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -qnoansialias, for CXXFLAGS" >&5
-$as_echo_n "checking whether ${CXX} supports -qnoansialias, for CXXFLAGS... " >&6; }
-if ${pgac_cv_prog_CXX_cxxflags__qnoansialias+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CXXFLAGS=$CXXFLAGS
-pgac_save_CXX=$CXX
-CXX=${CXX}
-CXXFLAGS="${CXXFLAGS} -qnoansialias"
-ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-ac_cxx_werror_flag=yes
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  pgac_cv_prog_CXX_cxxflags__qnoansialias=yes
-else
-  pgac_cv_prog_CXX_cxxflags__qnoansialias=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-CXXFLAGS="$pgac_save_CXXFLAGS"
-CXX="$pgac_save_CXX"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__qnoansialias" >&5
-$as_echo "$pgac_cv_prog_CXX_cxxflags__qnoansialias" >&6; }
-if test x"$pgac_cv_prog_CXX_cxxflags__qnoansialias" = x"yes"; then
-  CXXFLAGS="${CXXFLAGS} -qnoansialias"
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -qlonglong, for CFLAGS" >&5
-$as_echo_n "checking whether ${CC} supports -qlonglong, for CFLAGS... " >&6; }
-if ${pgac_cv_prog_CC_cflags__qlonglong+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CFLAGS=$CFLAGS
-pgac_save_CC=$CC
-CC=${CC}
-CFLAGS="${CFLAGS} -qlonglong"
-ac_save_c_werror_flag=$ac_c_werror_flag
-ac_c_werror_flag=yes
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_CC_cflags__qlonglong=yes
-else
-  pgac_cv_prog_CC_cflags__qlonglong=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_c_werror_flag=$ac_save_c_werror_flag
-CFLAGS="$pgac_save_CFLAGS"
-CC="$pgac_save_CC"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__qlonglong" >&5
-$as_echo "$pgac_cv_prog_CC_cflags__qlonglong" >&6; }
-if test x"$pgac_cv_prog_CC_cflags__qlonglong" = x"yes"; then
-  CFLAGS="${CFLAGS} -qlonglong"
-fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -qlonglong, for CXXFLAGS" >&5
-$as_echo_n "checking whether ${CXX} supports -qlonglong, for CXXFLAGS... " >&6; }
-if ${pgac_cv_prog_CXX_cxxflags__qlonglong+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CXXFLAGS=$CXXFLAGS
-pgac_save_CXX=$CXX
-CXX=${CXX}
-CXXFLAGS="${CXXFLAGS} -qlonglong"
-ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-ac_cxx_werror_flag=yes
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  pgac_cv_prog_CXX_cxxflags__qlonglong=yes
-else
-  pgac_cv_prog_CXX_cxxflags__qlonglong=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-CXXFLAGS="$pgac_save_CXXFLAGS"
-CXX="$pgac_save_CXX"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__qlonglong" >&5
-$as_echo "$pgac_cv_prog_CXX_cxxflags__qlonglong" >&6; }
-if test x"$pgac_cv_prog_CXX_cxxflags__qlonglong" = x"yes"; then
-  CXXFLAGS="${CXXFLAGS} -qlonglong"
-fi
-
-
 fi
 
 # If the compiler knows how to hide symbols, add the switch needed for that to
@@ -7212,103 +7027,6 @@ if test x"$pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden" = x"yes"; then
 fi
 
   have_visibility_attribute=$pgac_cv_prog_CC_cflags__fvisibility_hidden
-elif test "$PORTNAME" = "aix"; then
-  # Note that xlc accepts -fvisibility=hidden as a file.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -qvisibility=hidden, for CFLAGS_SL_MODULE" >&5
-$as_echo_n "checking whether ${CC} supports -qvisibility=hidden, for CFLAGS_SL_MODULE... " >&6; }
-if ${pgac_cv_prog_CC_cflags__qvisibility_hidden+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CFLAGS=$CFLAGS
-pgac_save_CC=$CC
-CC=${CC}
-CFLAGS="${CFLAGS_SL_MODULE} -qvisibility=hidden"
-ac_save_c_werror_flag=$ac_c_werror_flag
-ac_c_werror_flag=yes
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_CC_cflags__qvisibility_hidden=yes
-else
-  pgac_cv_prog_CC_cflags__qvisibility_hidden=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_c_werror_flag=$ac_save_c_werror_flag
-CFLAGS="$pgac_save_CFLAGS"
-CC="$pgac_save_CC"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__qvisibility_hidden" >&5
-$as_echo "$pgac_cv_prog_CC_cflags__qvisibility_hidden" >&6; }
-if test x"$pgac_cv_prog_CC_cflags__qvisibility_hidden" = x"yes"; then
-  CFLAGS_SL_MODULE="${CFLAGS_SL_MODULE} -qvisibility=hidden"
-fi
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -qvisibility=hidden, for CXXFLAGS_SL_MODULE" >&5
-$as_echo_n "checking whether ${CXX} supports -qvisibility=hidden, for CXXFLAGS_SL_MODULE... " >&6; }
-if ${pgac_cv_prog_CXX_cxxflags__qvisibility_hidden+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  pgac_save_CXXFLAGS=$CXXFLAGS
-pgac_save_CXX=$CXX
-CXX=${CXX}
-CXXFLAGS="${CXXFLAGS_SL_MODULE} -qvisibility=hidden"
-ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-ac_cxx_werror_flag=yes
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  pgac_cv_prog_CXX_cxxflags__qvisibility_hidden=yes
-else
-  pgac_cv_prog_CXX_cxxflags__qvisibility_hidden=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-CXXFLAGS="$pgac_save_CXXFLAGS"
-CXX="$pgac_save_CXX"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__qvisibility_hidden" >&5
-$as_echo "$pgac_cv_prog_CXX_cxxflags__qvisibility_hidden" >&6; }
-if test x"$pgac_cv_prog_CXX_cxxflags__qvisibility_hidden" = x"yes"; then
-  CXXFLAGS_SL_MODULE="${CXXFLAGS_SL_MODULE} -qvisibility=hidden"
-fi
-
-  have_visibility_attribute=$pgac_cv_prog_CC_cflags__qvisibility_hidden
-  # Old xlc versions (<13.1) don't have support for -qvisibility. Use expfull to force
-  # all extension module symbols to be exported.
-  if test "$pgac_cv_prog_CC_cflags__qvisibility_hidden" != "yes"; then
-    CFLAGS_SL_MODULE="$CFLAGS_SL_MODULE -Wl,-b,expfull"
-  fi
 fi
 
 if test "$have_visibility_attribute" = "yes"; then
@@ -13166,8 +12884,7 @@ fi
 
 fi
 
-# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
-# also, on AIX, we may need to have openssl in LIBS for this step.
+# Note: We can test for libldap_r only after we know PTHREAD_LIBS
 if test "$with_ldap" = yes ; then
   _LIBS="$LIBS"
   if test "$PORTNAME" != "win32"; then
@@ -15025,10 +14742,6 @@ fi
 # spelling it understands, because it conflicts with
 # __declspec(restrict). Therefore we define pg_restrict to the
 # appropriate definition, which presumably won't conflict.
-#
-# Allow platforms with buggy compilers to force restrict to not be
-# used by setting $FORCE_DISABLE_RESTRICT=yes in the relevant
-# template.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
 $as_echo_n "checking for C/C++ restrict keyword... " >&6; }
 if ${ac_cv_c_restrict+:} false; then :
@@ -15075,7 +14788,7 @@ _ACEOF
  ;;
  esac
 
-if test "$ac_cv_c_restrict" = "no" -o "x$FORCE_DISABLE_RESTRICT" = "xyes"; then
+if test "$ac_cv_c_restrict" = "no"; then
   pg_restrict=""
 else
   pg_restrict="$ac_cv_c_restrict"
@@ -17391,7 +17104,7 @@ else
 /* end confdefs.h.  */
 
 /* This must match the corresponding code in c.h: */
-#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+#if defined(__GNUC__) || defined(__SUNPRO_C)
 #define pg_attribute_aligned(a) __attribute__((aligned(a)))
 #elif defined(_MSC_VER)
 #define pg_attribute_aligned(a) __declspec(align(a))
diff --git a/configure.ac b/configure.ac
index 6e64ece11da..e8851daa798 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,6 @@ 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 ;;
@@ -374,10 +373,10 @@ AC_DEFINE_UNQUOTED([XLOG_BLCKSZ], ${XLOG_BLCKSZ}, [
 # variable.
 PGAC_ARG_REQ(with, CC, [CMD], [set compiler (deprecated)], [CC=$with_CC])
 
-case $template in
-  aix) pgac_cc_list="gcc xlc"; pgac_cxx_list="g++ xlC";;
-    *) pgac_cc_list="gcc cc"; pgac_cxx_list="g++ c++";;
-esac
+# If you don't specify a list of compilers to test, the AC_PROG_CC and
+# AC_PROG_CXX macros test for a long list of unsupported compilers.
+pgac_cc_list="gcc cc"
+pgac_cxx_list="g++ c++"
 
 AC_PROG_CC([$pgac_cc_list])
 AC_PROG_CC_C99()
@@ -594,12 +593,6 @@ elif test "$ICC" = yes; then
   # Make sure strict aliasing is off (though this is said to be the default)
   PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
   PGAC_PROG_CXX_CFLAGS_OPT([-fno-strict-aliasing])
-elif test "$PORTNAME" = "aix"; then
-  # AIX's xlc has to have strict aliasing turned off too
-  PGAC_PROG_CC_CFLAGS_OPT([-qnoansialias])
-  PGAC_PROG_CXX_CFLAGS_OPT([-qnoansialias])
-  PGAC_PROG_CC_CFLAGS_OPT([-qlonglong])
-  PGAC_PROG_CXX_CFLAGS_OPT([-qlonglong])
 fi
 
 # If the compiler knows how to hide symbols, add the switch needed for that to
@@ -618,16 +611,6 @@ if test "$GCC" = yes -o "$SUN_STUDIO_CC" = yes ; then
   PGAC_PROG_VARCXX_VARFLAGS_OPT(CXX, CXXFLAGS_SL_MODULE, [-fvisibility=hidden])
   PGAC_PROG_VARCXX_VARFLAGS_OPT(CXX, CXXFLAGS_SL_MODULE, [-fvisibility-inlines-hidden])
   have_visibility_attribute=$pgac_cv_prog_CC_cflags__fvisibility_hidden
-elif test "$PORTNAME" = "aix"; then
-  # Note that xlc accepts -fvisibility=hidden as a file.
-  PGAC_PROG_CC_VAR_OPT(CFLAGS_SL_MODULE, [-qvisibility=hidden])
-  PGAC_PROG_VARCXX_VARFLAGS_OPT(CXX, CXXFLAGS_SL_MODULE, [-qvisibility=hidden])
-  have_visibility_attribute=$pgac_cv_prog_CC_cflags__qvisibility_hidden
-  # Old xlc versions (<13.1) don't have support for -qvisibility. Use expfull to force
-  # all extension module symbols to be exported.
-  if test "$pgac_cv_prog_CC_cflags__qvisibility_hidden" != "yes"; then
-    CFLAGS_SL_MODULE="$CFLAGS_SL_MODULE -Wl,-b,expfull"
-  fi
 fi
 
 if test "$have_visibility_attribute" = "yes"; then
@@ -1407,8 +1390,7 @@ if test "$with_zstd" = yes ; then
   AC_CHECK_LIB(zstd, ZSTD_compress, [], [AC_MSG_ERROR([library 'zstd' is required for ZSTD support])])
 fi
 
-# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
-# also, on AIX, we may need to have openssl in LIBS for this step.
+# Note: We can test for libldap_r only after we know PTHREAD_LIBS
 if test "$with_ldap" = yes ; then
   _LIBS="$LIBS"
   if test "$PORTNAME" != "win32"; then
@@ -1666,12 +1648,8 @@ PGAC_TYPE_LOCALE_T
 # spelling it understands, because it conflicts with
 # __declspec(restrict). Therefore we define pg_restrict to the
 # appropriate definition, which presumably won't conflict.
-#
-# Allow platforms with buggy compilers to force restrict to not be
-# used by setting $FORCE_DISABLE_RESTRICT=yes in the relevant
-# template.
 AC_C_RESTRICT
-if test "$ac_cv_c_restrict" = "no" -o "x$FORCE_DISABLE_RESTRICT" = "xyes"; then
+if test "$ac_cv_c_restrict" = "no"; then
   pg_restrict=""
 else
   pg_restrict="$ac_cv_c_restrict"
diff --git a/doc/src/sgml/dfunc.sgml b/doc/src/sgml/dfunc.sgml
index 554f9fac4ce..b94aefcd0ca 100644
--- a/doc/src/sgml/dfunc.sgml
+++ b/doc/src/sgml/dfunc.sgml
@@ -202,23 +202,4 @@ gcc -G -o foo.so foo.o
   server expects to find the shared library files.
  </para>
 
-<!--
-Under AIX, object files are compiled normally but building the shared
-library requires a couple of steps.  First, create the object file:
-.nf
-cc <other flags> -c foo.c
-.fi
-You must then create a symbol \*(lqexports\*(rq file for the object
-file:
-.nf
-mkldexport foo.o `pwd` &gt; foo.exp
-.fi
-Finally, you can create the shared library:
-.nf
-ld <other flags> -H512 -T512 -o foo.so -e _nostart \e
-   -bI:.../lib/postgres.exp -bE:foo.exp foo.o \e
-   -lm -lc 2>/dev/null
-.fi
-  -->
-
 </sect2>
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index ed5b285a5ee..d901576d98e 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -3401,7 +3401,7 @@ export MANPATH
   <para>
    <productname>PostgreSQL</productname> can be expected to work on current
    versions of these operating systems: Linux, Windows,
-   FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
+   FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, Solaris, and illumos.
    Other Unix-like systems may also work but are not currently
    being tested.  In most cases, all CPU architectures supported by
    a given operating system will work.  Look in
@@ -3445,123 +3445,6 @@ export MANPATH
    installation issues.
   </para>
 
-  <sect2 id="installation-notes-aix">
-   <title>AIX</title>
-
-   <indexterm zone="installation-notes-aix">
-    <primary>AIX</primary>
-    <secondary>installation on</secondary>
-   </indexterm>
-
-   <para>
-    You can use GCC or the native IBM compiler <command>xlc</command>
-    to build <productname>PostgreSQL</productname>
-    on <productname>AIX</productname>.
-   </para>
-
-   <para>
-    <productname>AIX</productname> versions before 7.1 are no longer
-    tested nor supported by the <productname>PostgreSQL</productname>
-    community.
-   </para>
-
-   <sect3 id="installation-notes-aix-mem-management">
-    <title>Memory Management</title>
-    <!-- https://archives.postgresql.org/message-id/603bgqmpl9....@dba2.int.libertyrms.com -->
-
-    <para>
-     AIX can be somewhat peculiar with regards to the way it does
-     memory management.  You can have a server with many multiples of
-     gigabytes of RAM free, but still get out of memory or address
-     space errors when running applications.  One example
-     is loading of extensions failing with unusual errors.
-     For example, running as the owner of the PostgreSQL installation:
-<screen>
-=# CREATE EXTENSION plperl;
-ERROR:  could not load library "/opt/dbs/pgsql/lib/plperl.so": A memory address is not in the address space for the process.
-</screen>
-    Running as a non-owner in the group possessing the PostgreSQL
-    installation:
-<screen>
-=# CREATE EXTENSION plperl;
-ERROR:  could not load library "/opt/dbs/pgsql/lib/plperl.so": Bad address
-</screen>
-     Another example is out of memory errors in the PostgreSQL server
-     logs, with every memory allocation near or greater than 256 MB
-     failing.
-    </para>
-
-    <para>
-     The overall cause of all these problems is the default bittedness
-     and memory model used by the server process.  By default, all
-     binaries built on AIX are 32-bit.  This does not depend upon
-     hardware type or kernel in use.  These 32-bit processes are
-     limited to 4 GB of memory laid out in 256 MB segments using one
-     of a few models.  The default allows for less than 256 MB in the
-     heap as it shares a single segment with the stack.
-    </para>
-
-    <para>
-     In the case of the <literal>plperl</literal> example, above,
-     check your umask and the permissions of the binaries in your
-     PostgreSQL installation.  The binaries involved in that example
-     were 32-bit and installed as mode 750 instead of 755.  Due to the
-     permissions being set in this fashion, only the owner or a member
-     of the possessing group can load the library.  Since it isn't
-     world-readable, the loader places the object into the process'
-     heap instead of the shared library segments where it would
-     otherwise be placed.
-    </para>
-
-    <para>
-     The <quote>ideal</quote> solution for this is to use a 64-bit
-     build of PostgreSQL, but that is not always practical, because
-     systems with 32-bit processors can build, but not run, 64-bit
-     binaries.
-    </para>
-
-    <para>
-     If a 32-bit binary is desired, set <symbol>LDR_CNTRL</symbol> to
-     <literal>MAXDATA=0x<replaceable>n</replaceable>0000000</literal>,
-     where 1 &lt;= n &lt;= 8, before starting the PostgreSQL server,
-     and try different values and <filename>postgresql.conf</filename>
-     settings to find a configuration that works satisfactorily.  This
-     use of <symbol>LDR_CNTRL</symbol> tells AIX that you want the
-     server to have <symbol>MAXDATA</symbol> bytes set aside for the
-     heap, allocated in 256 MB segments.  When you find a workable
-     configuration,
-     <command>ldedit</command> can be used to modify the binaries so
-     that they default to using the desired heap size.  PostgreSQL can
-     also be rebuilt, passing <literal>configure
-     LDFLAGS="-Wl,-bmaxdata:0x<replaceable>n</replaceable>0000000"</literal>
-     to achieve the same effect.
-    </para>
-
-    <para>
-     For a 64-bit build, set <envar>OBJECT_MODE</envar> to 64 and
-     pass <literal>CC="gcc -maix64"</literal>
-     and <literal>LDFLAGS="-Wl,-bbigtoc"</literal>
-     to <command>configure</command>.  (Options for
-    <command>xlc</command> might differ.)  If you omit the export of
-    <envar>OBJECT_MODE</envar>, your build may fail with linker errors.  When
-    <envar>OBJECT_MODE</envar> is set, it tells AIX's build utilities
-    such as <command>ar</command>, <command>as</command>, and <command>ld</command> what
-    type of objects to default to handling.
-    </para>
-
-    <para>
-     By default, overcommit of paging space can happen.  While we have
-     not seen this occur, AIX will kill processes when it runs out of
-     memory and the overcommit is accessed.  The closest to this that
-     we have seen is fork failing because the system decided that
-     there was not enough memory for another process.  Like many other
-     parts of AIX, the paging space allocation method and
-     out-of-memory kill is configurable on a system- or process-wide
-     basis if this becomes a problem.
-    </para>
-   </sect3>
-  </sect2>
-
   <sect2 id="installation-notes-cygwin">
    <title>Cygwin</title>
 
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index 64753d9c014..6047b8171d4 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -891,29 +891,6 @@ psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such
 
 
     <variablelist>
-     <varlistentry>
-      <term><systemitem class="osname">AIX</systemitem>
-      <indexterm><primary>AIX</primary><secondary>IPC configuration</secondary></indexterm>
-      </term>
-      <listitem>
-       <para>
-        It should not be necessary to do
-        any special configuration for such parameters as
-        <varname>SHMMAX</varname>, as it appears this is configured to
-        allow all memory to be used as shared memory.  That is the
-        sort of configuration commonly used for other databases such
-        as <application>DB/2</application>.</para>
-
-       <para> It might, however, be necessary to modify the global
-       <command>ulimit</command> information in
-       <filename>/etc/security/limits</filename>, as the default hard
-       limits for file sizes (<varname>fsize</varname>) and numbers of
-       files (<varname>nofiles</varname>) might be too low.
-       </para>
-      </listitem>
-     </varlistentry>
-
-
      <varlistentry>
       <term><systemitem class="osname">FreeBSD</systemitem>
       <indexterm><primary>FreeBSD</primary><secondary>IPC configuration</secondary></indexterm>
diff --git a/meson.build b/meson.build
index 8ed51b6aae8..c637a26e275 100644
--- a/meson.build
+++ b/meson.build
@@ -196,26 +196,7 @@ endif
 # that purpose.
 portname = host_system
 
-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 = '@0@.imp'
-
-  # 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'
+if host_system == 'cygwin'
   sema_kind = 'unnamed_posix'
   cppflags += '-D_GNU_SOURCE'
   dlsuffix = '.dll'
@@ -1571,7 +1552,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(__SUNPRO_C) || defined(__IBMC__)
+    #if defined(__GNUC__) || defined(__SUNPRO_C)
     #define pg_attribute_aligned(a) __attribute__((aligned(a)))
     #elif defined(_MSC_VER)
     #define pg_attribute_aligned(a) __declspec(align(a))
@@ -2371,10 +2352,6 @@ endif
 # conflict.
 #
 # We assume C99 support, so we don't need to make this conditional.
-#
-# XXX: Historically we allowed platforms to disable restrict in template
-# files, but that was only added for AIX when building with XLC, which we
-# don't support yet.
 cdata.set('pg_restrict', '__restrict')
 
 
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 8ca51ca03f7..986c71b5d20 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -106,20 +106,6 @@ 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
@@ -268,14 +254,6 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
 	touch $@
 endif #haslibarule
 
-# AIX wraps shared libraries inside a static library, 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
@@ -289,11 +267,8 @@ 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
 
@@ -401,10 +376,6 @@ 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/52ef20b2e3209443bc37736d00c3c1380a6e7...@exadv1.host.magwien.gv.at)
-ifneq ($(PORTNAME), aix)
-	$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
 ifneq ($(PORTNAME), cygwin)
 ifneq ($(PORTNAME), win32)
 ifneq ($(shlib), $(shlib_major))
@@ -419,7 +390,6 @@ 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 7d2ea7d54a6..d66e2a4b9fa 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -62,14 +62,12 @@ 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)
 
@@ -96,24 +94,6 @@ 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 8767aaba678..436c04af080 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -91,21 +91,6 @@ if cc.get_id() == 'msvc'
   # be restricted to b_pch=true.
   backend_link_with += postgres_lib
 
-elif 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
 
 backend_input = []
diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh
deleted file mode 100755
index adf3793e868..00000000000
--- a/src/backend/port/aix/mkldexport.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/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 bba00a0087f..c9719f358b6 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -911,9 +911,7 @@ 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/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 8f77f4b563a..ddb45a6bce8 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -52,7 +52,7 @@ bool		update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
 #define PS_USE_SETPROCTITLE_FAST
 #elif defined(HAVE_SETPROCTITLE)
 #define PS_USE_SETPROCTITLE
-#elif defined(__linux__) || defined(_AIX) || defined(__sun) || defined(__darwin__)
+#elif defined(__linux__) || defined(__sun) || defined(__darwin__)
 #define PS_USE_CLOBBER_ARGV
 #elif defined(WIN32)
 #define PS_USE_WIN32
@@ -62,7 +62,7 @@ bool		update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
 
 
 /* Different systems want the buffer padded differently */
-#if defined(_AIX) || defined(__linux__) || defined(__darwin__)
+#if defined(__linux__) || defined(__darwin__)
 #define PS_PADDING '\0'
 #else
 #define PS_PADDING ' '
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 86cc01a640b..fc6b00224f6 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -400,9 +400,6 @@ is(scalar(@tblspc_tars), 1, 'one tablespace tar was created');
 SKIP:
 {
 	my $tar = $ENV{TAR};
-	# don't check for a working tar here, to accommodate various odd
-	# cases such as AIX. If tar doesn't work the init_from_backup below
-	# will fail.
 	skip "no tar program available", 1
 	  if (!defined $tar || $tar eq '');
 
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index 30d9f3f7f0f..b4235541ab0 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -103,9 +103,6 @@ for my $tc (@test_configuration)
 	  SKIP:
 		{
 			my $tar = $ENV{TAR};
-			# don't check for a working tar here, to accommodate various odd
-			# cases such as AIX. If tar doesn't work the init_from_backup below
-			# will fail.
 			skip "no tar program available", 1
 			  if (!defined $tar || $tar eq '');
 
diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl
index 45010d79ac8..e9c2bcd7aad 100644
--- a/src/bin/pg_verifybackup/t/010_client_untar.pl
+++ b/src/bin/pg_verifybackup/t/010_client_untar.pl
@@ -133,9 +133,6 @@ for my $tc (@test_configuration)
 	  SKIP:
 		{
 			my $tar = $ENV{TAR};
-			# don't check for a working tar here, to accommodate various odd
-			# cases such as AIX. If tar doesn't work the init_from_backup below
-			# will fail.
 			skip "no tar program available", 1
 			  if (!defined $tar || $tar eq '');
 
diff --git a/src/include/c.h b/src/include/c.h
index 2e3ea206e1c..cc53f154041 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -105,8 +105,6 @@
  * GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
  * Clang: https://clang.llvm.org/docs/AttributeReference.html
  * Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
- * XLC: https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/language_ref/function_attributes.html
- * XLC: https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/language_ref/type_attrib.html
  */
 
 /*
@@ -171,8 +169,8 @@
 #define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
 #endif
 
-/* GCC and XLC support format attributes */
-#if defined(__GNUC__) || defined(__IBMC__)
+/* GCC support format attributes */
+#if defined(__GNUC__)
 #define pg_attribute_format_arg(a) __attribute__((format_arg(a)))
 #define pg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a)))
 #else
@@ -180,8 +178,8 @@
 #define pg_attribute_printf(f,a)
 #endif
 
-/* GCC, Sunpro and XLC support aligned, packed and noreturn */
-#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+/* GCC and Sunpro support aligned, packed and noreturn */
+#if defined(__GNUC__) || defined(__SUNPRO_C)
 #define pg_attribute_aligned(a) __attribute__((aligned(a)))
 #define pg_attribute_noreturn() __attribute__((noreturn))
 #define pg_attribute_packed() __attribute__((packed))
@@ -212,8 +210,8 @@
  * choose not to.  But, if possible, don't force inlining in unoptimized
  * debug builds.
  */
-#if (defined(__GNUC__) && __GNUC__ > 3 && defined(__OPTIMIZE__)) || defined(__SUNPRO_C) || defined(__IBMC__)
-/* GCC > 3, Sunpro and XLC support always_inline via __attribute__ */
+#if (defined(__GNUC__) && __GNUC__ > 3 && defined(__OPTIMIZE__)) || defined(__SUNPRO_C)
+/* GCC > 3 and Sunpro support always_inline via __attribute__ */
 #define pg_attribute_always_inline __attribute__((always_inline)) inline
 #elif defined(_MSC_VER)
 /* MSVC has a special keyword for this */
@@ -229,8 +227,8 @@
  * for proper cost attribution.  Note that unlike the pg_attribute_XXX macros
  * above, this should be placed before the function's return type and name.
  */
-/* GCC, Sunpro and XLC support noinline via __attribute__ */
-#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C) || defined(__IBMC__)
+/* GCC and Sunpro support noinline via __attribute__ */
+#if (defined(__GNUC__) && __GNUC__ > 2) || defined(__SUNPRO_C)
 #define pg_noinline __attribute__((noinline))
 /* msvc via declspec */
 #elif defined(_MSC_VER)
diff --git a/src/include/port/aix.h b/src/include/port/aix.h
deleted file mode 100644
index 5b1159c5785..00000000000
--- a/src/include/port/aix.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * src/include/port/aix.h
- */
-#define CLASS_CONFLICT
-#define DISABLE_XOPEN_NLS
-
-/*
- * "IBM XL C/C++ for AIX, V12.1" miscompiles, for 32-bit, some inline
- * expansions of ginCompareItemPointers() "long long" arithmetic.  To take
- * advantage of inlining, build a 64-bit PostgreSQL.
- */
-#if defined(__ILP32__) && defined(__IBMC__)
-#define PG_FORCE_DISABLE_INLINE
-#endif
diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h
index bf151037f72..504349080d4 100644
--- a/src/include/port/atomics.h
+++ b/src/include/port/atomics.h
@@ -84,11 +84,9 @@
  * using compiler intrinsics are a good idea.
  */
 /*
- * gcc or compatible, including clang and icc.  Exclude xlc.  The ppc64le "IBM
- * XL C/C++ for Linux, V13.1.2" emulates gcc, but __sync_lock_test_and_set()
- * of one-byte types elicits SIGSEGV.  That bug was gone by V13.1.5 (2016-12).
+ * gcc or compatible, including clang and icc.
  */
-#if (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__IBMC__) || defined(__IBMCPP__))
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
 #include "port/atomics/generic-gcc.h"
 #elif defined(_MSC_VER)
 #include "port/atomics/generic-msvc.h"
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 69582f4ae71..29ac6cdcd92 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -414,12 +414,6 @@ typedef unsigned int slock_t;
  * 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.
- *
- * Ordinarily, we'd code the branches here using GNU-style local symbols, that
- * is "1f" referencing "1:" and so on.  But some people run gcc on AIX with
- * IBM's assembler as backend, and IBM's assembler doesn't do local symbols.
- * So hand-code the branch offsets; fortunately, all PPC instructions are
- * exactly 4 bytes each, so it's not too hard to count.
  */
 static __inline__ int
 tas(volatile slock_t *lock)
@@ -430,15 +424,17 @@ tas(volatile slock_t *lock)
 	__asm__ __volatile__(
 "	lwarx   %0,0,%3,1	\n"
 "	cmpwi   %0,0		\n"
-"	bne     $+16		\n"		/* branch to li %1,1 */
+"	bne     1f			\n"
 "	addi    %0,%0,1		\n"
 "	stwcx.  %0,0,%3		\n"
-"	beq     $+12		\n"		/* branch to lwsync */
+"	beq     2f			\n"
+"1: \n"
 "	li      %1,1		\n"
-"	b       $+12		\n"		/* branch to end of asm sequence */
+"	b       3f			\n"
+"2: \n"
 "	lwsync				\n"
 "	li      %1,0		\n"
-
+"3: \n"
 :	"=&b"(_t), "=r"(_res), "+m"(*lock)
 :	"r"(lock)
 :	"memory", "cc");
@@ -666,21 +662,6 @@ tas(volatile slock_t *lock)
 
 #if !defined(HAS_TEST_AND_SET)	/* We didn't trigger above, let's try here */
 
-#if defined(_AIX)	/* AIX */
-/*
- * AIX (POWER)
- */
-#define HAS_TEST_AND_SET
-
-#include <sys/atomic_op.h>
-
-typedef int slock_t;
-
-#define TAS(lock)			_check_lock((slock_t *) (lock), 0, 1)
-#define S_UNLOCK(lock)		_clear_lock((slock_t *) (lock), 0)
-#endif	 /* _AIX */
-
-
 /* These are in sunstudio_(sparc|x86).s */
 
 #if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc))
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 083ca6f4cce..fe2af575c5d 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -114,7 +114,7 @@ backend_src = $(top_srcdir)/src/backend
 # coding rule.
 libpq-refs-stamp: $(shlib)
 ifneq ($(enable_coverage), yes)
-ifeq (,$(filter aix solaris,$(PORTNAME)))
+ifeq (,$(filter solaris,$(PORTNAME)))
 	@if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep exit; then \
 		echo 'libpq must not be calling any function which invokes exit'; exit 1; \
 	fi
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index a47b6f425dd..be6fadaea23 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -54,9 +54,8 @@ libpq_c_args = ['-DSO_MAJOR_VERSION=5']
 #    libpq_st, and {pgport,common}_shlib for libpq_sh
 #
 # We could try to avoid building the source files twice, but it probably adds
-# more complexity than its worth (AIX doesn't support link_whole yet, reusing
-# object files requires also linking to the library on windows or breaks
-# precompiled headers).
+# 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_sources,
   include_directories: [libpq_inc],
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
deleted file mode 100644
index dd16a7a0378..00000000000
--- a/src/makefiles/Makefile.aix
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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/README b/src/port/README
index 97f18a62338..ed5c54a72fa 100644
--- a/src/port/README
+++ b/src/port/README
@@ -28,5 +28,5 @@ applications.
 from libpgport are linked first.  This avoids having applications
 dependent on symbols that are _used_ by libpq, but not intended to be
 exported by libpq.  libpq's libpgport usage changes over time, so such a
-dependency is a problem.  Windows, Linux, AIX, and macOS use an export
+dependency is a problem.  Windows, Linux, and macOS use an export
 list to control the symbols exported by libpq.
diff --git a/src/port/strerror.c b/src/port/strerror.c
index 1070a49802e..4918ba821c1 100644
--- a/src/port/strerror.c
+++ b/src/port/strerror.c
@@ -214,10 +214,8 @@ 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
deleted file mode 100644
index 47fa8990a7c..00000000000
--- a/src/template/aix
+++ /dev/null
@@ -1,25 +0,0 @@
-# src/template/aix
-
-# Set default options if using xlc.  This formerly included -qsrcmsg, but that
-# option elicits internal compiler errors from xlc v16.1.0.  Note: configure
-# will add -qnoansialias if the compiler accepts it, even if user specifies a
-# non-default CFLAGS setting.
-if test "$GCC" != yes ; then
-  case $host_os in
-    *)
-      CFLAGS="-O2 -qmaxmem=16384"
-      ;;
-  esac
-
-  # Due to a compiler bug, see 20171013023536.ga492...@rfd.leadboat.com for details,
-  # force restrict not to be used when compiling with xlc.
-  FORCE_DISABLE_RESTRICT=yes
-fi
-
-# Extra CFLAGS for code that will go into a shared library
-CFLAGS_SL=""
-
-# 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
diff --git a/src/test/regress/Makefile b/src/test/regress/Makefile
index 7c665ff892d..6409a485e84 100644
--- a/src/test/regress/Makefile
+++ b/src/test/regress/Makefile
@@ -7,11 +7,6 @@
 # GNU make uses a make file named "GNUmakefile" in preference to "Makefile"
 # if it exists.  Postgres is shipped with a "GNUmakefile".
 
-
-# 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.
-all:
-
 all install clean check installcheck:
 	@echo "You must use GNU make to use Postgres.  It may be installed"
 	@echo "on your system with the name 'gmake'."
diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out
index c5c675b7508..82972b70e6f 100644
--- a/src/test/regress/expected/sanity_check.out
+++ b/src/test/regress/expected/sanity_check.out
@@ -26,12 +26,15 @@ SELECT relname, relkind
 (0 rows)
 
 --
--- When ALIGNOF_DOUBLE==4 (e.g. AIX), the C ABI may impose 8-byte alignment on
+-- When MAXIMUM_ALIGNOF==8 but ALIGNOF_DOUBLE==4, the C ABI may impose 8-byte alignment
 -- some of the C types that correspond to TYPALIGN_DOUBLE SQL types.  To ensure
 -- catalog C struct layout matches catalog tuple layout, arrange for the tuple
 -- offset of each fixed-width, attalign='d' catalog column to be divisible by 8
 -- unconditionally.  Keep such columns before the first NameData column of the
 -- catalog, since packagers can override NAMEDATALEN to an odd number.
+-- (XXX: I'm not sure if any of the supported platforms have MAXIMUM_ALIGNOF==8 and
+-- ALIGNOF_DOUBLE==4.  Perhaps we should just require that
+-- ALIGNOF_DOUBLE==MAXIMUM_ALIGNOF)
 --
 WITH check_columns AS (
  SELECT relname, attname,
diff --git a/src/test/regress/sql/sanity_check.sql b/src/test/regress/sql/sanity_check.sql
index 7f338d191c6..2e9d5ebef3f 100644
--- a/src/test/regress/sql/sanity_check.sql
+++ b/src/test/regress/sql/sanity_check.sql
@@ -21,12 +21,15 @@ SELECT relname, relkind
        AND relfilenode <> 0;
 
 --
--- When ALIGNOF_DOUBLE==4 (e.g. AIX), the C ABI may impose 8-byte alignment on
+-- When MAXIMUM_ALIGNOF==8 but ALIGNOF_DOUBLE==4, the C ABI may impose 8-byte alignment
 -- some of the C types that correspond to TYPALIGN_DOUBLE SQL types.  To ensure
 -- catalog C struct layout matches catalog tuple layout, arrange for the tuple
 -- offset of each fixed-width, attalign='d' catalog column to be divisible by 8
 -- unconditionally.  Keep such columns before the first NameData column of the
 -- catalog, since packagers can override NAMEDATALEN to an odd number.
+-- (XXX: I'm not sure if any of the supported platforms have MAXIMUM_ALIGNOF==8 and
+-- ALIGNOF_DOUBLE==4.  Perhaps we should just require that
+-- ALIGNOF_DOUBLE==MAXIMUM_ALIGNOF)
 --
 WITH check_columns AS (
  SELECT relname, attname,
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
index 888c8a197a9..d9fdaaaf6d0 100644
--- a/src/tools/gen_export.pl
+++ b/src/tools/gen_export.pl
@@ -16,12 +16,11 @@ GetOptions(
 	'input:s' => \$input,
 	'output:s' => \$output) or die "wrong arguments";
 
-if (not(   $format eq 'aix'
-		or $format eq 'darwin'
+if (not(   $format eq 'darwin'
 		or $format eq 'gnu'
 		or $format eq 'win'))
 {
-	die "$0: $format is not yet handled (only aix, darwin, gnu, win are)\n";
+	die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
 }
 
 open(my $input_handle, '<', $input)
@@ -56,11 +55,7 @@ while (<$input_handle>)
 	}
 	elsif (/^(\S+)\s+(\S+)/)
 	{
-		if ($format eq 'aix')
-		{
-			print $output_handle "$1\n";
-		}
-		elsif ($format eq 'darwin')
+		if ($format eq 'darwin')
 		{
 			print $output_handle "_$1\n";
 		}
diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck
index 7edfc44b49a..a46ff52cc1b 100755
--- a/src/tools/pginclude/cpluspluscheck
+++ b/src/tools/pginclude/cpluspluscheck
@@ -61,7 +61,6 @@ do
 
 	# These files are platform-specific, and c.h will include the
 	# one that's relevant for our current platform anyway.
-	test "$f" = src/include/port/aix.h && continue
 	test "$f" = src/include/port/cygwin.h && continue
 	test "$f" = src/include/port/darwin.h && continue
 	test "$f" = src/include/port/freebsd.h && continue
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 84b892b5c51..0e2d7f537ef 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -57,7 +57,6 @@ do
 
 	# These files are platform-specific, and c.h will include the
 	# one that's relevant for our current platform anyway.
-	test "$f" = src/include/port/aix.h && continue
 	test "$f" = src/include/port/cygwin.h && continue
 	test "$f" = src/include/port/darwin.h && continue
 	test "$f" = src/include/port/freebsd.h && continue
-- 
2.39.2

Reply via email to