stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] Library path fix
Date Mon, 27 Nov 2006 18:38:40 GMT
Andrew Black wrote:
> Andrew Black wrote:
> [...]
> 
>>
>> I've tested on Linux with GCC and ICC using the '-Wl,-R$(LIBDIR)' 
>> switch to the compiler, and the desired behavior in the resulting 
>> executables is obtained.  I'll check the sunpro patch in shortly.  I 
>> intend to post a follow up patch at some point to make this same 
>> change for other compilers.
> 
> 
> Greetings all.
> 
> Attached is the follow-up patch.  Unfortunately, there are a few gaps in 
> it.  One set of gaps is that it doesn't add the appropriate switch to 
> the como.config, eccp.config, and reliant_cds.config files.  Another set 
> of gaps is that compilers haven't been tested off of their 'home' 
> platform (Sunpro on Solaris, GCC and ICC on Linux, and so on).  Most 
> linkers use -R, but HPUX uses +b, Compaq and IRIX use -rpath, and AIX 
> requires -bsrv4 prior to -R.

For gcc you need to guard the changes and enable them only for
Linux and Solaris. On other platforms (AIX, HP-UX, IRIX, Tru64)
you should use the same flag as for the native compilers.

Other than that I think it's good to commit.

Btw., it would be nice to set up nightly testing with gcc on
the other platforms above.

Martin

> 
> --Andrew Black
> 
> Log:
>     * makefile.rules (%.out): Remove runtime alterations of 
> $LD_LIBRARY_PATH.
>     (run runall run_all): Ditto.
>     * sunpro.config (LDFLAGS): Remove redundant -L$(LIBDIR) switch.  
> Switch is added if needed in makefile.common.
>     (MULTI_LDFLAGS_POSIX, MULTI_LDFLAGS_SOLARIS): Use $(LIBPTHREAD) for 
> MULTI_LDFLAGS_POSIX and $(LIBTHREAD) for MULTI_LDFLAGS_SOLARIS.  Had 
> been reversed at some point by mistake.
>     * acc.config (LDFLAGS): Remove redundant -L$(LIBDIR) switch.  Switch 
> is added if needed in makefile.common.
>     (SHARED_LDFLAGS): Add rpath switch to include $(LIBDIR) in ld search 
> path of executables.
>     * gcc.config (SHARED_LDFLAGS): Ditto.
>     * icc.config (SHARED_LDFLAGS): Ditto.
>     * mipspro.config (LDFLAGS): Remove redundant -L$(LIBDIR) switch. 
> Switch is added if needed in makefile.common.
>     (SHARED_LDFLAGS): Add rpath switch to include $(LIBDIR) in ld search 
> path of executables.
>     * osf_cxx.config (SHARED_LDFLAGS): Ditto.
>     * vacpp.config (SHARED_LDFLAGS): Ditto.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: etc/config/acc.config
> ===================================================================
> --- etc/config/acc.config	(revision 475263)
> +++ etc/config/acc.config	(working copy)
> @@ -58,14 +58,14 @@
>  CXXFLAGS        = -AA "$$"(_CXXOPTS)
>  CXXPRELINK      = 
>  CPPFLAGS        = "$$"(_CPPOPTS)
> -LDFLAGS         = -AA +nostl -Wl,+s -L$(LIBDIR) "$$"(_LDOPTS)
> +LDFLAGS         = -AA +nostl -Wl,+s "$$"(_LDOPTS)
>  else
>  CXXFLAGS        = -Aa +nostl "$$"(_CXXOPTS)
>  CXXPRELINK      = 
>  CPPFLAGS        = -I$(TOPDIR)/include/ansi -I/usr/include "$$"(_CPPOPTS)
>  # -Wl,+s allows the dynamic loader to consider LD_LIBRARY_PATH (LP64)
>  # and SHLIB_PATH when loading an executable into memory
> -LDFLAGS         = -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings -L$(LIBDIR) "$$"(_LDOPTS)
> +LDFLAGS         = -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings "$$"(_LDOPTS)
>  endif
>  
>  
> @@ -79,7 +79,7 @@
>  # shared/static library options
>  SHARED_CXXFLAGS =
>  SHARED_CPPFLAGS =
> -SHARED_LDFLAGS  =
> +SHARED_LDFLAGS  = -Wl,+b$(LIBDIR)
>  SHARED_SUFFIX   = .sl
>  
>  STATIC_CXXFLAGS =
> Index: etc/config/gcc.config
> ===================================================================
> --- etc/config/gcc.config	(revision 475263)
> +++ etc/config/gcc.config	(working copy)
> @@ -132,7 +132,7 @@
>  # shared/static library options
>  SHARED_CXXFLAGS = 
>  SHARED_CPPFLAGS =
> -SHARED_LDFLAGS  =
> +SHARED_LDFLAGS  = -Wl,-R$(LIBDIR)
>  
>  ifeq ($(OSNAME),AIX)
>    SHARED_SUFFIX   = .a
> Index: etc/config/icc.config
> ===================================================================
> --- etc/config/icc.config	(revision 475263)
> +++ etc/config/icc.config	(working copy)
> @@ -42,7 +42,7 @@
>  # shared/archive library options
>  SHARED_CXXFLAGS =
>  SHARED_CPPFLAGS =
> -SHARED_LDFLAGS  =
> +SHARED_LDFLAGS  = -Wl,-R$(LIBDIR)
>  
>  STATIC_CXXFLAGS =
>  STATIC_CPPFLAGS =
> Index: etc/config/makefile.rules
> ===================================================================
> --- etc/config/makefile.rules	(revision 475263)
> +++ etc/config/makefile.rules	(working copy)
> @@ -86,7 +86,7 @@
>  
>  # produce a .out file by running the executable
>  %.out: %
> -	LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIR) ./$< >$@ 2>&1
> +	./$< >$@ 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
> @@ -111,10 +111,9 @@
>  # 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);                    \
> -        PATH=$$PATH:.;                                                    \
> +	@(PATH=$$PATH:.;                                                    \
>          TOPDIR=$(TOPDIR);                                                 \
> -        export LD_LIBRARY_PATH PATH TOPDIR;                               \
> +        export PATH TOPDIR;                                               \
>          report=../$(REPORTFILE)-`date +%m.%d.%y-%H:%M`;                   \
>          if [ -z "$(RUNTARGET)" ];  then                                   \
>              trap "rm $$report" 2 ;                                        \
> Index: etc/config/mipspro.config
> ===================================================================
> --- etc/config/mipspro.config	(revision 475263)
> +++ etc/config/mipspro.config	(working copy)
> @@ -27,7 +27,7 @@
>  
>  
>  # disable warnings about libs that aren't being used to resolve any symbols
> -LDFLAGS         = -Wl,-woff,84 -L$(LIBDIR)
> +LDFLAGS         = -Wl,-woff,84
>  
>  # use the undocumented -LANG:std=off option to prevent linking
>  # with the native C++ Standard Library
> @@ -47,7 +47,7 @@
>  # shared/static library options
>  SHARED_CXXFLAGS =
>  SHARED_CPPFLAGS =
> -SHARED_LDFLAGS  =
> +SHARED_LDFLAGS  = -Wl,-rpath,$(LIBDIR)
>  
>  STATIC_CXXFLAGS =
>  STATIC_CPPFLAGS =
> Index: etc/config/osf_cxx.config
> ===================================================================
> --- etc/config/osf_cxx.config	(revision 475263)
> +++ etc/config/osf_cxx.config	(working copy)
> @@ -35,7 +35,7 @@
>  # shared/static library option
>  SHARED_CXXFLAGS = 
>  SHARED_CPPFLAGS = -D_RWSTD_SHARED_LIB
> -SHARED_LDFLAGS  =
> +SHARED_LDFLAGS  = -rpath $(LIBDIR)
>  
>  STATIC_CXXFLAGS =
>  STATIC_CPPFLAGS =
> Index: etc/config/sunpro.config
> ===================================================================
> --- etc/config/sunpro.config	(revision 475263)
> +++ etc/config/sunpro.config	(working copy)
> @@ -17,7 +17,7 @@
>  CXXFLAGS        = -library=%none
>  CXXPRELINK      = 
>  CPPFLAGS        =
> -LDFLAGS         = -library=%none -L$(LIBDIR)
> +LDFLAGS         = -library=%none
>  LDSOFLAGS       = -G
>  
>  # use CC to invoke the compiler (needed to pick up template
> @@ -62,8 +62,8 @@
>      LIBTHREAD  = -lthread
>  endif
>  
> -MULTI_LDFLAGS_POSIX    = -mt $(LIBTHREAD)
> -MULTI_LDFLAGS_SOLARIS  = -mt $(LIBPTHREAD)
> +MULTI_LDFLAGS_POSIX    = -mt $(LIBPTHREAD)
> +MULTI_LDFLAGS_SOLARIS  = -mt $(LIBTHREAD)
>  MULTI_LDFLAGS_DCE      =
>  
>  # POSIX
> Index: etc/config/vacpp.config
> ===================================================================
> --- etc/config/vacpp.config	(revision 475263)
> +++ etc/config/vacpp.config	(working copy)
> @@ -111,7 +111,7 @@
>  # shared/archive library options
>  SHARED_CXXFLAGS = 
>  SHARED_CPPFLAGS =
> -SHARED_LDFLAGS  = 
> +SHARED_LDFLAGS  = -Wl,-bsvr4,-R$(LIBDIR)
>  
>  ifeq ($(rtl_enabled),1)
>    SHARED_SUFFIX = .so


Mime
View raw message