The shared library code has some support for non-ELF BSD systems.  I
suspect that this is long obsolete.  Could we remove it?  See attached.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 3f21b2e13226dc1e0f5ea2fc2f7844825e5610ce Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 12 Jun 2019 15:51:57 +0200
Subject: [PATCH] Remove support for non-ELF BSD systems

This is long obsolete.
---
 configure.in                   | 24 ------------
 src/Makefile.global.in         |  4 --
 src/Makefile.shlib             | 71 ++++++++++++++--------------------
 src/makefiles/Makefile.freebsd | 12 ------
 src/makefiles/Makefile.netbsd  | 14 -------
 src/makefiles/Makefile.openbsd | 12 ------
 6 files changed, 28 insertions(+), 109 deletions(-)

diff --git a/configure.in b/configure.in
index 4586a1716c..dff6a1ae50 100644
--- a/configure.in
+++ b/configure.in
@@ -964,30 +964,6 @@ PGAC_ARG_BOOL(with, zlib, yes,
               [do not use Zlib])
 AC_SUBST(with_zlib)
 
-#
-# Elf
-#
-
-# Assume system is ELF if it predefines __ELF__ as 1,
-# otherwise believe host_os based default.
-case $host_os in
-    freebsd1*|freebsd2*) elf=no;;
-    freebsd3*|freebsd4*) elf=yes;;
-esac
-
-AC_EGREP_CPP(yes,
-[#if __ELF__
-  yes
-#endif
-],
-[ELF_SYS=true],
-[if test "X$elf" = "Xyes" ; then
-  ELF_SYS=true
-else
-  ELF_SYS=
-fi])
-AC_SUBST(ELF_SYS)
-
 #
 # Assignments
 #
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index b9d86acaa9..321af38b0c 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -506,10 +506,6 @@ host_tuple = @host@
 host_os = @host_os@
 host_cpu = @host_cpu@
 
-# This is mainly for use on FreeBSD, where we have both a.out and elf
-# systems now.  May be applicable to other systems to?
-ELF_SYSTEM= @ELF_SYS@
-
 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
 WIN32_STACK_RLIMIT=4194304
 
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 373d73caef..c4893edfc3 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -139,57 +139,42 @@ ifeq ($(PORTNAME), darwin)
 endif
 
 ifeq ($(PORTNAME), openbsd)
-  ifdef ELF_SYSTEM
-    LINK.shared                = $(COMPILER) -shared
-    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
+  LINK.shared          = $(COMPILER) -shared
+  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
 endif
 
 ifeq ($(PORTNAME), freebsd)
-  ifdef ELF_SYSTEM
-    ifdef SO_MAJOR_VERSION
-      shlib            = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
-    endif
-    LINK.shared                = $(COMPILER) -shared
-    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
-  else
-    ifdef SO_MAJOR_VERSION
-      shlib            = 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
-    endif
-    LINK.shared                = $(LD) -x -Bshareable -Bforcearchive
+  ifdef SO_MAJOR_VERSION
+    shlib              = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+  endif
+  LINK.shared          = $(COMPILER) -shared
+  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
 endif
 
 ifeq ($(PORTNAME), netbsd)
-  ifdef ELF_SYSTEM
-    LINK.shared                = $(COMPILER) -shared
-    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
-  else
-    LINK.shared                = $(LD) -x -Bshareable -Bforcearchive
+  LINK.shared          = $(COMPILER) -shared
+  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
 endif
 
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index 98a6f50615..c462e2fd58 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -1,9 +1,7 @@
 AROPT = cr
 
-ifdef ELF_SYSTEM
 export_dynamic = -Wl,-export-dynamic
 rpath = -Wl,-R'$(rpathdir)'
-endif
 
 DLSUFFIX = .so
 
@@ -20,14 +18,4 @@ endef
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-ifdef ELF_SYSTEM
        $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
-else
-       $(LD) $(LDREL) $(LDOUT) $<.obj -x $<
-       @echo building shared object $@
-       @rm -f $@.pic
-       @${AR} cq $@.pic $<.obj
-       ${RANLIB} $@.pic
-       @rm -f $@
-       $(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
-endif
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
index 7bb9721fa5..15695fb65c 100644
--- a/src/makefiles/Makefile.netbsd
+++ b/src/makefiles/Makefile.netbsd
@@ -1,11 +1,7 @@
 AROPT = cr
 
-ifdef ELF_SYSTEM
 export_dynamic = -Wl,-E
 rpath = -Wl,-R'$(rpathdir)'
-else
-rpath = -Wl,-R'$(rpathdir)'
-endif
 
 DLSUFFIX = .so
 
@@ -14,14 +10,4 @@ CFLAGS_SL = -fPIC -DPIC
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-ifdef ELF_SYSTEM
        $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
-else
-       $(LD) $(LDREL) $(LDOUT) $<.obj -x $<
-       @echo building shared object $@
-       @rm -f $@.pic
-       @${AR} cq $@.pic $<.obj
-       ${RANLIB} $@.pic
-       @rm -f $@
-       $(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
-endif
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
index eda311087c..15695fb65c 100644
--- a/src/makefiles/Makefile.openbsd
+++ b/src/makefiles/Makefile.openbsd
@@ -1,9 +1,7 @@
 AROPT = cr
 
-ifdef ELF_SYSTEM
 export_dynamic = -Wl,-E
 rpath = -Wl,-R'$(rpathdir)'
-endif
 
 DLSUFFIX = .so
 
@@ -12,14 +10,4 @@ CFLAGS_SL = -fPIC -DPIC
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-ifdef ELF_SYSTEM
        $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@
-else
-       $(LD) $(LDREL) $(LDOUT) $<.obj -x $<
-       @echo building shared object $@
-       @rm -f $@.pic
-       @${AR} cq $@.pic $<.obj
-       ${RANLIB} $@.pic
-       @rm -f $@
-       $(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
-endif
-- 
2.22.0

Reply via email to