2
1

500-sysroot.patch 1.2 KB

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