summaryrefslogtreecommitdiff
path: root/binutils/windres.c
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2009-01-06 15:36:05 +0000
committerKai Tietz <kai.tietz@onevision.com>2009-01-06 15:36:05 +0000
commit017a93661be8ce142d2d4d68acca0a7edc300b11 (patch)
treee485eb11f9bf2251fac3df02eb08316b836a8053 /binutils/windres.c
parent7a47791fc9d69d7322f22d1e436b760e131a80a9 (diff)
downloadbinutils-redhat-017a93661be8ce142d2d4d68acca0a7edc300b11.tar.gz
2009-01-06 Kai Tietz <kai.tietz@onevision.com>
* windres.c (set_endianess): Get architecture name for internal target names like "pe-arm-wince-little". (find_arch_match): New helper. * ChangeLog: Reset it. * ChangeLog-2008: Moved old ChangeLog.
Diffstat (limited to 'binutils/windres.c')
-rw-r--r--binutils/windres.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/binutils/windres.c b/binutils/windres.c
index 98ce1652a0..ece32bad6b 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -1062,6 +1062,25 @@ main (int argc, char **argv)
return 0;
}
+static int
+find_arch_match(const char *tname,const char **arch)
+{
+ while (*arch != NULL)
+ {
+ const char *in_a = strstr (*arch, tname);
+ char end_ch = (in_a ? in_a[strlen(tname)] : 0);
+
+ if (in_a && (in_a == *arch || in_a[-1] == ':')
+ && end_ch == 0)
+ {
+ def_target_arch = *arch;
+ return 1;
+ }
+ arch++;
+ }
+ return 0;
+}
+
static void
set_endianess (bfd *abfd, const char *target)
{
@@ -1079,23 +1098,28 @@ set_endianess (bfd *abfd, const char *target)
if (arches && tname)
{
- const char ** arch = arches;
+ char *hyp = strchr (tname, '-');
- if (strchr (tname, '-') != NULL)
- tname = strchr (tname, '-') + 1;
- while (*arch != NULL)
+ if (hyp != NULL)
{
- const char *in_a = strstr (*arch, tname);
- char end_ch = (in_a ? in_a[strlen(tname)] : 0);
+ tname = hyp + 1;
- if (in_a && (in_a == *arch || in_a[-1] == ':')
- && end_ch == 0)
+ /* Make sure we dectect architecture names
+ for triplets like "pe-arm-wince-little". */
+ if (!find_arch_match (tname, arches))
{
- def_target_arch = *arch;
- break;
+ char *new_tname = (char *) alloca (strlen (hyp) + 1);
+ strcpy (new_tname, hyp);
+ while ((hyp = strrchr (new_tname, '-')) != NULL)
+ {
+ *hyp = 0;
+ if (find_arch_match (new_tname, arches))
+ break;
+ }
}
- arch++;
}
+ else
+ find_arch_match (tname, arches);
}
free (arches);