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 nlen = hyp - tname; + new_tname = (char *) alloca (nlen + 1); + memcpy (new_tname, tname, nlen); + new_tname[nlen] = '\0'; + tname = new_tname; + } + } - if (strchr (tname, '-') != NULL) - tname = strchr (tname, '-') + 1; while (*arch != NULL) { const char *in_a = strstr (*arch, tname);