Upload Tizen:Base source
[external/binutils.git] / packaging / 140_pr10340.patch
1 # DP: Proposed patch for PR ld/10340, ld doesn't honor sysroot prefix for ldscripts
2
3 Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
4
5 Always try to prepend the sysroot prefix to absolute filenames first.
6
7 --- a/ld/ldfile.c
8 +++ b/ld/ldfile.c
9 @@ -308,18 +308,24 @@
10       directory first.  */
11    if (! entry->is_archive)
12      {
13 -      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
14 +      /* For absolute pathnames, try to always open the file in the
15 +        sysroot first. If this fails, try to open the file at the
16 +        given location. */
17 +      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
18 +      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
19         {
20           char *name = concat (ld_sysroot, entry->filename,
21                                (const char *) NULL);
22           if (ldfile_try_open_bfd (name, entry))
23             {
24               entry->filename = name;
25 +             entry->sysrooted = TRUE;
26               return TRUE;
27             }
28           free (name);
29         }
30 -      else if (ldfile_try_open_bfd (entry->filename, entry))
31 +
32 +      if (ldfile_try_open_bfd (entry->filename, entry))
33         {
34           entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
35             && is_sysrooted_pathname (entry->filename, TRUE);