2
1

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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 diff --git b/ld/ldfile.c
  15. --- a/ld/ldfile.c 2017-03-02 03:23:54.000000000 -0500
  16. +++ b/ld/ldfile.c 2017-03-20 09:52:27.687415942 -0400
  17. @@ -336,18 +336,24 @@
  18. directory first. */
  19. if (!entry->flags.maybe_archive)
  20. {
  21. - if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
  22. + /* For absolute pathnames, try to always open the file in the
  23. + sysroot first. If this fails, try to open the file at the
  24. + given location. */
  25. + entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
  26. + if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
  27. + && ld_sysroot)
  28. {
  29. char *name = concat (ld_sysroot, entry->filename,
  30. (const char *) NULL);
  31. if (ldfile_try_open_bfd (name, entry))
  32. {
  33. entry->filename = name;
  34. + entry->flags.sysrooted = TRUE;
  35. return TRUE;
  36. }
  37. free (name);
  38. }
  39. - else if (ldfile_try_open_bfd (entry->filename, entry))
  40. + if (ldfile_try_open_bfd (entry->filename, entry))
  41. return TRUE;
  42. if (IS_ABSOLUTE_PATH (entry->filename))