patches/binutils/2.20/130-ld-sysroot.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Dec 23 20:43:32 2010 +0100 (2010-12-23)
changeset 2307 2efd46963086
parent 1614 3f76cdbceb6e
permissions -rw-r--r--
buildtools: move to working directory

There is absolutely *no* reason for the buildtools (wrappers to gcc, g++,
as, ld... for the local machine) to be in the toolchain directory. Moreover,
they are removed after the build completes.

Move them out of the toolchain directory, and into the build directory (but
yet the part specific to the current toolchain). This means we no longer
need to explicitly remove them either, BTW, but we need to save/restore them
for the restart feature.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@1614
     1
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
yann@1614
     2
yann@1614
     3
Always try to prepend the sysroot prefix to absolute filenames first.
yann@1614
     4
yann@1614
     5
http://bugs.gentoo.org/275666
yann@1614
     6
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
yann@1614
     7
fr@1621
     8
--- binutils/ld/ldfile.c
fr@1621
     9
+++ binutils/ld/ldfile.c
yann@1614
    10
@@ -308,18 +308,24 @@
yann@1614
    11
      directory first.  */
yann@1614
    12
   if (! entry->is_archive)
yann@1614
    13
     {
yann@1614
    14
-      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
yann@1614
    15
+      /* For absolute pathnames, try to always open the file in the
yann@1614
    16
+	 sysroot first. If this fails, try to open the file at the
yann@1614
    17
+	 given location. */
yann@1614
    18
+      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
yann@1614
    19
+      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
yann@1614
    20
 	{
yann@1614
    21
 	  char *name = concat (ld_sysroot, entry->filename,
yann@1614
    22
 			       (const char *) NULL);
yann@1614
    23
 	  if (ldfile_try_open_bfd (name, entry))
yann@1614
    24
 	    {
yann@1614
    25
 	      entry->filename = name;
yann@1614
    26
+	      entry->sysrooted = TRUE;
yann@1614
    27
 	      return TRUE;
yann@1614
    28
 	    }
yann@1614
    29
 	  free (name);
yann@1614
    30
 	}
yann@1614
    31
-      else if (ldfile_try_open_bfd (entry->filename, entry))
yann@1614
    32
+
yann@1614
    33
+      if (ldfile_try_open_bfd (entry->filename, entry))
yann@1614
    34
 	{
yann@1614
    35
 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
yann@1614
    36
 	    && is_sysrooted_pathname (entry->filename, TRUE);