From e267adc80aaeb98f4611f42f24a067957ee7d0cc Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Thu, 10 Jun 2010 15:54:25 -0700 Subject: [PATCH] 6960394: Stop linking with -lnsl on Linux Define LIBNSL (like LIBSOCKET), non-empty only on Solaris Reviewed-by: ohair --- jdk/make/common/Defs-linux.gmk | 1 + jdk/make/common/Defs-solaris.gmk | 3 +++ jdk/make/java/hpi/hpi_common.gmk | 2 +- jdk/make/java/java/Makefile | 2 +- jdk/make/java/java_hprof_demo/Makefile | 2 +- jdk/make/java/net/Makefile | 2 +- jdk/make/jpda/transport/socket/Makefile | 4 ++-- jdk/make/mkdemo/jvmti/hprof/Makefile | 4 ++-- jdk/src/share/demo/jvmti/hprof/sample.makefile.txt | 2 +- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/jdk/make/common/Defs-linux.gmk b/jdk/make/common/Defs-linux.gmk index 0ef4a2890e3..e74272ded6e 100644 --- a/jdk/make/common/Defs-linux.gmk +++ b/jdk/make/common/Defs-linux.gmk @@ -311,6 +311,7 @@ override LIBCXX = -lstdc++ endif override LIBPOSIX4 = override LIBSOCKET = +override LIBNSL = override LIBTHREAD = override MOOT_PRIORITIES = true override NO_INTERRUPTIBLE_IO = true diff --git a/jdk/make/common/Defs-solaris.gmk b/jdk/make/common/Defs-solaris.gmk index bb675ef1996..2ea749a018f 100644 --- a/jdk/make/common/Defs-solaris.gmk +++ b/jdk/make/common/Defs-solaris.gmk @@ -658,6 +658,9 @@ LIBM = /usr/lib$(ISA_DIR)/libm.so.1 # Socket library LIBSOCKET = -lsocket +# Network Services library +LIBNSL = -lnsl + # GLOBAL_KPIC: If set means all libraries are PIC, position independent code # EXCEPT for select compiles # If a .o file is compiled non-PIC then it should be forced diff --git a/jdk/make/java/hpi/hpi_common.gmk b/jdk/make/java/hpi/hpi_common.gmk index 5f77038309f..025d2de1084 100644 --- a/jdk/make/java/hpi/hpi_common.gmk +++ b/jdk/make/java/hpi/hpi_common.gmk @@ -86,5 +86,5 @@ endif # Things that must be linked in. # ifneq ($(PLATFORM), windows) -OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl +OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) $(LIBM) -ldl endif diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile index 60542f2adbb..827a0ec176f 100644 --- a/jdk/make/java/java/Makefile +++ b/jdk/make/java/java/Makefile @@ -204,7 +204,7 @@ ifeq ($(PLATFORM),windows) OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib else -OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \ +OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) endif diff --git a/jdk/make/java/java_hprof_demo/Makefile b/jdk/make/java/java_hprof_demo/Makefile index f051de0c52f..b6d0539adc9 100644 --- a/jdk/make/java/java_hprof_demo/Makefile +++ b/jdk/make/java/java_hprof_demo/Makefile @@ -84,7 +84,7 @@ OTHER_INCLUDES = -I$(SRCDIR) \ ifeq ($(PLATFORM), windows) OTHER_LDLIBS += wsock32.lib winmm.lib else - OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl + OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl endif # diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile index ca898e53a6a..0021087cbcf 100644 --- a/jdk/make/java/net/Makefile +++ b/jdk/make/java/net/Makefile @@ -96,7 +96,7 @@ include $(BUILDDIR)/common/Library.gmk ifeq ($(PLATFORM), windows) OTHER_LDLIBS = ws2_32.lib $(JVMLIB) else - OTHER_LDLIBS = $(LIBSOCKET) -lnsl -ldl $(JVMLIB) + OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB) endif ifeq ($(PLATFORM), linux) OTHER_LDLIBS += -lpthread diff --git a/jdk/make/jpda/transport/socket/Makefile b/jdk/make/jpda/transport/socket/Makefile index a048e24b4e4..ee7980c7bdf 100644 --- a/jdk/make/jpda/transport/socket/Makefile +++ b/jdk/make/jpda/transport/socket/Makefile @@ -38,11 +38,11 @@ FILES_m = mapfile-vers include $(BUILDDIR)/common/Defs.gmk ifeq ($(PLATFORM), linux) - OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread + OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET) -lpthread endif ifeq ($(PLATFORM), solaris) - OTHER_LDLIBS += -lnsl $(LIBSOCKET) + OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET) endif ifeq ($(PLATFORM), windows) diff --git a/jdk/make/mkdemo/jvmti/hprof/Makefile b/jdk/make/mkdemo/jvmti/hprof/Makefile index 9a3cd19eee8..b0c703f6734 100644 --- a/jdk/make/mkdemo/jvmti/hprof/Makefile +++ b/jdk/make/mkdemo/jvmti/hprof/Makefile @@ -39,10 +39,10 @@ ifeq ($(PLATFORM), windows) EXTRA_LIBS += wsock32.lib winmm.lib endif ifeq ($(PLATFORM), solaris) - OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl + OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl endif ifeq ($(PLATFORM), linux) - OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl -lpthread + OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl -lpthread endif # diff --git a/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt b/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt index 4b7499e4079..3766a287783 100644 --- a/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt +++ b/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt @@ -132,7 +132,7 @@ ifeq ($(OSNAME), linux) LIBRARY=lib$(LIBNAME).so LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text # Libraries we are dependent on - LIBRARIES= -lnsl -ldl -lc + LIBRARIES= -ldl -lc # Building a shared library LINK_SHARED=$(LINK.c) -shared -o $@ endif