From: Torsten Duwe <duwe@suse.de>
To: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
Cc: Sandra Loosemore <sandra@codesourcery.com>,
Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
Bernd Schmidt <bschmidt@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Szabolcs Nagy <szabolcs.nagy@arm.com>,
nd@arm.com, Li Bin <huawei.libin@huawei.com>,
Jiri Kosina <jkosina@suse.cz>,
Marcus Shawcroft <Marcus.Shawcroft@arm.com>,
Takahiro Akashi <takahiro.akashi@linaro.org>,
Andrew Wafaa <Andrew.Wafaa@arm.com>
Subject: Re: [PATCH v5] add -fprolog-pad=N,M option
Date: Fri, 17 Feb 2017 17:25:00 -0000 [thread overview]
Message-ID: <20170217170518.GB25613@suse.de> (raw)
In-Reply-To: <9970dba9-8364-89f7-7a32-a8acd390b7e5@arm.com>
On Wed, Feb 15, 2017 at 11:01:16AM +0000, Richard Earnshaw (lists) wrote:
> On 13/01/17 12:19, Torsten Duwe wrote:
>
> > +++ b/gcc/doc/invoke.texi
> > @@ -11341,6 +11341,27 @@ of the function name, it is considered to be a match. For C99 and C++
> > extended identifiers, the function name must be given in UTF-8, not
> > using universal character names.
> >
> > +@item -fprolog-pad=@var{N},@var{M}
> This needs to make it clear that M is optional. Then below state that
> if omitted, M defaults to zero.
It was mentioned, further down in the paragraph. I moved it up.
> > --- a/gcc/opts.c
> > +++ b/gcc/opts.c
> > @@ -2157,6 +2157,26 @@ common_handle_option (struct gcc_options *opts,
> > opts->x_flag_ipa_reference = false;
> > break;
> >
> > + case OPT_fprolog_pad_:
> > + {
> > + const char *comma = strchr (arg, ',');
> > + if (comma)
> > + {
> > + prolog_nop_pad_size = atoi (arg);
> > + prolog_nop_pad_entry = atoi (comma + 1);
> > + }
> > + else
> > + {
> > + prolog_nop_pad_size = atoi (arg);
> > + prolog_nop_pad_entry = 0;
> > + }
>
> Where's the error checking? If I write gibberish after the option name
> then atoi will silently fail and return zero. I'm not overly familiar
> with the option handling code, but I'm sure we have routines to do the
> heavy lifting here.
Yes, I had already found integral_argument, but that's unsuitable for a
comma separated list, and arg is const so I could' punch a \0 there.
Using atoi was just lazy, admittedly.
> > +default_print_prolog_pad (FILE *file, unsigned HOST_WIDE_INT pad_size,
> > + bool record_p)
> > +{
> > + if (record_p)
> > + fprintf (file, "1:");
> > +
> > + unsigned i;
> > + for (i = 0; i < pad_size; ++i)
> > + fprintf (file, "\tnop\n");
> > +
> > + if (record_p)
> > + {
> > + fprintf (file, "\t.section __prolog_pads_loc, \"a\",@progbits\n");
> > + fprintf (file, "\t.quad 1b\n");
> > + fprintf (file, "\t.previous\n");
> > + }
> > +}
>
> NO! Almost everything in this function is wrong, it needs to be done
> through suitable hooks that call into the machine back-ends that
> understand assembly flavours supported.
That was already mentioned in a previous version. That code assumes GAS+ELF.
It was the quick and dirty solution to get a working prototype.
Torsten
prev parent reply other threads:[~2017-02-17 17:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-16 14:16 [PATCH v3] " Torsten Duwe
2016-12-19 15:33 ` Bernd Schmidt
2016-12-20 13:42 ` Maxim Kuvyrkov
2016-12-21 17:29 ` [PATCH v4] " Torsten Duwe
2016-12-21 18:54 ` Sandra Loosemore
2017-01-13 12:20 ` [PATCH v5] " Torsten Duwe
2017-01-16 2:41 ` Sandra Loosemore
2017-01-23 14:15 ` Torsten Duwe
2017-01-23 16:45 ` Bernd Schmidt
2017-02-08 11:18 ` Torsten Duwe
2017-02-08 11:49 ` Jakub Jelinek
2017-02-17 18:32 ` Torsten Duwe
2017-02-15 11:12 ` Richard Earnshaw (lists)
2017-02-15 11:14 ` Marek Polacek
2017-02-15 11:20 ` Richard Earnshaw (lists)
2017-02-17 16:59 ` [PATCH v6] " Torsten Duwe
2017-02-18 8:17 ` Sandra Loosemore
2017-03-01 11:26 ` Poll for option name (Was: [PATCH v6] add -fprolog-pad=N,M option) Torsten Duwe
2017-03-01 11:34 ` Richard Earnshaw (lists)
2017-03-01 13:32 ` Torsten Duwe
2017-03-01 13:36 ` Richard Earnshaw (lists)
2017-02-17 17:25 ` Torsten Duwe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170217170518.GB25613@suse.de \
--to=duwe@suse.de \
--cc=Andrew.Wafaa@arm.com \
--cc=Marcus.Shawcroft@arm.com \
--cc=Richard.Earnshaw@arm.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=huawei.libin@huawei.com \
--cc=jkosina@suse.cz \
--cc=maxim.kuvyrkov@linaro.org \
--cc=nd@arm.com \
--cc=sandra@codesourcery.com \
--cc=szabolcs.nagy@arm.com \
--cc=takahiro.akashi@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).