patches/binutils/2.20/130-ld-sysroot.patch
changeset 1614 3f76cdbceb6e
child 1621 60446d2e5660
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.20/130-ld-sysroot.patch	Tue Oct 27 20:06:46 2009 +0100
     1.3 @@ -0,0 +1,36 @@
     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 +--- ld/ldfile.c
    1.12 ++++ ld/ldfile.c
    1.13 +@@ -308,18 +308,24 @@
    1.14 +      directory first.  */
    1.15 +   if (! entry->is_archive)
    1.16 +     {
    1.17 +-      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
    1.18 ++      /* For absolute pathnames, try to always open the file in the
    1.19 ++	 sysroot first. If this fails, try to open the file at the
    1.20 ++	 given location. */
    1.21 ++      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
    1.22 ++      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
    1.23 + 	{
    1.24 + 	  char *name = concat (ld_sysroot, entry->filename,
    1.25 + 			       (const char *) NULL);
    1.26 + 	  if (ldfile_try_open_bfd (name, entry))
    1.27 + 	    {
    1.28 + 	      entry->filename = name;
    1.29 ++	      entry->sysrooted = TRUE;
    1.30 + 	      return TRUE;
    1.31 + 	    }
    1.32 + 	  free (name);
    1.33 + 	}
    1.34 +-      else if (ldfile_try_open_bfd (entry->filename, entry))
    1.35 ++
    1.36 ++      if (ldfile_try_open_bfd (entry->filename, entry))
    1.37 + 	{
    1.38 + 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
    1.39 + 	    && is_sysrooted_pathname (entry->filename, TRUE);