This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ia64 cft] Cleanup setting of LD_LIBRARY_PATH


I really cannot understand why the setting of LD_LIBRARY_PATH to include gcc is so complicated.

Probably the reason for this complication was to have the LD_LIBRARY_PATH set when one runs "make" from within the gcc directory, but this is also buggy, because if you modify gcc's configure.ac and make from within the gcc directory, the "export" disappears from the Makefile.

Since this behavior is made less compelling by the TARGET-gcc support added last September to the toplevel, I propose simplifying this by relying on the same mechanism used by bfd, opcodes, libstdc++, etc. This patch has been bootstrapped i686-pc-linux-gnu, all languages including Ada.

This is also the first step towards allowing bootstrapped target modules (which is now needed by libada, and may be used for libgcc as well in the future). I'll submit some cleanup patches during stage1, and then proceed to submit the enabling of toplevel bootstrap in stage2, following Mark's schedule.

Paolo
2005-02-28  Paolo Bonzini  <bonzini@gnu.org>

	* Makefile.tpl (SET_LIB_PATH, REALLY_SET_LIB_PATH): Remove.
	(HOST_EXPORTS, STAGE_HOST_EXPORTS, TARGET_EXPORTS): Set $(RPATH_ENVVAR).
	(HOST_LIB_PATH): Include only used directories.
	(TARGET_LIB_PATH): Include only used directories, and the gcc
	directory.
	(Old bootstrap targets): Include TARGET_LIB_PATH into RPATH_ENVVAR.
	* Makefile.in: Regenerate.
	* configure.in (set_lib_path, SET_LIB_PATH, SET_GCC_LIB_PATH): Remove.
	* configure: Regenerate.

config:
2005-02-28  Paolo Bonzini  <bonzini@gnu.org>

	* config/gcc-lib-path.m4: Remove.

gcc:
2005-02-28  Paolo Bonzini  <bonzini@gnu.org>

	* gcc/configure.ac (TL_AC_GNU_MAKE_GCC_LIB_PATH): Remove.
	* gcc/configure: Regenerate.


--- orig/Makefile.tpl
+++ mod/Makefile.tpl
@@ -96,17 +96,6 @@ GDB_NLM_DEPS = 
 # the libraries.
 RPATH_ENVVAR = @RPATH_ENVVAR@
 
-# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
-# was used.
-SET_LIB_PATH = @SET_LIB_PATH@
-
-# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
-# Some platforms don't like blank entries, so we remove duplicate,
-# leading and trailing colons.
-REALLY_SET_LIB_PATH = \
-  @SET_GCC_LIB_PATH@ \
-  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
-
 # This is the list of directories to be built for the build system.
 BUILD_CONFIGDIRS = libiberty
 # Build programs are put under this directory.
@@ -178,11 +167,11 @@ HOST_EXPORTS = \
 	TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 # Similar, for later GCC stages.
 STAGE_HOST_EXPORTS = \
+	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
 	$(HOST_EXPORTS) \
 	CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \
 	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \
@@ -218,8 +207,7 @@ BASE_TARGET_EXPORTS = \
 	NM="$(NM_FOR_TARGET)"; export NM; \
 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
 	WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
-	SET_GCC_LIB_PATH_CMD="@SET_GCC_LIB_PATH@"; export SET_GCC_LIB_PATH_CMD; \
-	@SET_GCC_LIB_PATH@
+	$(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 RAW_CXX_TARGET_EXPORTS = \
 	$(BASE_TARGET_EXPORTS) \
@@ -327,7 +315,13 @@ RUNTEST = `if [ -f $$s/dejagnu/runtest ]
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $$r/$(HOST_SUBDIR)/bfd:$$r/$(HOST_SUBDIR)/opcodes
+HOST_LIB_PATH = 
+@if bfd
+HOST_LIB_PATH += $$r/$(HOST_SUBDIR)/bfd:$$r/$(HOST_SUBDIR)/prev-bfd:
+@endif bfd
+@if opcodes
+HOST_LIB_PATH += $$r/$(HOST_SUBDIR)/opcodes:$$r/$(HOST_SUBDIR)/prev-opcodes:
+@endif opcodes
 
 AS = @AS@
 
@@ -361,7 +355,16 @@ PICFLAG = 
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that prorgams built for the target machine work.
-TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:$$r/$(TARGET_SUBDIR)/libmudflap/.libs
+TARGET_LIB_PATH = 
+@if libstdc++-v3
+TARGET_LIB_PATH += $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs:
+@endif libstdc++-v3
+@if libmudflap
+TARGET_LIB_PATH += $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
+@endif libmudflap
+@if gcc
+TARGET_LIB_PATH += $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:
+@endif gcc
 
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
 
@@ -773,7 +776,6 @@ uninstall:
 install.all: install-no-fixedincludes
 	@if [ -f ./gcc/Makefile ] ; then \
 		r=`${PWD_COMMAND}` ; export r ; \
-		$(SET_LIB_PATH) \
 		$(HOST_EXPORTS) \
 		(cd ./gcc && \
 		$(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
@@ -899,7 +901,6 @@ all-[+module+]: configure-[+module+]
 	@[+ IF bootstrap +]test -f stage_last && exit 0; \
 	[+ ENDIF bootstrap +]r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/[+module+] && \
 	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] $(TARGET-[+module+]))
@@ -917,7 +918,6 @@ check-[+module+]:
 	@if [ '$(host)' = '$(target)' ] ; then \
 	  r=`${PWD_COMMAND}`; export r; \
 	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	  $(SET_LIB_PATH) \
 	  $(HOST_EXPORTS) \
 	  (cd $(HOST_SUBDIR)/[+module+] && \
 	    $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
@@ -926,7 +926,6 @@ check-[+module+]:
 check-[+module+]:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/[+module+] && \
 	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
@@ -943,7 +942,6 @@ install-[+module+]:
 install-[+module+]: installdirs
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/[+module+] && \
 	  $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check)
@@ -967,7 +965,6 @@ maybe-[+make_target+]-[+module+]: [+make
 	@[ -f ./[+module+]/Makefile ] || exit 0; \
 	r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \
 	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
@@ -1004,8 +1001,7 @@ configure-target-[+module+]: $(TARGET_SU
 	@test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \
 	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \
 	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \[+
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
 IF raw_cxx +]
 	$(RAW_CXX_TARGET_EXPORTS) \[+
 ELSE normal_cxx +]
@@ -1034,8 +1030,7 @@ TARGET-target-[+module+]=[+ IF target +]
 maybe-all-target-[+module+]: all-target-[+module+]
 all-target-[+module+]: configure-target-[+module+]
 	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \[+
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
 IF raw_cxx +]
 	$(RAW_CXX_TARGET_EXPORTS) \[+
 ELSE normal_cxx +]
@@ -1059,8 +1054,7 @@ check-target-[+module+]:
 [+ ELSE check +]
 check-target-[+module+]:
 	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \[+
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
 IF raw_cxx +]
 	$(RAW_CXX_TARGET_EXPORTS) \[+
 ELSE normal_cxx +]
@@ -1085,8 +1079,7 @@ install-target-[+module+]:
 [+ ELSE install +]
 install-target-[+module+]: installdirs
 	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \[+
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
 IF raw_cxx +]
 	$(RAW_CXX_TARGET_EXPORTS) \[+
 ELSE normal_cxx +]
@@ -1113,8 +1106,7 @@ maybe-[+make_target+]-target-[+module+]:
   ENDFOR depend +]
 	@[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \
 	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \[+
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+
 IF raw_cxx +]
 	$(RAW_CXX_TARGET_EXPORTS) \[+
 ELSE normal_cxx +]
@@ -1150,9 +1142,9 @@ GCC_STRAP_TARGETS = bootstrap bootstrap-
 $(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "Bootstrapping the compiler"; \
+	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
 	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@@ -1170,32 +1162,28 @@ $(GCC_STRAP_TARGETS): all-prebootstrap c
 	    msg="Comparing stage2 and stage3 of the compiler"; \
 	    compare=compare ;; \
 	esac; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "$$msg"; \
 	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
-	$(SET_LIB_PATH) \
 	echo "Building runtime libraries"; \
 	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
 
 profiledbootstrap: all-prebootstrap configure-gcc
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
+	$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
 	echo "Bootstrapping training compiler"; \
 	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "Building feedback based compiler"; \
 	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
-	$(SET_LIB_PATH) \
 	echo "Building runtime libraries"; \
 	$(MAKE) $(RECURSE_FLAGS_TO_PASS) all
 
@@ -1203,13 +1191,11 @@ profiledbootstrap: all-prebootstrap conf
 cross: all-build all-gas all-ld
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "Building the C and C++ compiler"; \
 	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
-	$(SET_LIB_PATH) \
 	echo "Building runtime libraries"; \
 	$(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all
 @endif gcc-no-bootstrap
@@ -1220,7 +1206,6 @@ check-gcc-c++:
 	@if [ -f ./gcc/Makefile ] ; then \
 	  r=`${PWD_COMMAND}`; export r; \
 	  s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	  $(SET_LIB_PATH) \
 	  $(HOST_EXPORTS) \
 	  (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \
 	else \
@@ -1244,7 +1229,6 @@ gcc-no-fixedincludes:
 	  rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
 	  r=`${PWD_COMMAND}`; export r; \
 	  s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
-	  $(SET_LIB_PATH) \
 	  $(HOST_EXPORTS) \
 	  (cd ./gcc && \
 	   $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
@@ -1500,18 +1484,15 @@ stagefeedback-start::
 profiledbootstrap:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "Bootstrapping the compiler"; \
 	$(MAKE) stageprofile-bubble distclean-stagefeedback
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \
-	$(SET_LIB_PATH) \
 	echo "Building runtime libraries and training compiler"; \
 	$(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(SET_LIB_PATH) \
 	$(HOST_EXPORTS) \
 	echo "Building feedback based compiler"; \
 	$(MAKE) stagefeedback-bubble stagefeedback-end


--- orig/configure.in
+++ mod/configure.in
@@ -1642,28 +1642,6 @@ case "${host}" in
   ;;
 esac
 
-# If no --enable-shared nor --disable-shared is specified, we set up
-# LD_LIBRARY_PATH when we build for gcc.
-case $enable_shared in
-"")
-  if test -d ${srcdir}/gcc; then
-    set_lib_path=yes
-  else 
-    set_lib_path=no
-  fi
-  ;;
-*)
-  set_lib_path=$enable_shared
-  ;;
-esac
-
-# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
-# binutils tools will find libbfd.so.
-case "${set_lib_path}" in
-  no) SET_LIB_PATH= ;;
-  *) SET_LIB_PATH="\$(REALLY_SET_LIB_PATH)" ;;
-esac
-
 case "${host}" in
   *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
   *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
@@ -2135,7 +2113,6 @@ AC_SUBST_FILE(alphaieee_frag)
 AC_SUBST_FILE(ospace_frag)
 
 # Miscellanea: directories, flags, etc.
-AC_SUBST(SET_LIB_PATH)
 AC_SUBST(RPATH_ENVVAR)
 AC_SUBST(BUILD_PREFIX)
 AC_SUBST(BUILD_PREFIX_1)
@@ -2314,24 +2291,4 @@ case ${enable_werror} in
 esac
 AC_SUBST(stage2_werror_flag)
 
-# If gcc is built natively with shared library enabled, set
-# $RPATH_ENVVAR to make sure the newly built gcc shared librares are
-# used.
-SET_GCC_LIB_PATH=
-if test -d ${srcdir}/gcc && test x${is_cross_compiler} = xno; then
-  case "${set_lib_path}" in
-    no) ;;
-    *)
-      eval "d=\$$RPATH_ENVVAR"
-      if test x"$d" != x; then
-	d="$pwd/gcc:$d"
-      else
-	d="$pwd/gcc"
-    fi
-    SET_GCC_LIB_PATH="\$(RPATH_ENVVAR)=$d; export \$(RPATH_ENVVAR);"
-    ;;
-  esac
-fi
-AC_SUBST(SET_GCC_LIB_PATH)
-
 AC_OUTPUT(Makefile)


--- orig/gcc/.arch-inventory
+++ mod/gcc/.arch-inventory
@@ -1 +1,2 @@
+precious ^configure$
 precious ^config\.in$


--- orig/gcc/Makefile.in
+++ mod/gcc/Makefile.in
@@ -1012,9 +1012,6 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi
 # language hooks, generated by configure
 @language_hooks@
 
-# Set up library path if needed.
-@set_gcc_lib_path@
-
 # per-language makefile fragments
 ifneq ($(LANG_MAKEFRAGS),)
 include $(LANG_MAKEFRAGS)


--- orig/gcc/aclocal.m4
+++ mod/gcc/aclocal.m4
@@ -1,7 +1,6 @@
 m4_include([../config/accross.m4])
 m4_include([../config/acx.m4])
 m4_include([../config/gettext-sister.m4])
-m4_include([../config/gcc-lib-path.m4])
 m4_include([../config/gcc-version.m4])
 m4_include([../config/iconv.m4])
 m4_include([../config/lcmessage.m4])


--- orig/gcc/configure.ac
+++ mod/gcc/configure.ac
@@ -3316,8 +3316,6 @@ AC_SUBST(target_cpu_default)
 
 AC_SUBST_FILE(language_hooks)
 
-TL_AC_GNU_MAKE_GCC_LIB_PATH
-
 # Echo link setup.
 if test x${build} = x${host} ; then
   if test x${host} = x${target} ; then


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]