patches/binutils/2.19/130-check_ldrunpath_length.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jan 28 22:06:49 2011 +0100 (2011-01-28)
changeset 2284 7ede374110e5
permissions -rw-r--r--
config: add an option not to remove the destination directory

In certain circumstances, removing the destination/installation directory
is a bad idea. For example, when the build environment is already taking
care of sanitising the build tree, and pre-installs stuff in there, it is
a very bad idea to remove the destination directory.

This happens now in buildroot, as the crostool-NG backend now installs the
toolchain in the common host-tools directory, and pre-install there a few
host-utilities (eg. host-automake and host-gawk).

Provide a config knob to turn on/off the removal of the destination
directory, defaulting to 'y' (previous behavior), and forced to 'n' when
used as a backend.

Reported-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@1069
     1
Original patch from Gentoo:
yann@1069
     2
gentoo/src/patchsets/binutils/2.19/42_all_012_check_ldrunpath_length.patch
yann@1069
     3
yann@1069
     4
Originaly from Debian:
yann@1069
     5
## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
yann@1069
     6
##
yann@1069
     7
## All lines beginning with `## DP:' are a description of the patch.
yann@1069
     8
## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
yann@1069
     9
## DP: cases where -rpath isn't specified. (#151024)
yann@1069
    10
yann@1069
    11
diff -durN binutils-2.19.orig/ld/emultempl/elf32.em binutils-2.19/ld/emultempl/elf32.em
yann@1069
    12
--- binutils-2.19.orig/ld/emultempl/elf32.em	2008-09-07 06:02:31.000000000 +0200
yann@1069
    13
+++ binutils-2.19/ld/emultempl/elf32.em	2008-11-23 16:25:51.000000000 +0100
yann@1069
    14
@@ -1219,6 +1219,8 @@
yann@1069
    15
 	      && command_line.rpath == NULL)
yann@1069
    16
 	    {
yann@1069
    17
 	      lib_path = (const char *) getenv ("LD_RUN_PATH");
yann@1069
    18
+	      if ((lib_path) && (strlen (lib_path) == 0))
yann@1069
    19
+		  lib_path = NULL;
yann@1069
    20
 	      if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
yann@1069
    21
 						      force))
yann@1069
    22
 		break;
yann@1069
    23
@@ -1404,6 +1406,8 @@
yann@1069
    24
   rpath = command_line.rpath;
yann@1069
    25
   if (rpath == NULL)
yann@1069
    26
     rpath = (const char *) getenv ("LD_RUN_PATH");
yann@1069
    27
+  if ((rpath) && (strlen (rpath) == 0))
yann@1069
    28
+      rpath = NULL;
yann@1069
    29
   if (! (bfd_elf_size_dynamic_sections
yann@1069
    30
 	 (link_info.output_bfd, command_line.soname, rpath,
yann@1069
    31
 	  command_line.filter_shlib,