From 47c8a2f0848f7d58cb1c8507b6122d9fa1c7ca4a Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Fri, 21 Mar 2003 03:31:00 +0000 Subject: [PATCH] Bugzilla 198481: fixed all build problems with gcc on Solaris. 1. Removed the workarounds we put in before -- hardcoding LD to /usr/ccs/bin/ld and passing the -B/usr/ccs/bin/ flag to gcc. 2. Use the compiler, $(CC), to build shared libraries. 3. If gcc is used, determine whether gcc uses GNU ld or Solaris ld and set the new make variable GCC_USE_GNU_LD accordingly. Modified Files: coreconf/SunOS5.mk nss/cmd/platlibs.mk nss/lib/freebl/Makefile --- security/coreconf/SunOS5.mk | 23 +++++++++++++++++++---- security/nss/cmd/platlibs.mk | 4 +++- security/nss/lib/freebl/Makefile | 7 +++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/security/coreconf/SunOS5.mk b/security/coreconf/SunOS5.mk index 7f54ea4fd12c..2f9e190e2932 100644 --- a/security/coreconf/SunOS5.mk +++ b/security/coreconf/SunOS5.mk @@ -73,8 +73,6 @@ else endif endif -LD=/usr/ccs/bin/ld - # # The default implementation strategy for Solaris is classic nspr. # @@ -132,10 +130,23 @@ endif # Purify doesn't like -MDupdate NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS) -MKSHLIB = $(LD) $(DSO_LDOPTS) +MKSHLIB = $(CC) $(DSO_LDOPTS) +ifdef NS_USE_GCC +ifeq (GNU,$(findstring GNU,$(shell `$(CC) -print-prog-name=ld` -v 2>&1))) + GCC_USE_GNU_LD = 1 +endif +endif ifdef MAPFILE +ifdef NS_USE_GCC +ifdef GCC_USE_GNU_LD + MKSHLIB += -Wl,--version-script,$(MAPFILE) +else + MKSHLIB += -Wl,-M,$(MAPFILE) +endif +else MKSHLIB += -M $(MAPFILE) endif +endif PROCESS_MAP_FILE = grep -v ';-' $(LIBRARY_NAME).def | \ sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ @@ -145,7 +156,11 @@ PROCESS_MAP_FILE = grep -v ';-' $(LIBRARY_NAME).def | \ # ld options: # -G: produce a shared object # -z defs: no unresolved symbols allowed -DSO_LDOPTS += -G -h $(notdir $@) +ifdef NS_USE_GCC + DSO_LDOPTS += -shared -h $(notdir $@) +else + DSO_LDOPTS += -G -h $(notdir $@) +endif # -KPIC generates position independent code for use in shared libraries. # (Similarly for -fPIC in case of gcc.) diff --git a/security/nss/cmd/platlibs.mk b/security/nss/cmd/platlibs.mk index 93fcdf2a18db..0a131c297c35 100644 --- a/security/nss/cmd/platlibs.mk +++ b/security/nss/cmd/platlibs.mk @@ -192,7 +192,9 @@ endif # Use the Solaris ld, which knows where to find libsoftokn3.so. ifeq ($(OS_ARCH), SunOS) ifdef NS_USE_GCC -EXTRA_SHARED_LIBS += -B/usr/ccs/bin/ +ifdef GCC_USE_GNU_LD +EXTRA_SHARED_LIBS += -Wl,-rpath-link,$(DIST)/lib +endif endif endif diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile index 632895e2f7b9..ba73f4e8cc53 100644 --- a/security/nss/lib/freebl/Makefile +++ b/security/nss/lib/freebl/Makefile @@ -165,8 +165,11 @@ endif ifeq ($(SYSV_SPARC),1) SOLARIS_AS = /usr/ccs/bin/as ifdef NS_USE_GCC -LD = gcc -DSO_LDOPTS = -B/usr/ccs/bin/ -shared -h,$(notdir $@) -Wl,-B,symbolic,-z,defs,-z,now,-z,text,-M,mapfile.Solaris +ifdef GCC_USE_GNU_LD +MKSHLIB += -Wl,-Bsymbolic,-z,defs,-z,now,-z,text,--version-script,mapfile.Solaris +else +MKSHLIB += -Wl,-B,symbolic,-z,defs,-z,now,-z,text,-M,mapfile.Solaris +endif else MKSHLIB += -B symbolic -z defs -z now -z text -M mapfile.Solaris endif