Skip to content
Snippets Groups Projects
Commit 346900e8 authored by Tom Lane's avatar Tom Lane
Browse files

Fix shared library linking operations to work properly on all (or at

least more) combinations of HP-UX hardware, compiler, and linker.
Shinji Teragaito and Tom Lane.
parent cb792343
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California # Copyright (c) 1998, Regents of the University of California
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.77 2004/07/13 00:06:46 tgl Exp $ # $PostgreSQL: pgsql/src/Makefile.shlib,v 1.78 2004/09/02 23:06:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -148,10 +148,14 @@ endif ...@@ -148,10 +148,14 @@ endif
ifeq ($(PORTNAME), hpux) ifeq ($(PORTNAME), hpux)
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
LINK.shared = $(LD) +h $(soname) -b +b $(libdir)
ifeq ($(GCC), yes) ifeq ($(GCC), yes)
SHLIB_LINK += `$(CC) -print-libgcc-file-name` SHLIB_LINK += `$(CC) -print-libgcc-file-name`
endif endif
ifeq ($(with_gnu_ld), yes)
LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
else
LINK.shared = $(LD) +h $(soname) -b +b $(libdir)
endif
endif endif
ifeq ($(PORTNAME), irix) ifeq ($(PORTNAME), irix)
......
...@@ -11,14 +11,27 @@ ifeq ($(HAVE_POSIX_SIGNALS), no) ...@@ -11,14 +11,27 @@ ifeq ($(HAVE_POSIX_SIGNALS), no)
LIBS := -lBSD $(LIBS) LIBS := -lBSD $(LIBS)
endif endif
# Using X/Open Networking Interfaces requires to link with libxnet.
# Without specifying this, bind(), getpeername() and so on don't work
# correctly in the LP64 data model.
LIBS := -lxnet $(LIBS)
# Embed 'libdir' as the shared library search path so that the executables # Embed 'libdir' as the shared library search path so that the executables
# don't need SHLIB_PATH to be set. (We do not observe the --enable-rpath # don't need SHLIB_PATH to be set. (We do not observe the --enable-rpath
# switch here because you'd get rather bizarre behavior if you leave this # switch here because you'd get rather bizarre behavior if you leave this
# option off.) # option off.)
LDFLAGS += -Wl,+b -Wl,$(libdir) ifeq ($(with_gnu_ld), yes)
LDFLAGS += -Wl,-rpath -Wl,$(libdir)
else
LDFLAGS += -Wl,+b -Wl,$(libdir)
endif
# catch null pointer dereferences # catch null pointer dereferences
LDFLAGS += -Wl,-z ifeq ($(with_gnu_ld), yes)
# XXX what to put here?
else
LDFLAGS += -Wl,-z
endif
# set up appropriate options for shared library builds # set up appropriate options for shared library builds
export_dynamic = -Wl,-E export_dynamic = -Wl,-E
...@@ -28,16 +41,24 @@ INSTALL_SHLIB_OPTS = -m 555 ...@@ -28,16 +41,24 @@ INSTALL_SHLIB_OPTS = -m 555
AROPT = crs AROPT = crs
DLSUFFIX = .sl ifeq ($(host_cpu), ia64)
DLSUFFIX = .so
else
DLSUFFIX = .sl
endif
ifeq ($(GCC), yes) ifeq ($(GCC), yes)
CFLAGS_SL = -fpic CFLAGS_SL = -fpic
else else
CFLAGS_SL = +z CFLAGS_SL = +z
endif endif
# Rule for building shared libs (currently used only for regression test # Rule for building shared libs (currently used only for regression test
# shlib ... should go away, since this is not really enough knowledge) # shlib ... should go away, since this is not really enough knowledge)
%.sl: %.o %$(DLSUFFIX): %.o
ifeq ($(with_gnu_ld), yes)
$(CC) $(LDFLAGS) -shared -o $@ $<
else
$(LD) -b -o $@ $< $(LD) -b -o $@ $<
endif
sqlmansect = 5 sqlmansect = 5
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment