aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2009-11-16 11:12:37 +0000
committerKai Tietz <kai.tietz@onevision.com>2009-11-16 11:12:37 +0000
commitc4d1af07abcd0c3fa07a5ba8abe6686293d557cf (patch)
treeaf7b8220997c26c111e55f5b52810993836ac04a
parent5fbe97211b2c6c814cb92ee6a127326c8e282b6a (diff)
downloadgdb-c4d1af07abcd0c3fa07a5ba8abe6686293d557cf.zip
gdb-c4d1af07abcd0c3fa07a5ba8abe6686293d557cf.tar.gz
gdb-c4d1af07abcd0c3fa07a5ba8abe6686293d557cf.tar.bz2
2009-11-16 Kai Tietz <kai.tietz@onevision.com>
* windmc.c (set_endianess): Use bfd_get_target_info. * windres.c (set_endianess): Likewise. (find_arch_match): Removed.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/windmc.c38
-rw-r--r--binutils/windres.c61
3 files changed, 14 insertions, 91 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2651241..4fe74f8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-16 Kai Tietz <kai.tietz@onevision.com>
+
+ * windmc.c (set_endianess): Use bfd_get_target_info.
+ * windres.c (set_endianess): Likewise.
+ (find_arch_match): Removed.
+
2009-11-11 Nick Clifton <nickc@redhat.com>
* po/id.po: Updated Indonesian translation.
diff --git a/binutils/windmc.c b/binutils/windmc.c
index d02bc86..63db990 100644
--- a/binutils/windmc.c
+++ b/binutils/windmc.c
@@ -236,42 +236,12 @@ set_endianess (bfd *abfd, const char *target)
const bfd_target *target_vec;
def_target_arch = NULL;
- target_vec = bfd_find_target (target, abfd);
+ target_vec = bfd_get_target_info (target, abfd, &target_is_bigendian, NULL,
+ &def_target_arch);
if (! target_vec)
fatal ("Can't detect target endianess and architecture.");
- target_is_bigendian = ((target_vec->byteorder == BFD_ENDIAN_BIG) ? 1 : 0);
-
- {
- const char * tname = target_vec->name;
- const char ** arches = bfd_arch_list ();
-
- if (arches && tname)
- {
- const char ** arch = arches;
-
- if (strchr (tname, '-') != NULL)
- tname = strchr (tname, '-') + 1;
-
- 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;
- break;
- }
- arch++;
- }
- }
-
- free (arches);
-
- if (! def_target_arch)
- fatal ("Can't detect architecture.");
- }
+ if (! def_target_arch)
+ fatal ("Can't detect architecture.");
}
static int
diff --git a/binutils/windres.c b/binutils/windres.c
index 6fbe7b5..acc65f7 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -1057,71 +1057,18 @@ 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)
{
const bfd_target *target_vec;
def_target_arch = NULL;
- target_vec = bfd_find_target (target, abfd);
+ target_vec = bfd_get_target_info (target, abfd, &target_is_bigendian, NULL,
+ &def_target_arch);
if (! target_vec)
fatal ("Can't detect target endianess and architecture.");
- target_is_bigendian = ((target_vec->byteorder == BFD_ENDIAN_BIG) ? 1 : 0);
-
- {
- const char * tname = target_vec->name;
- const char ** arches = bfd_arch_list();
-
- if (arches && tname)
- {
- char *hyp = strchr (tname, '-');
-
- if (hyp != NULL)
- {
- tname = ++hyp;
-
- /* Make sure we dectect architecture names
- for triplets like "pe-arm-wince-little". */
- if (!find_arch_match (tname, arches))
- {
- 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;
- }
- }
- }
- else
- find_arch_match (tname, arches);
- }
-
- free (arches);
-
- if (! def_target_arch)
- fatal ("Can't detect architecture.");
- }
+ if (! def_target_arch)
+ fatal ("Can't detect architecture.");
}
bfd *