aboutsummaryrefslogtreecommitdiff
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
commit1069ad51f418f56c400cf2387e508c6378eb73a1 (patch)
tree0d506ce0566756326538c8f8b4637977349f338e /binutils/windres.c
parent3baa454d4a70a944772a1796dab77a77685a56c0 (diff)
downloadgdb-1069ad51f418f56c400cf2387e508c6378eb73a1.zip
gdb-1069ad51f418f56c400cf2387e508c6378eb73a1.tar.gz
gdb-1069ad51f418f56c400cf2387e508c6378eb73a1.tar.bz2
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 98ce165..ece32ba 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);