All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v2] bfd/elf32-or1k: fix building with gcc version < 5
Date: Thu, 10 Jun 2021 22:36:28 +0930	[thread overview]
Message-ID: <YMIOVK3h+AooX4DR@bubble.grove.modra.org> (raw)
In-Reply-To: <3ef9acac-9f1a-2aab-1c9e-a0d4aaae6ccd@benettiengineering.com>

On Thu, Jun 10, 2021 at 11:07:13AM +0200, Giulio Benetti wrote:
> Hello Alan, All,
> 
> On 6/10/21 3:19 AM, Alan Modra wrote:
> > On Wed, Jun 09, 2021 at 11:52:33PM +0200, Giulio Benetti wrote:
> > > Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
> > > an old compiler(i.e. gcc 4.9) build fails on:
> > > ```
> > > elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
> > > C99 or C11 mode
> > >      for (size_t i = 0; i < insn_count; i++)
> > >      ^
> > > ```
> > 
> > Did you find this problem on current mainline binutils?  The configure
> > machinery is supposed to supply the appropriate -std=c99 or -std=gnu99
> > when using older compilers.  That happens for me when I build with
> > gcc-4.9.  I don't think any patch is needed for mainline.
> > 
> 
> On Buildroot they don't pass -std=c99/g99 and this is the result:
> https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

That appears to be building binutils 2.35.2

> This patch seems to follow all the rest code style of binutils

True, we've only just switched over to requiring C99.

> since no
> other part of it fails and this happens only after patch [1] has been
> upstreamed.
> 
> Here [2] you can see all the other toolchains built succesfully and only
> Openrisc fails after the patch provided by Stafford([1]).
> 
> [1]: http://patches-tcwg.linaro.org/patch/53151/
> [2]: https://gitlab.com/bootlin/toolchains-builder/-/jobs

OK, so the real problem is in a backport.  It isn't current mainline
binutils configure, which is what I was worried about.

BTW, thank you for posting a fix here, even if it isn't strictly
necessary for mainline.  Please note that I'm not advocating against
your patch.  If target maintainers want to keep their code compatible
with C89 that's fine by me.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2021-06-10 13:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 15:30 [OpenRISC] [PATCH] bfd/elf32-or1k: fix building with gcc version < 5 Giulio Benetti
2021-06-09 21:44 ` Stafford Horne
2021-06-09 21:52   ` [OpenRISC] [PATCH v2] " Giulio Benetti
2021-06-10  1:19     ` Alan Modra
2021-06-10  9:07       ` Giulio Benetti
2021-06-10 13:06         ` Alan Modra [this message]
2021-06-10 14:48           ` Giulio Benetti
2021-06-10 19:23             ` Stafford Horne
2021-06-10 21:37               ` Giulio Benetti
2021-06-09 21:53   ` [OpenRISC] [PATCH] " Giulio Benetti

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=YMIOVK3h+AooX4DR@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=openrisc@lists.librecores.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.