diff --git a/contrib/hstore_plperl/Makefile b/contrib/hstore_plperl/Makefile
index 19a8ab4493c6a2e2920f58b4b56d519836f66873..d789b99375af0af6edd733b561f3c2fcdf435df7 100644
--- a/contrib/hstore_plperl/Makefile
+++ b/contrib/hstore_plperl/Makefile
@@ -23,10 +23,15 @@ include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
+# In configurations that forbid undefined symbols in libraries, link with each
+# dependency.  This does preclude pgxs builds.
+ifeq ($(PORTNAME), aix)
+rpathdir = $(pkglibdir):$(perl_archlibexp)/CORE
+SHLIB_LINK += ../hstore/libhstore.exp $(perl_embed_ldflags)
+endif
 ifeq ($(PORTNAME), win32)
 # these settings are the same as for plperl
 override CPPFLAGS += -DPLPERL_HAVE_UID_GID -Wno-comment
-# This means we need an in-tree build on Windows, not a pgxs build
 SHLIB_LINK += ../hstore/libhstore.a $(wildcard ../../src/pl/plperl/libperl*.a)
 endif
 
diff --git a/contrib/hstore_plpython/Makefile b/contrib/hstore_plpython/Makefile
index 6ee434bafa80431574452b87d35dfd1c774d6ccc..395fc7375368f75dfdd3d414d846cae61ad88e66 100644
--- a/contrib/hstore_plpython/Makefile
+++ b/contrib/hstore_plpython/Makefile
@@ -23,8 +23,13 @@ include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
+# In configurations that forbid undefined symbols in libraries, link with each
+# dependency.  This does preclude pgxs builds.
+ifeq ($(PORTNAME), aix)
+rpathdir = $(pkglibdir):$(python_libdir)
+SHLIB_LINK += ../hstore/libhstore.exp $(python_libspec) $(python_additional_libs) $(wildcard ../../src/pl/plpython/libplpython*.exp)
+endif
 ifeq ($(PORTNAME), win32)
-# This means we need an in-tree build on Windows, not a pgxs build
 SHLIB_LINK += ../hstore/libhstore.a $(wildcard ../../src/pl/plpython/libpython*.a) $(wildcard ../../src/pl/plpython/libplpython*.a)
 endif
 
diff --git a/contrib/ltree_plpython/Makefile b/contrib/ltree_plpython/Makefile
index 0eeb9b83eb3b884c026054378bbd7ca7b6ae755f..20b0dcfbc587239c7abbd6dd1b45fea07886a230 100644
--- a/contrib/ltree_plpython/Makefile
+++ b/contrib/ltree_plpython/Makefile
@@ -23,8 +23,13 @@ include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
+# In configurations that forbid undefined symbols in libraries, link with each
+# dependency.  This does preclude pgxs builds.
+ifeq ($(PORTNAME), aix)
+rpathdir = $(pkglibdir):$(python_libdir)
+SHLIB_LINK += $(python_libspec) $(python_additional_libs) $(wildcard ../../src/pl/plpython/libplpython*.exp)
+endif
 ifeq ($(PORTNAME), win32)
-# This means we need an in-tree build on Windows, not a pgxs build
 SHLIB_LINK += $(wildcard ../../src/pl/plpython/libpython*.a) $(wildcard ../../src/pl/plpython/libplpython*.a)
 endif
 
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 50c3805eec02f23fc2683ed2e05b9d875412f1e0..86db52fe5e1f5b0c36ea91eff2e30a5a5a387f1e 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -111,6 +111,7 @@ ifeq ($(PORTNAME), aix)
     shlib		= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
   endif
   haslibarule   = yes
+  # $(exports_file) is also usable as an import file
   exports_file		= lib$(NAME).exp
 endif
 
@@ -341,7 +342,7 @@ $(shlib) $(stlib): $(OBJS) | $(SHLIB_PREREQS)
 	rm -f $(stlib)
 	$(LINK.static) $(stlib) $^
 	$(RANLIB) $(stlib)
-	$(MKLDEXPORT) $(stlib) >$(exports_file)
+	$(MKLDEXPORT) $(stlib) $(shlib) >$(exports_file)
 	$(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
 	rm -f $(stlib)
 	$(AR) $(AROPT) $(stlib) $(shlib)