1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-13 14:22:43 +03:00

libpq: Refactor logic checking for exit() in shared library builds

This commit refactors the sanity check done by libpq to ensure that
there is no exit() reference in the build, moving the check from a
standalone Makefile rule to a perl script.

Platform-specific checks are now part of the script, avoiding most of
the duplication created by the introduction of this check for meson, but
not all of them:
- Solaris and Windows skipped in the script.
- Whitelist of symbols is in the script.
- nm availability, with its path given as an option of the script.  Its
execution is checked in the script.
- Check is disabled if coverage reports are enabled.  This part is not
pushed down to the script.
- Check is disabled for static builds of libpq.  This part is filtered
out in each build script.

A trick is required for the stamp file, in the shape of an optional
argument that can be given to the script.  Meson expects the stamp in
output and uses this argument, generating the stamp file in the script.
Meson is able to handle the removal of the stamp file internally when
libpq needs to be rebuilt and the check done again.

This refactoring piece has come up while discussing the addition of more
items in the symbols considered as acceptable.

This sanity check has never been run by meson since its introduction in
dc227eb82e, so it is possible that this fails in some of the buildfarm
members.  At least the CI is happy with it, but let's see how it goes.

Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Co-authored-by: VASUKI M <vasukim1992002@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org
This commit is contained in:
Michael Paquier
2025-12-09 10:39:08 +09:00
parent c004d68c93
commit 4a8e6f43a6
7 changed files with 161 additions and 17 deletions

42
configure vendored
View File

@@ -682,6 +682,7 @@ FLEXFLAGS
FLEX
BISONFLAGS
BISON
NM
MKDIR_P
LN_S
TAR
@@ -10162,6 +10163,47 @@ case $MKDIR_P in
*install-sh*) MKDIR_P='\${SHELL} \${top_srcdir}/config/install-sh -c -d';;
esac
# Extract the first word of "nm", so it can be a program name with args.
set dummy nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $NM in
[\\/]* | ?:[\\/]*)
ac_cv_path_NM="$NM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_NM="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
NM=$ac_cv_path_NM
if test -n "$NM"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
$as_echo "$NM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -z "$BISON"; then
for ac_prog in bison
do