0500-add-sysroot-fix-from-bug-3049.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 30628870e583375f8927c04398c7219c6e9f703c Mon Sep 17 00:00:00 2001
  2. From: Romain Naour <romain.naour@gmail.com>
  3. Date: Fri, 25 Dec 2015 11:42:48 +0100
  4. Subject: [PATCH] add sysroot fix from bug #3049
  5. Always try to prepend the sysroot prefix to absolute filenames first.
  6. http://bugs.gentoo.org/275666
  7. http://sourceware.org/bugzilla/show_bug.cgi?id=10340
  8. Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
  9. [Romain: rebase on top of 2.26]
  10. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  11. ---
  12. ld/ldfile.c | 11 +++++++++--
  13. 1 file changed, 9 insertions(+), 2 deletions(-)
  14. diff --git a/ld/ldfile.c b/ld/ldfile.c
  15. index 96f9ecc..1439309 100644
  16. --- a/ld/ldfile.c
  17. +++ b/ld/ldfile.c
  18. @@ -335,18 +335,25 @@ ldfile_open_file_search (const char *arch,
  19. directory first. */
  20. if (! entry->flags.maybe_archive)
  21. {
  22. - if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
  23. + /* For absolute pathnames, try to always open the file in the
  24. + sysroot first. If this fails, try to open the file at the
  25. + given location. */
  26. + entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
  27. + if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
  28. + && ld_sysroot)
  29. {
  30. char *name = concat (ld_sysroot, entry->filename,
  31. (const char *) NULL);
  32. if (ldfile_try_open_bfd (name, entry))
  33. {
  34. entry->filename = name;
  35. + entry->flags.sysrooted = TRUE;
  36. return TRUE;
  37. }
  38. free (name);
  39. }
  40. - else if (ldfile_try_open_bfd (entry->filename, entry))
  41. +
  42. + if (ldfile_try_open_bfd (entry->filename, entry))
  43. return TRUE;
  44. if (IS_ABSOLUTE_PATH (entry->filename))
  45. --
  46. 2.4.3