kumquat-buildroot/package/binutils/2.37/0003-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
Thomas Petazzoni 62f0232980 package/binutils: add version 2.37
State of the patches:

- 0001-sh-conf.patch
  Refreshed

- 0002-poison-system-directories.patch
  Refreshed, but needed some adaptations as the bfd_boolean type no
  longer exists, and the standard "bool" type is now used instead.

- 0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
  Drop, present in 2.37, merged upstream as
  a76ef689b60405e494cb99e198acf3c82f467f7d

- 0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
  Drop, present in 2.37, merged upstream as
  0b3e14c90283c5d234884d0ebe8510bc3c9bc687

- 0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
  Drop, present in 2.37, merged upstream as
  3c3de29b048bca6b4aa4235c647b9328e71801b6

- 0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
  Drop, present in 2.37, merged upstream as
  284a1309021a0ef4c29f198470d95652f02b13f0

- 0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
  Refreshed

- 0008-or1k-fix-pc-relative-relocation-against-dynamic-on-P.patch
  Refreshed

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-02 15:29:07 +02:00

51 lines
1.6 KiB
Diff

From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
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++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1