Skip to content

Commit 8307b09

Browse files
committed
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.
1 parent 0a4ecfe commit 8307b09

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Makefile.shlib

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Copyright (c) 1998, Regents of the University of California
77
#
88
# IDENTIFICATION
9-
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.124 2010/07/05 18:54:37 tgl Exp $
9+
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.125 2010/07/06 03:55:33 tgl Exp $
1010
#
1111
#-------------------------------------------------------------------------
1212

@@ -78,9 +78,6 @@ LINK.static = $(AR) $(AROPT)
7878

7979

8080

81-
# Automatically append LDFLAGS and LDFLAGS_SL to SHLIB_LINK
82-
SHLIB_LINK += $(LDFLAGS) $(LDFLAGS_SL)
83-
8481
ifdef SO_MAJOR_VERSION
8582
# Default library naming convention used by the majority of platforms
8683
ifeq ($(enable_shared), yes)
@@ -355,7 +352,7 @@ ifneq ($(PORTNAME), aix)
355352

356353
# Normal case
357354
$(shlib): $(OBJS)
358-
$(LINK.shared) -o $@ $(OBJS) $(SHLIB_LINK)
355+
$(LINK.shared) -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
359356
ifdef shlib_major
360357
# If we're using major and minor versions, then make a symlink to major-version-only.
361358
ifneq ($(shlib), $(shlib_major))
@@ -389,7 +386,7 @@ $(shlib) $(stlib): $(OBJS)
389386
$(LINK.static) $(stlib) $^
390387
$(RANLIB) $(stlib)
391388
$(MKLDEXPORT) $(stlib) >$(exports_file)
392-
$(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(SHLIB_LINK)
389+
$(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
393390
rm -f $(stlib)
394391
$(AR) $(AROPT) $(stlib) $(shlib)
395392

@@ -412,7 +409,7 @@ DLL_DEFFILE = lib$(NAME)dll.def
412409
endif
413410

414411
$(shlib): $(OBJS) $(DLL_DEFFILE)
415-
$(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
412+
$(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
416413

417414
$(stlib): $(shlib) $(DLL_DEFFILE)
418415
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy