diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 95b82a6..1555be3 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -149,6 +149,11 @@ ifeq ($(PORTNAME), openbsd)
     ifdef soname
       LINK.shared	+= -Wl,-x,-soname,$(soname)
     endif
+    BUILD.exports	= ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
+    exports_file	= $(SHLIB_EXPORTS:%.txt=%.list)
+    ifneq (,$(exports_file))
+      LINK.shared	+= -Wl,--version-script=$(exports_file)
+    endif
     SHLIB_LINK		+= -lc
   else
     LINK.shared		= $(LD) -x -Bshareable -Bforcearchive
