Index: src/binutils/windres.c =================================================================== --- src.orig/binutils/windres.c +++ src/binutils/windres.c @@ -1080,9 +1080,23 @@ set_endianess (bfd *abfd, const char *ta if (arches && tname) { const char ** arch = arches; + char *hyp = strchr (tname, '-'); + char *new_tname = NULL; + + if (hyp != NULL) + { + tname = hyp + 1; + hyp = strchr (tname, '-'); + if (hyp != NULL) + { + size_t l = hyp - tname; + new_tname = (char *) xmalloc (l + 1); + memcpy (new_tname, tname, l); + new_tname[l] = '\0'; + tname = new_tname; + } + } - if (strchr (tname, '-') != NULL) - tname = strchr (tname, '-') + 1; while (*arch != NULL) { const char *in_a = strstr (*arch, tname); @@ -1096,6 +1110,8 @@ set_endianess (bfd *abfd, const char *ta } arch++; } + if (new_tname) + free (new_tname); } free (arches);