toolchain: binutils: fix compilation with GCC15
authorRobert Marko <[email protected]>
Fri, 2 May 2025 09:07:54 +0000 (11:07 +0200)
committerHauke Mehrtens <[email protected]>
Sun, 8 Jun 2025 19:28:26 +0000 (21:28 +0200)
commitbd9b964b248cc582b134cd3ca8c160fa422e7ac5
tree7e1d03182e0c39a0d58409d7a8b91092310e28f8
parent75d2f9f1c8a70ef950124a710ab0578b8569199c
toolchain: binutils: fix compilation with GCC15

GCC15 has switched the C language default from GNU17 to GNU23[1] and this
causes builds to fail with:
In file included from mips-opc.c:29:
mips-opc.c: In function 'decode_mips_operand':
mips-formats.h:86:7: error: expected identifier or '(' before 'static_assert'
   86 |       static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
      |       ^~~~~~~~~~~~~
mips-opc.c:214:15: note: in expansion of macro 'MAPPED_REG'
  214 |     case 'z': MAPPED_REG (0, 0, GP, reg_0_map);
      |               ^~~~~~~~~~

So, backport upstream fix for this[2] to fix compilation with GCC15.
Patch for 2.40 was manually refreshed as part of the S390 code does not
exist in 2.40 as it was added after it.

[1] https://gcc.gnu.org/gcc-15/porting_to.html#c23
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4

Fixes: #18678
Link: https://github.com/openwrt/openwrt/pull/18681
Signed-off-by: Robert Marko <[email protected]>
(cherry picked from commit d3216173abfc47917807423fc7578406ea29db5b)
Link: https://github.com/openwrt/openwrt/pull/19065
Signed-off-by: Hauke Mehrtens <[email protected]>
toolchain/binutils/patches/2.40/050-PR-32372-opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch [new file with mode: 0644]