On macOS, when building with the make system, the exported symbols list
(SHLIB_EXPORTS) is ignored. I don't think that is intentional. It was
probably just forgotten, since that combination has never actually been
used until now (for libpq-oauth).
(Alternatively: Am I missing something? Is this combination not useful?
Was it not supported in older versions at some point? I couldn't
think of anything.)
The meson build system handles this correctly.
I suggest that we fix this. I attach patch 0001 with a minimal fix,
patch 0002 is a bit more refactoring to make the code match the layout
for other platforms.From 9122943d8e15497254f2f40c55b38ebbbf13241f Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Tue, 3 Jun 2025 09:41:51 +0200
Subject: [PATCH 1/2] Use exported symbols list on macOS for loadable modules
as well
---
src/Makefile.shlib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index fa81f6ffdd6..ff616beeb95 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -117,7 +117,7 @@ ifeq ($(PORTNAME), darwin)
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
else
# loadable module
- LINK.shared = $(COMPILER) -bundle
+ LINK.shared = $(COMPILER) -bundle $(exported_symbols_list)
endif
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
--
2.49.0
From 2080a21880c616a76251085d1cd9f6a47728b19e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Tue, 3 Jun 2025 09:43:56 +0200
Subject: [PATCH 2/2] Refactor export symbols list handling on macOS a bit
---
src/Makefile.shlib | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index ff616beeb95..3825af5b228 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -112,17 +112,17 @@ ifeq ($(PORTNAME), darwin)
ifneq ($(SO_MAJOR_VERSION), 0)
version_link = -compatibility_version $(SO_MAJOR_VERSION)
-current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
endif
- LINK.shared = $(COMPILER) -dynamiclib -install_name
'$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link)
$(exported_symbols_list)
+ LINK.shared = $(COMPILER) -dynamiclib -install_name
'$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link)
shlib = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
else
# loadable module
- LINK.shared = $(COMPILER) -bundle $(exported_symbols_list)
+ LINK.shared = $(COMPILER) -bundle
endif
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
ifneq (,$(exports_file))
- exported_symbols_list = -exported_symbols_list $(exports_file)
+ LINK.shared += -exported_symbols_list $(exports_file)
endif
endif
--
2.49.0