summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2021-07-01 14:45:12 +0000
committerTom Lane2021-07-01 14:45:12 +0000
commit2f7bae2f924d8213a76370f825dc15eb0aa79796 (patch)
treea6beb6628683b04d023dde2f3b1da4785dfcf5ae
parenta0fc813266467d666b8f09ccccaccb700326a296 (diff)
Improve build-time check that libpq doesn't call exit().
Further fixes for commit dc227eb82. Per suggestion from Peter Eisentraut, use a stamp-file to control when the check is run, avoiding repeated executions during "make all". Also, remove "-g" switch for nm: it's useless and some versions of nm consider it to conflict with "-u". (Thanks to Noah Misch for running down that portability issue.) Discussion: https://postgr.es/m/3128896.1624742969@sss.pgh.pa.us
-rw-r--r--src/interfaces/libpq/.gitignore1
-rw-r--r--src/interfaces/libpq/Makefile10
2 files changed, 6 insertions, 5 deletions
diff --git a/src/interfaces/libpq/.gitignore b/src/interfaces/libpq/.gitignore
index a4afe7c1c68..7478dc344ac 100644
--- a/src/interfaces/libpq/.gitignore
+++ b/src/interfaces/libpq/.gitignore
@@ -1 +1,2 @@
/exports.list
+/libpq-refs-stamp
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index c2a35a488af..dcc693024f1 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -96,7 +96,7 @@ SHLIB_EXPORTS = exports.txt
PKG_CONFIG_REQUIRES_PRIVATE = libssl libcrypto
-all: all-lib check-libpq-refs
+all: all-lib libpq-refs-stamp
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
@@ -108,9 +108,9 @@ backend_src = $(top_srcdir)/src/backend
# If nm doesn't exist or doesn't work on shlibs, this test will do nothing,
# which is fine. The exclusion of __cxa_atexit is necessary on OpenBSD,
# which seems to insert references to that even in pure C code.
-.PHONY: check-libpq-refs
-check-libpq-refs: $(shlib)
- ! nm -A -g -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit
+libpq-refs-stamp: $(shlib)
+ ! nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit
+ touch $@
# Make dependencies on pg_config_paths.h visible in all builds.
fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h
@@ -141,7 +141,7 @@ uninstall: uninstall-lib
clean distclean: clean-lib
$(MAKE) -C test $@
- rm -f $(OBJS) pthread.h
+ rm -f $(OBJS) pthread.h libpq-refs-stamp
# Might be left over from a Win32 client-only build
rm -f pg_config_paths.h