This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch]: Patch for wince
2009/1/2 Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>:
> On Thu, Jan 01, 2009 at 07:44:12PM +0100, Kai Tietz wrote:
>>> I probably missed this in a previous message but can you show the
>>> target triple that this is supposed to be adapted to?
>>E.g. "pe-arm-wince-little"
>>
>>I attached corrected patch.
>
> Thanks. Can I suggest that you add this as an example to the comments
> and maybe to the ChangeLog so that it is a little clearer what is
> attempting to be parsed?
>
> cgf
>
Ok, I added a comment as example to source.
ChangeLog
2009-01-03 Kai Tietz <kai.tietz@onevision.com>
* windres.c (set_endianess): Get architecture name
for triplets like "pe-arm-wince-little".
Is this patch ok for apply?
Cheers,
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: src/binutils/windres.c
===================================================================
--- src.orig/binutils/windres.c
+++ src/binutils/windres.c
@@ -1080,9 +1080,26 @@ 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;
+
+ /* Make sure we dectect architecture names
+ for triplets like "pe-arm-wince-little". */
+ 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);