1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# DP: Search for the <triplet>-as / -ld before serching for as / ld.
--- a/src/gcc/gcc.cc
+++ b/src/gcc/gcc.cc
@@ -2894,6 +2894,7 @@ for_each_path (const struct path_prefix
{
len = paths->max_len + extra_space + 1;
len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
+ len += MAX (strlen(DEFAULT_REAL_TARGET_MACHINE), multiarch_len) + 2; /* triplet prefix for as, ld. */
path = XNEWVEC (char, len);
}
@@ -3107,6 +3108,24 @@ file_at_path (char *path, void *data)
struct file_at_path_info *info = (struct file_at_path_info *) data;
size_t len = strlen (path);
+ /* search for the <triplet>-as / -ld first. */
+ if (! strcmp (info->name, "as") || ! strcmp (info->name, "ld"))
+ {
+ struct file_at_path_info prefix_info = *info;
+ char *prefixed_name = XNEWVEC (char, info->name_len + 2
+ + strlen (DEFAULT_REAL_TARGET_MACHINE));
+ strcpy (prefixed_name, DEFAULT_REAL_TARGET_MACHINE);
+ strcat (prefixed_name, "-");
+ strcat (prefixed_name, info->name);
+ prefix_info.name = (const char *) prefixed_name;
+ prefix_info.name_len = strlen (prefixed_name);
+ if (file_at_path (path, &prefix_info))
+ {
+ XDELETEVEC (prefixed_name);
+ return path;
+ }
+ XDELETEVEC (prefixed_name);
+ }
memcpy (path + len, info->name, info->name_len);
len += info->name_len;
|