From patchwork Wed Jun 9 16:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 1489994 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aruba.it header.i=@aruba.it header.a=rsa-sha256 header.s=a1 header.b=MxnbDxAR; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G0Y1H5YQ1z9sRN for ; Thu, 10 Jun 2021 02:47:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0342440166; Wed, 9 Jun 2021 16:47:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cNcMNXz229CJ; Wed, 9 Jun 2021 16:47:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 0B02040173; Wed, 9 Jun 2021 16:47:11 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 17C041BF29D for ; Wed, 9 Jun 2021 16:47:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1070F60764 for ; Wed, 9 Jun 2021 16:47:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=aruba.it Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mD8ov9J3SZtZ for ; Wed, 9 Jun 2021 16:47:07 +0000 (UTC) X-Greylist: delayed 00:07:04 by SQLgrey-1.8.0 Received: from smtpcmd0872.aruba.it (smtpcmd0872.aruba.it [62.149.156.72]) by smtp3.osuosl.org (Postfix) with ESMTP id EE584607E1 for ; Wed, 9 Jun 2021 16:47:06 +0000 (UTC) Received: from ubuntu.localdomain ([146.241.205.41]) by Aruba Outgoing Smtp with ESMTPSA id r1FGlmYATbifkr1FHlMQgm; Wed, 09 Jun 2021 18:39:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1623256799; bh=CejQA5709BF4VJnvwCgafInPFdF8J0eZ+1xKt6ao0rI=; h=From:To:Subject:Date:MIME-Version; b=MxnbDxARX87MSa+EAunLwxgOMBAQ29cJ/L3N5pErBqK/yy38QkuIBjBppUzXHbGSi GMha9wiRv7vCwRAeyCciaiuklftVUUBmjYy/6DWqAO/3hzKY1YAG+T0i8rDynlDM4+ V4QOt5gMfPhAnmc08jx7On9w0FI6/unZ6UusWsLdGdz81TyYD+Me8GPQ2BLV/+5TJi WP3U0sc1J4cfjVWg6vHfNt5ltVUYCd/buYpmqbbPx+Lw5i8PN24L+PrtQBj4abSZHV CTutpo+l3ZBhigI9nZSeUU6klm7EVua9Baa5OxvUhD8ZPK4zWumwvRXpdclG+0+9cf mC+0ypR43KeHQ== From: Giulio Benetti To: buildroot@buildroot.org Date: Wed, 9 Jun 2021 18:27:53 +0200 Message-Id: <20210609162753.1138390-1-giulio.benetti@benettiengineering.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <4db92b61-32e1-f4c0-4986-99ab2b1da09d@gmail.com> References: <4db92b61-32e1-f4c0-4986-99ab2b1da09d@gmail.com> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfMkr5nhTaXKvDLZOBgdcI2PhG6xB3acuDuMjNsfsV8H+s+98FuYC0nRWRFoWcbJIk3kty8jD9oat2QyalhH3MaxzRk2cuGsXIAAa6MT8eZkBOfK03z6t Y+gq2Wa6wu7wHOXEaBOF1ObXDW/Hz8Y3p2iGzjBhBuKSSTQOo9mWy+y885tdSFod6nBZ19ajNXw0GiQUk0sTW3WgNtlhZCmRrKhNVrihUizjRkUWzUy94l8N 5Aswcz/oFpyB443MCa4FLU4kIyzN07Q5tYPmgLfJuX71e7zKA5fXR3gD6FVG5lFf Subject: [Buildroot] [PATCH] package/binutils: fix building or1k with host gcc version < 5 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Giulio Benetti Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add patches to fix building on hosts that provide gcc version < 5 (i.e. 4.9), otherwise they fail due to missing default '-std=gnu11' option on variable declaration inside for loops. The patch is pending upstream: https://sourceware.org/pipermail/binutils/2021-June/116884.html Signed-off-by: Giulio Benetti Reviewed-by: Romain Naour --- ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++ ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++ ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++ ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch create mode 100644 package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch create mode 100644 package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch create mode 100644 package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch diff --git a/package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch b/package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file mode 100644 index 0000000000..c3978e22fa --- /dev/null +++ b/package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch @@ -0,0 +1,50 @@ +From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +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 +--- + 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.25.1 + diff --git a/package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch b/package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file mode 100644 index 0000000000..c3978e22fa --- /dev/null +++ b/package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch @@ -0,0 +1,50 @@ +From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +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 +--- + 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.25.1 + diff --git a/package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch b/package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file mode 100644 index 0000000000..c3978e22fa --- /dev/null +++ b/package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch @@ -0,0 +1,50 @@ +From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +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 +--- + 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.25.1 + diff --git a/package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch b/package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file mode 100644 index 0000000000..c3978e22fa --- /dev/null +++ b/package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch @@ -0,0 +1,50 @@ +From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +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 +--- + 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.25.1 +