This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[PATCH] gold --with-lib-path


Hi,

There a lot of troubles while using gold in real life without the
built-in libs search path...
This is a simplest-way patch for ones.

diff --git a/gold/Makefile.am b/gold/Makefile.am
index df5e66c..4d3a4d5 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -15,6 +15,7 @@ AM_CPPFLAGS = \
? -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
? -DLOCALEDIR="\"$(datadir)/locale\"" \
? -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
+ -DLIB_PATH="\"$(lib_path)\"" \
? @INCINTL@

?LIBIBERTY = ../libiberty/libiberty.a
diff --git a/gold/Makefile.in b/gold/Makefile.in
index bf729cf..f1babed 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -331,6 +331,7 @@ infodir = @infodir@
?install_as_default = @install_as_default@
?install_sh = @install_sh@
?installed_linker = @installed_linker@
+lib_path = @lib_path@
?libdir = @libdir@
?libexecdir = @libexecdir@
?localedir = @localedir@
@@ -364,6 +365,7 @@ AM_CPPFLAGS = \
? -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
? -DLOCALEDIR="\"$(datadir)/locale\"" \
? -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
+ -DLIB_PATH="\"$(lib_path)\"" \
? @INCINTL@

?LIBIBERTY = ../libiberty/libiberty.a
diff --git a/gold/configure b/gold/configure
index b882223..bb8fb86 100755
--- a/gold/configure
+++ b/gold/configure
@@ -627,6 +627,7 @@ GCC_FALSE
?GCC_TRUE
?NATIVE_LINKER_FALSE
?NATIVE_LINKER_TRUE
+lib_path
?MSGMERGE
?MSGFMT
?MKINSTALLDIRS
@@ -764,6 +765,7 @@ SHELL'
?ac_subst_files=''
?ac_user_opts='
?enable_option_checking
+with_lib_path
?with_sysroot
?enable_ld
?enable_gold
@@ -1427,6 +1429,7 @@ Optional Features:
?Optional Packages:
? ?--with-PACKAGE[=ARG] ? ?use PACKAGE [ARG=yes]
? ?--without-PACKAGE ? ? ? do not use PACKAGE (same as --with-PACKAGE=no)
+ ?--with-lib-path=dir1:dir2... ?set default path for libs search
? ?--with-sysroot=DIR ? ?search for usr/lib et al within DIR

?Some influential environment variables:
@@ -3212,6 +3215,15 @@ ac_config_headers="$ac_config_headers config.h:config.in"



+# Check whether --with-lib-path was given.
+if test "${with_lib_path+set}" = set; then :
+ ?withval=$with_lib_path; lib_path=$withval
+else
+ ?lib_path=/lib:/usr/lib
+fi
+
+
+
?# Check whether --with-sysroot was given.
?if test "${with_sysroot+set}" = set; then :
? ?withval=$with_sysroot; sysroot=$withval
@@ -6080,6 +6092,8 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h



+
+
? if test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias"; then
? ?NATIVE_LINKER_TRUE=
? ?NATIVE_LINKER_FALSE='#'
diff --git a/gold/configure.ac b/gold/configure.ac
index 949c8c3..bd9aa86 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -11,6 +11,10 @@ AM_INIT_AUTOMAKE([no-dist parallel-tests])

?AM_CONFIG_HEADER(config.h:config.in)

+AC_ARG_WITH(lib-path,
+[ ?--with-lib-path=dir1:dir2... ?set default path for libs search],
+[lib_path=$withval], [lib_path=/lib:/usr/lib])
+
?AC_ARG_WITH(sysroot,
?[ ?--with-sysroot[=DIR] ? ?search for usr/lib et al within DIR],
?[sysroot=$withval], [sysroot=no])
@@ -254,6 +258,8 @@ AC_C_BIGENDIAN

?AC_EXEEXT

+AC_SUBST(lib_path)
+
?AM_CONDITIONAL(NATIVE_LINKER,
? ?test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias")
?AM_CONDITIONAL(GCC, test "$GCC" = yes)
diff --git a/gold/options.cc b/gold/options.cc
index be32645..2e75870 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -1145,8 +1145,18 @@ General_options::finalize()
? ? ?{
? ? ? ?// Even if they don't specify it, we add -L /lib and -L /usr/lib.
? ? ? ?// FIXME: We should only do this when configured in native mode.
+#ifdef LIB_PATH
+ ? ? ?const char* p = LIB_PATH;
+ ? ? ?while (*p != '\0')
+ {
+ ?size_t length = strcspn(p, ",:");
+ ? ? ? ? ?this->add_to_library_path_with_sysroot(std::string(p,
length).c_str());
+ ?p += (p[length] ? length + 1 : length);
+ }
+#else
? ? ? ?this->add_to_library_path_with_sysroot("/lib");
? ? ? ?this->add_to_library_path_with_sysroot("/usr/lib");
+#endif
? ? ?}

? ?// Parse the contents of -retain-symbols-file into a set.


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