0001-Support-for-AIX-all-meson.pg19.patch
application/octet-stream
Filename: 0001-Support-for-AIX-all-meson.pg19.patch
Type: application/octet-stream
Part: 0
Message:
RE: AIX support
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch 0001
| File | + | − |
|---|---|---|
| meson.build | 75 | 6 |
| src/backend/meson.build | 18 | 0 |
| src/interfaces/ecpg/compatlib/meson.build | 2 | 0 |
| src/interfaces/ecpg/ecpglib/meson.build | 2 | 0 |
| src/interfaces/ecpg/pgtypeslib/meson.build | 2 | 0 |
| src/interfaces/libpq/meson.build | 2 | 0 |
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@0@.a'
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 = '@0@.imp'
+ 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,