patches/binutils/2.20.1a/130-ld-sysroot.patch
changeset 2664 346263a07115
parent 2088 4f21ba5f8e91
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.20.1a/130-ld-sysroot.patch	Sun Sep 11 18:18:53 2011 +0200
     1.3 @@ -0,0 +1,37 @@
     1.4 +Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
     1.5 +
     1.6 +Always try to prepend the sysroot prefix to absolute filenames first.
     1.7 +
     1.8 +http://bugs.gentoo.org/275666
     1.9 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340
    1.10 +
    1.11 +diff -durN binutils-2.20.1.orig/ld/ldfile.c binutils-2.20.1/ld/ldfile.c
    1.12 +--- binutils-2.20.1.orig/ld/ldfile.c	2009-08-30 00:11:01.000000000 +0200
    1.13 ++++ binutils-2.20.1/ld/ldfile.c	2010-08-17 19:32:08.000000000 +0200
    1.14 +@@ -308,18 +308,24 @@
    1.15 +      directory first.  */
    1.16 +   if (! entry->is_archive)
    1.17 +     {
    1.18 +-      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
    1.19 ++      /* For absolute pathnames, try to always open the file in the
    1.20 ++	 sysroot first. If this fails, try to open the file at the
    1.21 ++	 given location. */
    1.22 ++      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
    1.23 ++      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
    1.24 + 	{
    1.25 + 	  char *name = concat (ld_sysroot, entry->filename,
    1.26 + 			       (const char *) NULL);
    1.27 + 	  if (ldfile_try_open_bfd (name, entry))
    1.28 + 	    {
    1.29 + 	      entry->filename = name;
    1.30 ++	      entry->sysrooted = TRUE;
    1.31 + 	      return TRUE;
    1.32 + 	    }
    1.33 + 	  free (name);
    1.34 + 	}
    1.35 +-      else if (ldfile_try_open_bfd (entry->filename, entry))
    1.36 ++
    1.37 ++      if (ldfile_try_open_bfd (entry->filename, entry))
    1.38 + 	{
    1.39 + 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
    1.40 + 	    && is_sysrooted_pathname (entry->filename, TRUE);