From 8307b092b78c514ca1ca09d5cc9900bc2b672095 Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Tue, 6 Jul 2010 03:55:33 +0000 Subject: [PATCH] Still more third thoughts: when linking shared libraries, LDFLAGS probably needs to appear before anything placed in SHLIB_LINK. This is because SHLIB_LINK is typically a subset of LIBS, and LIBS has to appear after LDFLAGS on platforms that are sensitive to the relative order of -L and -l switches. --- src/Makefile.shlib | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Makefile.shlib b/src/Makefile.shlib index 61984935612..f3dc2409b93 100644 --- a/src/Makefile.shlib +++ b/src/Makefile.shlib @@ -6,7 +6,7 @@ # Copyright (c) 1998, Regents of the University of California # # IDENTIFICATION -# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.124 2010/07/05 18:54:37 tgl Exp $ +# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.125 2010/07/06 03:55:33 tgl Exp $ # #------------------------------------------------------------------------- @@ -78,9 +78,6 @@ LINK.static = $(AR) $(AROPT) -# Automatically append LDFLAGS and LDFLAGS_SL to SHLIB_LINK -SHLIB_LINK += $(LDFLAGS) $(LDFLAGS_SL) - ifdef SO_MAJOR_VERSION # Default library naming convention used by the majority of platforms ifeq ($(enable_shared), yes) @@ -355,7 +352,7 @@ ifneq ($(PORTNAME), aix) # Normal case $(shlib): $(OBJS) - $(LINK.shared) -o $@ $(OBJS) $(SHLIB_LINK) + $(LINK.shared) -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) ifdef shlib_major # If we're using major and minor versions, then make a symlink to major-version-only. ifneq ($(shlib), $(shlib_major)) @@ -389,7 +386,7 @@ $(shlib) $(stlib): $(OBJS) $(LINK.static) $(stlib) $^ $(RANLIB) $(stlib) $(MKLDEXPORT) $(stlib) >$(exports_file) - $(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(SHLIB_LINK) + $(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) rm -f $(stlib) $(AR) $(AROPT) $(stlib) $(shlib) @@ -412,7 +409,7 @@ DLL_DEFFILE = lib$(NAME)dll.def endif $(shlib): $(OBJS) $(DLL_DEFFILE) - $(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK) + $(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(stlib): $(shlib) $(DLL_DEFFILE) $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@ -- GitLab