From 9cf0a82fc3ca98829b3a0f7f949cd0cbd7219fae Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Sat, 16 Dec 2000 18:14:25 +0000
Subject: [PATCH] Fix linker options for ODBC driver.  See comment in
 src/interfaces/odbc/GNUmakefile.

---
 src/interfaces/odbc/GNUmakefile | 7 ++++++-
 src/makefiles/Makefile.bsdi     | 1 +
 src/makefiles/Makefile.freebsd  | 1 +
 src/makefiles/Makefile.irix5    | 1 +
 src/makefiles/Makefile.linux    | 1 +
 src/makefiles/Makefile.netbsd   | 1 +
 src/makefiles/Makefile.openbsd  | 1 +
 src/makefiles/Makefile.solaris  | 4 ++--
 src/makefiles/Makefile.unixware | 2 ++
 9 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/interfaces/odbc/GNUmakefile b/src/interfaces/odbc/GNUmakefile
index a6aedb936ad..7a1542f3d41 100644
--- a/src/interfaces/odbc/GNUmakefile
+++ b/src/interfaces/odbc/GNUmakefile
@@ -2,7 +2,7 @@
 #
 # GNUMakefile for psqlodbc (Postgres ODBC driver)
 #
-# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.7 2000/10/28 15:10:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.8 2000/12/16 18:14:25 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -30,6 +30,11 @@ all: all-lib
 # Shared library stuff
 include $(top_srcdir)/src/Makefile.shlib
 
+# Symbols must be resolved to the version in the shared library because
+# the driver manager (e.g., iodbc) provides some symbols with the same
+# names and we don't want those.  (This issue is probably ELF specific.)
+LINK.shared += $(shlib_symbolic)
+
 odbc_headers = isql.h isqlext.h iodbc.h
 odbc_includedir = $(includedir)/iodbc
 
diff --git a/src/makefiles/Makefile.bsdi b/src/makefiles/Makefile.bsdi
index a95fd312346..943c179b70b 100644
--- a/src/makefiles/Makefile.bsdi
+++ b/src/makefiles/Makefile.bsdi
@@ -15,6 +15,7 @@ endif
 ifeq ($(DLSUFFIX), .so)
 CFLAGS_SL = -fpic
 export_dynamic = -export-dynamic
+shlib_symbolic = -Bsymbolic
 else
 CFLAGS_SL =
 endif
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index 91a45a63632..ef5613f98fa 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -3,6 +3,7 @@ AROPT = cr
 ifdef ELF_SYSTEM
 export_dynamic = -export-dynamic
 rpath = -R$(libdir)
+shlib_symbolic = -Bsymbolic
 endif
 
 DLSUFFIX = .so
diff --git a/src/makefiles/Makefile.irix5 b/src/makefiles/Makefile.irix5
index 956c4217c48..d90fcd9a6eb 100644
--- a/src/makefiles/Makefile.irix5
+++ b/src/makefiles/Makefile.irix5
@@ -1,6 +1,7 @@
 MK_NO_LORDER= true
 AROPT = crs
 rpath = -Wl,-rpath,$(libdir)
+shlib_symbolic = -Wl,-B,symbolic
 
 DLSUFFIX = .so
 # PIC is default
diff --git a/src/makefiles/Makefile.linux b/src/makefiles/Makefile.linux
index 3834552ec38..11bef1572c6 100644
--- a/src/makefiles/Makefile.linux
+++ b/src/makefiles/Makefile.linux
@@ -1,6 +1,7 @@
 AROPT = crs
 export_dynamic = -export-dynamic
 rpath = -Wl,-rpath,$(libdir)
+shlib_symbolic = -Wl,-Bsymbolic
 DLSUFFIX = .so
 CFLAGS_SL = -fpic
 
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
index a9fd5a43b40..5cb80850587 100644
--- a/src/makefiles/Makefile.netbsd
+++ b/src/makefiles/Makefile.netbsd
@@ -3,6 +3,7 @@ AROPT = cr
 ifdef ELF_SYSTEM
 export_dynamic = -Wl,-E
 rpath = -Wl,-R$(libdir)
+shlib_symbolic = -Wl,-Bsymbolic
 endif
 
 DLSUFFIX = .so
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
index eeaa40743f4..2ce2ca8ba1c 100644
--- a/src/makefiles/Makefile.openbsd
+++ b/src/makefiles/Makefile.openbsd
@@ -3,6 +3,7 @@ AROPT = cr
 ifdef ELF_SYSTEM
 export_dynamic = -Wl,-E
 rpath = -R$(libdir)
+shlib_symbolic = -Bsymbolic
 endif
 
 DLSUFFIX = .so
diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
index e8d23c948f2..56fb5c5f058 100644
--- a/src/makefiles/Makefile.solaris
+++ b/src/makefiles/Makefile.solaris
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.5 2000/11/04 16:35:55 petere Exp $
+# $Header: /cvsroot/pgsql/src/makefiles/Makefile.solaris,v 1.6 2000/12/16 18:14:25 petere Exp $
 
 AROPT = crs
 
@@ -8,7 +8,7 @@ rpath = -Wl,-rpath,$(libdir)
 else
 rpath = -Wl,-R$(libdir)
 endif
-
+shlib_symbolic = -Wl,-Bsymbolic
 
 DLSUFFIX = .so
 ifeq ($(GCC), yes)
diff --git a/src/makefiles/Makefile.unixware b/src/makefiles/Makefile.unixware
index 698ea98118e..bc2ddcad36d 100644
--- a/src/makefiles/Makefile.unixware
+++ b/src/makefiles/Makefile.unixware
@@ -3,6 +3,8 @@ export_dynamic = -Wl,-Bexport
 ifeq ($(ld_R_works), yes)
 rpath = -Wl,-R$(libdir)
 endif
+shlib_symbolic = -Wl,-Bsymbolic
+
 DLSUFFIX = .so
 ifeq ($(GCC), yes)
 CFLAGS_SL = -fpic
-- 
GitLab