This is the mail archive of the binutils@sources.redhat.com 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]

Patch: Don't check -rpath nor LD_RUN_PATH for cross link.


We have discussed before. One thing -rpath does is to record DR_RPATH
or DT_RUNPATH, which is used for the target runtime linker. It doesn't
make any senses to search -rpath for DT_NEEDED in the cross linker.
Searching -rpath intended for the target on the host machine will only
cause unnecessary problems.

Also according to the Solaris ld manual:

LD_RUN_PATH

	An alternative mechanism for specifying a runpath to the
	link-editor (see -R option). If both LD_RUN_PATH and the -R
	option are specified, -R supersedes.

-rpath is the same as -R for the GNU ld. So we shouldn't check
LD_RUN_PATH for the cross linker either.

Here is the patch.

-- 
H.J. Lu (hjl@gnu.org)
--
2000-08-24  H.J. Lu  <hjl@gnu.org>

	* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't
	check -rpath nor LD_RUN_PATH for cross link.
	* ld.texinfo: Document the change.

Index: ld.texinfo
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ld.texinfo,v
retrieving revision 1.7
diff -u -p -r1.7 ld.texinfo
--- ld.texinfo	2000/08/23 00:16:29	1.7
+++ ld.texinfo	2000/08/24 18:25:47
@@ -1089,11 +1089,11 @@ Any directories specified by @code{-rpat
 between @code{-rpath} and @code{-rpath-link} is that directories
 specified by @code{-rpath} options are included in the executable and
 used at runtime, whereas the @code{-rpath-link} option is only effective
-at link time.
+at link time. It is for the native linker only.
 @item
 On an ELF system, if the @code{-rpath} and @code{rpath-link} options
 were not used, search the contents of the environment variable
-@code{LD_RUN_PATH}.
+@code{LD_RUN_PATH}. It is for the native linker only.
 @item
 On SunOS, if the @code{-rpath} option was not used, search any
 directories specified using @code{-L} options.
Index: emultempl/elf32.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.26
diff -u -p -r1.26 elf32.em
--- emultempl/elf32.em	2000/08/23 23:10:10	1.26
+++ emultempl/elf32.em	2000/08/24 18:21:43
@@ -620,7 +620,6 @@ gld${EMULATION_NAME}_after_open ()
 	 their use.  See gld${EMULATION_NAME}_vercheck comment.  */
       for (force = 0; force < 2; force++)
 	{
-	  const char *lib_path;
 	  size_t len;
 	  search_dirs_type *search;
 EOF
@@ -628,6 +627,7 @@ if [ "x${host}" = "x${target}" ] ; then
   case " ${EMULATION_LIBPATH} " in
   *" ${EMULATION_NAME} "*)
 cat >>e${EMULATION_NAME}.c <<EOF
+	  const char *lib_path;
 	  struct bfd_link_needed_list *rp;
 	  int found;
 EOF
@@ -639,6 +639,11 @@ cat >>e${EMULATION_NAME}.c <<EOF
 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
 						  l->name, force))
 	    break;
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+  case " ${EMULATION_LIBPATH} " in
+  *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
 						  l->name, force))
 	    break;
@@ -650,11 +655,6 @@ cat >>e${EMULATION_NAME}.c <<EOF
 						      force))
 		break;
 	    }
-EOF
-if [ "x${host}" = "x${target}" ] ; then
-  case " ${EMULATION_LIBPATH} " in
-  *" ${EMULATION_NAME} "*)
-cat >>e${EMULATION_NAME}.c <<EOF
 	  lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
 	  if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
 	    break;

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