diff options
Diffstat (limited to 'debian/patches/gcc-search-prefixed-as-ld.diff')
-rw-r--r-- | debian/patches/gcc-search-prefixed-as-ld.diff | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/patches/gcc-search-prefixed-as-ld.diff b/debian/patches/gcc-search-prefixed-as-ld.diff new file mode 100644 index 0000000..0fd116d --- /dev/null +++ b/debian/patches/gcc-search-prefixed-as-ld.diff @@ -0,0 +1,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; + |