This is the mail archive of the
mailing list for the binutils project.
RE: [PATCH] [ARC] Fix handling of cpu=... disassembler option value
- From: Anton Kolesov <Anton dot Kolesov at synopsys dot com>
- To: Pedro Alves <palves at redhat dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Francois Bedard <Francois dot Bedard at synopsys dot com>, Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>, Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- Date: Fri, 16 Jun 2017 11:44:24 +0000
- Subject: RE: [PATCH] [ARC] Fix handling of cpu=... disassembler option value
- Authentication-results: sourceware.org; auth=none
- References: <20170615145946.4158-1-Anton.Kolesov@synopsys.com> <email@example.com>
> On 06/15/2017 03:59 PM, Anton Kolesov wrote:
> > There is a bug in handling of cpu=... disassembler option in case
> > there are other options after it, for example, `cpu=EM,dsp'. In this
> > case `EM,dsp' is treated as an option value, and strcasecmp reports is as
> non-equal to "EM".
> > This could have been fixed by using strncasecmp and passing length of
> > cpu_types[i].name as size argument, or using strcasestr, but that
> > would cause another problem as value `em4,dsp' would be equal to `em'
> > cpy_type.name in those cases. Therefore the right solution is to
> > extract value of cpu option fully and pass it as an argument to
> Couldn't this use disassembler_options_cmp /
> See e.g. ppc-dis.c:ppc_parse_cpu for example.
FOR_EACH_DISASSEMBLER_OPTION advances pointer to the beginning of next option,
but it doesn't create a new string with \0 at the end. So, for example, this
const char* option;
FOR_EACH_DISASSEMBLER_OPTION (option, "fpuda,fpud,fpus")
printf ("option: %s\n", option);
As a result this macro can be used to improve existing code in arc-dis.c,
however it doesn't address the issue that this particular patch is trying to
fix. I can make a separate patch that would change ARC code to use
> Pedro Alves