commit:     869d0dd6ceb9728b6792fe2ad6b46e62e6367a4f
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 09:28:29 2024 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 09:59:13 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=869d0dd6

dev-util/mingw64-toolchain: fix binutils build with c23 (gcc15)

Closes: https://bugs.gentoo.org/943715
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../files/binutils-2.42-c23.patch                  | 93 ++++++++++++++++++++++
 .../mingw64-toolchain-12.0.0.ebuild                |  1 +
 2 files changed, 94 insertions(+)

diff --git a/dev-util/mingw64-toolchain/files/binutils-2.42-c23.patch 
b/dev-util/mingw64-toolchain/files/binutils-2.42-c23.patch
new file mode 100644
index 000000000000..f7e18615d6e0
--- /dev/null
+++ b/dev-util/mingw64-toolchain/files/binutils-2.42-c23.patch
@@ -0,0 +1,93 @@
+Needed with gcc15 due to newly defaulting to c23 (fixed in >=binutils-2.44).
+
+https://bugs.gentoo.org/943715
+https://sourceware.org/PR32372
+https://inbox.sourceware.org/binutils/[email protected]/
+(technically the full set of patches is not needed here, but doesn't hurt)
+--- a/binutils/bfd/elf32-ppc.c
++++ b/binutils/bfd/elf32-ppc.c
+@@ -4354,3 +4354,3 @@
+                     if (!bfd_elf_link_record_dynamic_symbol (info, opt))
+-                      return false;
++                      return NULL;
+                   }
+--- a/binutils/bfd/elf32-xtensa.c
++++ b/binutils/bfd/elf32-xtensa.c
+@@ -10073,3 +10073,3 @@
+ 
+-  removed = false;
++  removed = NULL;
+   if (is_operand_relocation (fix->src_type))
+@@ -10144,3 +10144,3 @@
+ 
+-  removed = false;
++  removed = NULL;
+   if (is_operand_relocation (ELF32_R_TYPE (orig_rel->rela.r_info)))
+--- a/binutils/bfd/elf64-ppc.c
++++ b/binutils/bfd/elf64-ppc.c
+@@ -4666,3 +4666,3 @@
+         if (ent == NULL)
+-          return false;
++          return NULL;
+         ent->next = local_got_ents[r_symndx];
+--- a/binutils/bfd/mach-o.c
++++ b/binutils/bfd/mach-o.c
+@@ -6039,3 +6039,3 @@
+   if (ncmd != 1 || uuid_cmd == NULL)
+-    return false;
++    return NULL;
+   return &uuid_cmd->command.uuid;
+--- a/binutils/bfd/xsym.c
++++ b/binutils/bfd/xsym.c
+@@ -133,3 +133,3 @@
+   if (bfd_seek (abfd, table_offset, SEEK_SET) != 0)
+-    return false;
++    return NULL;
+   return _bfd_alloc_and_read (abfd, table_size, table_size);
+--- a/binutils/binutils/prdbg.c
++++ b/binutils/binutils/prdbg.c
+@@ -2820,3 +2820,3 @@
+       abort ();
+-      return false;
++      return NULL;
+     }
+--- a/binutils/ld/pdb.c
++++ b/binutils/ld/pdb.c
+@@ -177,3 +177,3 @@
+       bfd_close (stream);
+-      return false;
++      return NULL;
+     }
+--- a/binutils/opcodes/i386-gen.c
++++ b/binutils/opcodes/i386-gen.c
+@@ -32,3 +32,5 @@
+    in preference where possible.  */
++#ifndef static_assert
+ #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
++#endif
+ 
+--- a/binutils/opcodes/mips-formats.h
++++ b/binutils/opcodes/mips-formats.h
+@@ -51,3 +51,3 @@
+     typedef char ATTRIBUTE_UNUSED \
+-      static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
++      static_assert_3[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
+     static const struct mips_mapped_int_operand op = { \
+@@ -85,3 +85,3 @@
+     typedef char ATTRIBUTE_UNUSED \
+-      static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
++      static_assert_4[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
+     static const struct mips_reg_operand op = { \
+@@ -95,3 +95,3 @@
+     typedef char ATTRIBUTE_UNUSED \
+-      static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
++      static_assert_5[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
+     static const struct mips_reg_operand op = { \
+--- a/binutils/opcodes/s390-opc.c
++++ b/binutils/opcodes/s390-opc.c
+@@ -38,3 +38,5 @@
+    in preference where possible.  */
++#ifndef static_assert
+ #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
++#endif
+ 

diff --git a/dev-util/mingw64-toolchain/mingw64-toolchain-12.0.0.ebuild 
b/dev-util/mingw64-toolchain/mingw64-toolchain-12.0.0.ebuild
index ee5e4abfb62e..1a927aed674b 100644
--- a/dev-util/mingw64-toolchain/mingw64-toolchain-12.0.0.ebuild
+++ b/dev-util/mingw64-toolchain/mingw64-toolchain-12.0.0.ebuild
@@ -69,6 +69,7 @@ QA_CONFIG_IMPL_DECL_SKIP=(
 PATCHES=(
        "${FILESDIR}"/gcc-12.2.0-drop-cflags-sed.patch
        "${FILESDIR}"/gcc-14.1.0-no-omit-fp-ice.patch
+       "${FILESDIR}"/binutils-2.42-c23.patch
 )
 
 pkg_pretend() {

Reply via email to