Greetings all.

Attached is a patch that aims to fix a bug that manifests itself when running 64-bit builds on SPARC Solaris. The issue that arises is that dynamic builds of this type use the LD_LIBRARY_PATH_64 variable to determine where to locate shared libraries, rather than the LD_LIBRARY_PATH variable used almost everywhere else. This patch attempts to replace all instances of LD_LIBRARY_PATH with the new make variable LD_PATH_REF.

--Andrew Black

Changlog:
        * GNUmakefile (LD_PATH_REF): Document variable, define default value
          ($(MAKEFILE_IN)): Define LD_PATH_REF in generated file
          (post): use $(LD_PATH_REF) rather than LD_LIBRARY_PATH
        * GNUmakefile.cfg (run): Ditto.
        * makefile.rules (%.out, run): Ditto.
        * sunpro.config [sparc && wide]: Set LD_PATH_REF to LD_LIBRARY_PATH_64
Index: GNUmakefile
===================================================================
--- GNUmakefile	(revision 470984)
+++ GNUmakefile	(working copy)
@@ -111,6 +111,8 @@
 #
 #   LDLIBS    - set of system libraries to link executables with
 #
+#   LD_PATH_REF - Name of library search path environment variable
+#
 #   PHDIR     - directory containing the PlumHall testsuite distribution
 #                 (e.g., ".../lvs99a")
 #
@@ -525,6 +527,14 @@
   # #defined in the rw/_config.h library header
   LIBVER := $(shell awk '/^.define _RWSTD_VER / { major = substr ($$3, 3, 2); minor = substr ($$3, 5, 2); micro = substr ($$3, 7, 2); print (major + 0) "." (minor + 0) "." (micro + 0) }' $(TOPDIR)/include/rw/_config.h)
 
+  # LD_PATH_REF is an abstraction, naming the environmenal variable 
+  # use for the library search path.  This is needed for producing output
+  # for 64 bit executables on SPARC Solaris
+
+  ifeq ($(LD_PATH_REF),)
+	LD_PATH_REF=LD_LIBRARY_PATH
+  endif
+
 ### TARGETS ##################################################################
 
 all: libstd
@@ -581,6 +591,7 @@
           && echo "LDFLAGS    = $(LDFLAGS)"              >> $(MAKEFILE_IN)  \
           && echo "LDLIBS     = $(LDLIBS)"               >> $(MAKEFILE_IN)  \
           && echo "LDSOFLAGS  = $(LDSOFLAGS)"            >> $(MAKEFILE_IN)  \
+          && echo "LD_PATH_REF = $(LD_PATH_REF)"         >> $(MAKEFILE_IN)  \
           && echo "MAPFLAGS   = $(MAPFLAGS)"             >> $(MAKEFILE_IN)  \
           && [ "$(MAPFILE)" = "" ]                                          \
           || echo "MAPFILE    = $$""(TOPDIR)/$(MAPFILE)" >> $(MAKEFILE_IN)  \
@@ -707,7 +718,7 @@
           ltsts=`$(MAKE) -C$(BUILDDIR)/bin listruntarget |                    \
                 sed -n "n;p" | tr ' ' '\n' | sed "s:^:../bin/:g"`;            \
           (cd post;                                                           \
-           LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH                        \
+           $(LD_PATH_REF)=$(LIBDIR):$$$(LD_PATH_REF)                          \
            PATH=$(BUILDDIR)/bin:$$PATH                                        \
            ../run $(RUNFLAGS) -d "$$desc" -X "-C $(CXX)-$(CCVER)" -r $$last   \
                   -T "$$ts0,$$ts1,$$ts2" --log $$log $$ltsts $$tsts           \
Index: etc/config/GNUmakefile.cfg
===================================================================
--- etc/config/GNUmakefile.cfg	(revision 470984)
+++ etc/config/GNUmakefile.cfg	(working copy)
@@ -223,9 +223,9 @@
                   test -f $$file.o -a ! $$? -eq 0 ;                      \
               else                                                       \
                   echo "./$$file" >>$(LOGFILE) ;                         \
-                  LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:. ;                  \
+                  $(LD_PATH_REF)=$$$(LD_PATH_REF):. ;                    \
                   LIBPATH=$$LIBPATH:. ;                                  \
-                  export LIBPATH LD_LIBRARY_PATH ;                       \
+                  export LIBPATH $(LD_PATH_REF) ;                        \
                   text=`./$$file` ;                                      \
               fi;                                                        \
               res=$$? ;                                                  \
Index: etc/config/sunpro.config
===================================================================
--- etc/config/sunpro.config	(revision 470984)
+++ etc/config/sunpro.config	(working copy)
@@ -82,6 +82,12 @@
     # narrow (32-bit) flags are implicit on SPARC
     wide_flags     = -xarch=v9
     narrow_flags   = -xarch=v8
+
+    # wide (64-bit) builds on sparc use a different LD_PATH_REF than narrow
+    # (32-bit) builds.
+    ifeq ($(findstring wide,$(BUILDMODE)),wide)
+      LD_PATH_REF=LD_LIBRARY_PATH_64
+    endif
 else
     # wide (64-bit) flags -- must be set explicitly
     # narrow (32-bit) flags are implicit on AMD64
Index: etc/config/makefile.rules
===================================================================
--- etc/config/makefile.rules	(revision 470984)
+++ etc/config/makefile.rules	(working copy)
@@ -85,7 +85,7 @@
 
 # produce a .out file by running the executable
 %.out: %
-	LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIR) ./$< >$@ 2>&1
+	$(LD_PATH_REF)=$$$(LD_PATH_REF):$(LIBDIR) ./$< >$@ 2>&1
 
 # create a script that when run first builds the executable and then runs it
 # done to save even more space than `NO_DOT_O' on constrained systems
@@ -110,10 +110,10 @@
 # for all "top level" tests that failed to build, find and build all
 # subtests (the little tests the main test consists of)
 run runall run_all: $(BINDIR)/exec
-	@(LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIR);                    \
+	@($(LD_PATH_REF)=$$$(LD_PATH_REF):$(LIBDIR);                      \
         PATH=$$PATH:.;                                                    \
         TOPDIR=$(TOPDIR);                                                 \
-        export LD_LIBRARY_PATH PATH TOPDIR;                               \
+        export $(LD_PATH_REF) PATH TOPDIR;                                \
         report=../$(REPORTFILE)-`date +%m.%d.%y-%H:%M`;                   \
         if [ -z "$(RUNTARGET)" ];  then                                   \
             trap "rm $$report" 2 ;                                        \

Reply via email to