Skip to contentSkip to conversation

Patch and remove Nios2 binutils bug 27597

PATCH Superseded Giulio Benetti 4 participants 28 messages Feb 18, 2024 – Feb 21, 2024

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Patch and remove Nios2 binutils bug 27597

This patchset add backported patches for Buildroot Nios2 binutils bug 27597 and drop packages dependency on it. Doing this the external toolchain will fail building those packages, so I'm not that sure how to deal with this situation. The same happened for OpenRisc and as far as I remember the first patch of the series has been applied, then Bootlin toolchains have been patched and rebuilt/ redeployed, in the end the remaining patches have been applied. But here we also have Sourcery CodeBench Nios-II 2018.05 toolchain that contain the bug, so I don't know how to deal with this situation to avoid build failures.

Any ideas?

Thank you!

Best regards
Giulio

Giulio Benetti (8):
package/binutils: add local patches to fix Nios2 bug 27597 package/gdal: drop nios2 binutils bug 27597 dependency package/kf5/kf5-kcoreaddons: drop nios2 binutils bug 27597 dependency package/libcamera: drop nios2 binutils bug 27597 dependency package/libgeos: drop nios2 binutils bug 27597 dependency package/pistache: drop nios2 binutils bug 27597 dependency package/postgis: drop nios2 binutils bug 27597 dependency
toolchain: remove binutils bug 27597

 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 package/gdal/Config.in                        |   4 +-
 package/kf5/kf5-kcoreaddons/Config.in         |   1 -
 package/libcamera/Config.in                   |   1 -
 package/libgeos/Config.in                     |   6 +-
 package/pistache/Config.in                    |   6 +-
 package/postgis/Config.in                     |   6 +-
 toolchain/Config.in                           |   6 -
 10 files changed, 382 insertions(+), 23 deletions(-)
 create mode 100644 package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/8 package/binutils: add local patches to fix Nios2 bug 27597

These backported patches fix Nios2 linker bug 27597 that affects packages gdal, kf5-kcoreaddons, libgeos, libcamera, pistache.

---
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 3 files changed, 375 insertions(+)
 create mode 100644 package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0
new file mode 100644
index 0000000000..4753ae13c4
@@ -0,0 +1,125 @@
+From 900c0f0aa3d78cd9e67ccd26fbc86224cef4c5b1 Mon Sep 17 00:00:00 2001
+From: Alan Modra <[email protected]>
+Date: Fri, 16 Feb 2024 22:33:29 +1030
+Subject: [PATCH] PR27597, nios: assertion fail in nios2_elf32_install_imm16
+
+The assertion in nios2_elf32_install_imm16 triggers when the PLT is
+twice the maximum allowable size for a branch from PLTn to reach
+.PLTresolve, and on no other call to nios2_elf32_install_imm16.  That
+makes the assertion completely useless.  We can handle a PIC PLT
+exceeding 0x8000 in size by bouncing branches that won't reach through
+previous branches.
+
+	PR 27597
+	* elf32-nios2.c (nios2_elf32_install_imm16): Delete BFD_ASSERT.
+	(nios2_build_one_stub): Don't bother masking value passed to
+	nios2_elf32_install_imm16.
+	(nios2_elf32_finish_dynamic_symbol): Likewise.  Handle overflow
+	of PLTn branch to .PLTresolve by bouncing through prior branches.
+
+Upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=900c0f0aa3d78cd9e67ccd26fbc86224cef4c5b1
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-nios2.c | 40 ++++++++++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 16 deletions(-)
+
+diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
+index bebf4239958..7f61e2f8507 100644
+--- a/bfd/elf32-nios2.c
++++ b/bfd/elf32-nios2.c
+@@ -1878,8 +1878,6 @@ nios2_elf32_install_imm16 (asection *sec, bfd_vma offset, bfd_vma value)
+ {
+   bfd_vma word = bfd_get_32 (sec->owner, sec->contents + offset);
+ 
+-  BFD_ASSERT (value <= 0xffff || ((bfd_signed_vma) value) >= -0xffff);
+-
+   bfd_put_32 (sec->owner, word | ((value & 0xffff) << 6),
+ 	      sec->contents + offset);
+ }
+@@ -2518,7 +2516,7 @@ nios2_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_U
+       nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset,
+ 				 hiadj (sym_value));
+       nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset + 4,
+-				 (sym_value & 0xffff));
++				 sym_value);
+       stub_sec->size += 12;
+       break;
+     default:
+@@ -4986,16 +4984,28 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
+       /* Emit the PLT entry.  */
+       if (bfd_link_pic (info))
+ 	{
++	  bfd_vma br_offset;
++
+ 	  nios2_elf32_install_data (splt, nios2_so_plt_entry, h->plt.offset,
+ 				    3);
+ 	  plt_index = (h->plt.offset - 24) / 12;
+ 	  got_offset = (plt_index + 3) * 4;
+ 	  nios2_elf32_install_imm16 (splt, h->plt.offset,
+-				     hiadj(plt_index * 4));
++				     hiadj (plt_index * 4));
+ 	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+-				     (plt_index * 4) & 0xffff);
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset + 8,
+-				     0xfff4 - h->plt.offset);
++				     plt_index * 4);
++	  br_offset = -(h->plt.offset + 12);
++	  /* If this plt entry is too far away from the start of .plt
++	     for the "br" to reach .PLTresolve, bounce through one or
++	     more of the previous "br" instructions.  */
++	  if (br_offset < (bfd_vma) -32768)
++	    {
++	      br_offset += 32768 / 12 * 12 - 4;
++	      while (br_offset < (bfd_vma) -32768)
++		br_offset += 32768 / 12 * 12;
++	    }
++	  nios2_elf32_install_imm16 (splt, h->plt.offset + 8, br_offset);
++
+ 	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+ 			 + got_offset);
+ 
+@@ -5014,9 +5024,8 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
+ 	  nios2_elf32_install_data (splt, nios2_plt_entry, h->plt.offset, 3);
+ 	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+ 			 + got_offset);
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset, hiadj(got_address));
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+-				     got_address & 0xffff);
++	  nios2_elf32_install_imm16 (splt, h->plt.offset, hiadj (got_address));
++	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4, got_address);
+ 
+ 	  /* Fill in the entry in the global offset table.  */
+ 	  bfd_put_32 (output_bfd,
+@@ -5217,8 +5226,8 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
+ 	      BFD_ASSERT ((got_pcrel & 0xf) == 0);
+ 	      nios2_elf32_install_data (splt, nios2_so_plt0_entry, 0, 6);
+ 	      nios2_elf32_install_imm16 (splt, 4, hiadj (got_pcrel));
+-	      nios2_elf32_install_imm16 (splt, 12, got_pcrel & 0xffff);
+-	      nios2_elf32_install_imm16 (splt, 16, (got_pcrel + 4) & 0xffff);
++	      nios2_elf32_install_imm16 (splt, 12, got_pcrel);
++	      nios2_elf32_install_imm16 (splt, 16, got_pcrel + 4);
+ 	    }
+ 	  else
+ 	    {
+@@ -5240,14 +5249,13 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
+ 
+ 	      nios2_elf32_install_data (splt, nios2_plt0_entry, res_size, 7);
+ 	      nios2_elf32_install_imm16 (splt, res_size, hiadj (res_start));
+-	      nios2_elf32_install_imm16 (splt, res_size + 4,
+-					 res_start & 0xffff);
++	      nios2_elf32_install_imm16 (splt, res_size + 4, res_start);
+ 	      nios2_elf32_install_imm16 (splt, res_size + 12,
+ 					 hiadj (got_address));
+ 	      nios2_elf32_install_imm16 (splt, res_size + 16,
+-					 (got_address + 4) & 0xffff);
++					 got_address + 4);
+ 	      nios2_elf32_install_imm16 (splt, res_size + 20,
+-					 (got_address + 8) & 0xffff);
++					 got_address + 8);
+ 	    }
+ 	}
+     }
+-- 
+2.34.1
+
package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0

125 lines not on this page · raw message

package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0

125 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 2/8 package/gdal: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/gdal/Config.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/gdal/Config.in +1 -3
index 24a1f06af2..839a1bd7ea 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_GDAL
 	# configure can't find proj, when linking statically
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	depends on BR2_TOOLCHAIN_HAS_THREADS # proj
 	depends on BR2_USE_WCHAR # proj
 	select BR2_PACKAGE_GIFLIB
@@ -26,9 +25,8 @@ config BR2_PACKAGE_GDAL
 
 	  https://gdal.org/
 
-comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, not binutils bug 27597, threads, wchar"
+comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, threads, wchar"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || \
-		BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/8] package/gdal: drop nios2 binutils bug 27597 dependency

Giulio, All,

On 2024-02-18 19:45 +0100, Giulio Benetti spake thusly:

Quoted 2 lines

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

What about external pre-built toolchains?

Comment valid for all the patches in this series...

Regards,
Yann E. MORIN.

Quoted 35 lines
---
 package/gdal/Config.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/gdal/Config.in +1 -3
index 24a1f06af2..839a1bd7ea 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_GDAL
 	# configure can't find proj, when linking statically
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	depends on BR2_TOOLCHAIN_HAS_THREADS # proj
 	depends on BR2_USE_WCHAR # proj
 	select BR2_PACKAGE_GIFLIB
@@ -26,9 +25,8 @@ config BR2_PACKAGE_GDAL
 
 	  https://gdal.org/
 
-comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, not binutils bug 27597, threads, wchar"
+comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, threads, wchar"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || \
-		BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Maxim Kochetkov on v1 2/8
#4 lore raw

Re: [Buildroot] [PATCH 2/8] package/gdal: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti
Quoted 5 lines · Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH 3/8 package/kf5/kf5-kcoreaddons: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/kf5/kf5-kcoreaddons/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/kf5/kf5-kcoreaddons/Config.in +0 -1
index 02bd38e395..88fda03ee0 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_KF5_KCOREADDONS
 	bool "kf5-kcoreaddons"
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	select BR2_PACKAGE_KF5_EXTRA_CMAKE_MODULES
 	select BR2_PACKAGE_QT5TOOLS
 	select BR2_PACKAGE_QT5TOOLS_LINGUIST_TOOLS
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH 4/8 package/libcamera: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/libcamera/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/libcamera/Config.in +0 -1
index ccb5281b4b..e84b8d342e 100644
@@ -3,7 +3,6 @@ config BR2_PACKAGE_LIBCAMERA_ARCH_SUPPORTS
 	default y
 	# Invalid packing size of ControlValue struct on m68k
 	depends on !BR2_m68k
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 
 menuconfig BR2_PACKAGE_LIBCAMERA
 	bool "libcamera"
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH 5/8 package/libgeos: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/libgeos/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/libgeos/Config.in +2 -4
index 2a27c6f2a4..76cbb9bdcd 100644
@@ -4,7 +4,6 @@ config BR2_PACKAGE_LIBGEOS
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++14
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	help
 	  GEOS (Geometry Engine - Open Source) is a C++ port of the
 	  JTS Topology Suite (JTS). It aims to contain the complete
@@ -14,8 +13,7 @@ config BR2_PACKAGE_LIBGEOS
 
 	  https://trac.osgeo.org/geos
 
-comment "libgeos needs a toolchain w/ C++, wchar, gcc >= 4.9, threads not binutils bug 27597"
+comment "libgeos needs a toolchain w/ C++, wchar, gcc >= 4.9, threads"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
 		   !BR2_TOOLCHAIN_HAS_THREADS || \
-		   !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
-		   BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		   !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Maxim Kochetkov on v1 5/8
#8 lore raw

Re: [Buildroot] [PATCH 5/8] package/libgeos: drop nios2 binutils bug 27597 dependency

Quoted 5 lines · Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

PATCH 6/8 package/pistache: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/pistache/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/pistache/Config.in +2 -4
index 3acf1f53f0..ca2d2833cd 100644
@@ -4,7 +4,6 @@ config BR2_PACKAGE_PISTACHE
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	select BR2_PACKAGE_RAPIDJSON
 	help
 	  Pistache is a modern and elegant HTTP and REST framework
@@ -13,9 +12,8 @@ config BR2_PACKAGE_PISTACHE
 
 	  https://github.com/oktal/pistache
 
-comment "pistache needs a toolchain w/ C++, gcc >= 7, threads, wchar, not binutils bug 27597"
+comment "pistache needs a toolchain w/ C++, gcc >= 7, threads, wchar"
 	depends on !BR2_INSTALL_LIBSTDCPP || \
 		   !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \
 		   !BR2_TOOLCHAIN_HAS_THREADS || \
-		   !BR2_USE_WCHAR || \
-		   BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		   !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

PATCH 7/8 package/postgis: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/postgis/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/postgis/Config.in +2 -4
index 7d42390677..78569d63be 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_POSTGIS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libgeos
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libgeos, proj
 	depends on BR2_USE_WCHAR # libgeos, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 # libgeos
 	select BR2_PACKAGE_LIBGEOS
 	select BR2_PACKAGE_PROJ
 	select BR2_PACKAGE_LIBXML2
@@ -18,7 +17,6 @@ config BR2_PACKAGE_POSTGIS
 
 	  https://postgis.net/
 
-comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.9, not binutils bug 27597"
+comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.9"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
-		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
-		BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Maxim Kochetkov on v1 7/8
#11 lore raw

Re: [Buildroot] [PATCH 7/8] package/postgis: drop nios2 binutils bug 27597 dependency

Quoted 5 lines · Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#12 lore raw

PATCH 8/8 toolchain: remove binutils bug 27597

In reply to Giulio Benetti

Binutils bug 27597 is not present anymore in Buildroot so let's remove it.

---
 toolchain/Config.in | 6 ------
 1 file changed, 6 deletions(-)
toolchain/Config.in +0 -6
index 407a03c42e..9e6cff1950 100644
@@ -71,12 +71,6 @@ source "package/gdb/Config.in.host"
 
 comment "Toolchain Generic Options"
 
-# https://sourceware.org/bugzilla/show_bug.cgi?id=27597
-# Affect toolchains built with binutils 2.36.1, still not fixed.
-config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
-	bool
-	default y if BR2_nios2
-
 # https://sourceware.org/bugzilla/show_bug.cgi?id=30730
 # Affect toolchains built with binutils 2.40, still not fixed.
 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_30730
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#13 lore raw

Re: [Buildroot] [PATCH 8/8] toolchain: remove binutils bug 27597

Giulio, all,

On 2024-02-18 19:45 +0100, Giulio Benetti spake thusly:

Quoted 12 lines

Binutils bug 27597 is not present anymore in Buildroot so let's remove it.

---
 toolchain/Config.in | 6 ------
 1 file changed, 6 deletions(-)
toolchain/Config.in +0 -0
index 407a03c42e..9e6cff1950 100644

toolchain/Config.in source "package/gdb/Config.in.host" · line 78

Quoted 8 lines
toolchain/Config.in +0 -5
@@ -71,12 +71,6 @@ source "package/gdb/Config.in.host"
 
 comment "Toolchain Generic Options"
 
-# https://sourceware.org/bugzilla/show_bug.cgi?id=27597
-# Affect toolchains built with binutils 2.36.1, still not fixed.
-config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
-	bool
-	default y if BR2_nios2

As I suggested in the cover letter, and that I'll duplicate here so it is recorded with Patchwork, don't remove the symbol. Instead, just drop the default, and have the sourceery niosII toolchain select it.

Regards,
Yann E. MORIN.

Quoted 10 lines
toolchain/Config.in +0 -0
 # https://sourceware.org/bugzilla/show_bug.cgi?id=30730
 # Affect toolchains built with binutils 2.40, still not fixed.
 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_30730
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#14 lore raw
In reply to Giulio Benetti

Giulio, All,

On 2024-02-18 19:45 +0100, Giulio Benetti spake thusly:

Quoted 8 lines

This patchset add backported patches for Buildroot Nios2 binutils bug 27597 and drop packages dependency on it. Doing this the external toolchain will fail building those packages, so I'm not that sure how to deal with this situation. The same happened for OpenRisc and as far as I remember the first patch of the series has been applied, then Bootlin toolchains have been patched and rebuilt/ redeployed, in the end the remaining patches have been applied. But here we also have Sourcery CodeBench Nios-II 2018.05 toolchain that contain the bug, so I don't know how to deal with this situation to avoid build failures.

My suggestion:
- keep BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
- make the sourcery toolchain select it.

For "soon" after BR 2024.02 release::
- drop the sourcery toolchain: it is going to be 6 years old when BR 2024.05, so it's going to be time to drop it.

Regards,
Yann E. MORIN.

Quoted 39 lines

Any ideas?

Thank you!

Best regards
Giulio

Giulio Benetti (8):
package/binutils: add local patches to fix Nios2 bug 27597 package/gdal: drop nios2 binutils bug 27597 dependency package/kf5/kf5-kcoreaddons: drop nios2 binutils bug 27597 dependency package/libcamera: drop nios2 binutils bug 27597 dependency package/libgeos: drop nios2 binutils bug 27597 dependency package/pistache: drop nios2 binutils bug 27597 dependency package/postgis: drop nios2 binutils bug 27597 dependency
toolchain: remove binutils bug 27597

 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 package/gdal/Config.in                        |   4 +-
 package/kf5/kf5-kcoreaddons/Config.in         |   1 -
 package/libcamera/Config.in                   |   1 -
 package/libgeos/Config.in                     |   6 +-
 package/pistache/Config.in                    |   6 +-
 package/postgis/Config.in                     |   6 +-
 toolchain/Config.in                           |   6 -
 10 files changed, 382 insertions(+), 23 deletions(-)
 create mode 100644 package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#15 lore raw
In reply to Giulio Benetti

Hello,

Quoted 8 lines · On Sun, 18 Feb 2024 19:45:28 +0100 Giulio Benetti…

This patchset add backported patches for Buildroot Nios2 binutils bug 27597 and drop packages dependency on it. Doing this the external toolchain will fail building those packages, so I'm not that sure how to deal with this situation. The same happened for OpenRisc and as far as I remember the first patch of the series has been applied, then Bootlin toolchains have been patched and rebuilt/ redeployed, in the end the remaining patches have been applied. But here we also have Sourcery CodeBench Nios-II 2018.05 toolchain that contain the bug, so I don't know how to deal with this situation to avoid build failures.

First of all, thanks for following up on this, I'm really happy to see that we are not always *adding* more GCC/binutils bug options, but sometimes *removing* some of them.

Regarding the CodeBench NIOSII toolchain from 2018.05, I think we could simply delete it. It makes sense to support old toolchains to some extent, but NIOSII is a very confidential architecture, and almost 6 years old toolchain is really ancient. So I would be entirely fine with dropping this toolchain.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#16 lore raw

Hi Thomas, Yann, Vincent, All,

Quoted 16 lines

Il giorno 18 feb 2024, alle ore 23:05, Thomas Petazzoni <[email protected]> ha scritto:

Hello,

Quoted 11 lines

On Sun, 18 Feb 2024 19:45:28 +0100
Giulio Benetti <[email protected]> wrote:

This patchset add backported patches for Buildroot Nios2 binutils bug 27597 and drop packages dependency on it. Doing this the external toolchain will fail building those packages, so I'm not that sure how to deal with this situation. The same happened for OpenRisc and as far as I remember the first patch of the series has been applied, then Bootlin toolchains have been patched and rebuilt/ redeployed, in the end the remaining patches have been applied. But here we also have Sourcery CodeBench Nios-II 2018.05 toolchain that contain the bug, so I don't know how to deal with this situation to avoid build failures.

Quoted 3 lines

First of all, thanks for following up on this, I'm really happy to see that we are not always *adding* more GCC/binutils bug options, but sometimes *removing* some of them.

It would be great if some Microblaze or Sh4 bug could be patched too.
There’s a patch proposed by Vincent for a Microblaze gcc ICE.
Vincent, it would be great if you provide a patchset similar to this for gcc, or I can deal with it.

Quoted 6 lines

Regarding the CodeBench NIOSII toolchain from 2018.05, I think we could simply delete it. It makes sense to support old toolchains to some extent, but NIOSII is a very confidential architecture, and almost 6 years old toolchain is really ancient. So I would be entirely fine with dropping this toolchain.

It sounds good to me and it’s similat suggestion of Yann.

One thing is left out to deal with, Bootlin toolchains that need to be patched/rebuilt/redeployed.

So I can give a respin to this series adding another patch dropping Sourcery external toolchain and you can apply it only after updating Bootlin Nios2 toolchain(this should be sufficient since the bug shows up only on Nios2). That way Buildroot will be bug 27597 free.

Thanks for commenting!

Best regards
Giulio

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#17 lore raw

All,

Quoted 26 lines · Giulio Benetti

Hi Thomas, Yann, Vincent, All,

Quoted 1 line

Il giorno 18 feb 2024, alle ore 23:05, Thomas Petazzoni <

[email protected]> ha scritto:

Quoted 7 lines

Hello,

Quoted 4 lines

On Sun, 18 Feb 2024 19:45:28 +0100
Giulio Benetti <[email protected]> wrote:

This patchset add backported patches for Buildroot Nios2 binutils bug

27597 and

Quoted 1 line
Quoted 1 line

drop packages dependency on it. Doing this the external toolchain will

fail

Quoted 1 line
Quoted 1 line

building those packages, so I'm not that sure how to deal with this

situation.

Quoted 1 line
Quoted 1 line

The same happened for OpenRisc and as far as I remember the first patch

of the

Quoted 1 line
Quoted 1 line

series has been applied, then Bootlin toolchains have been patched and

rebuilt/

Quoted 1 line
Quoted 1 line

redeployed, in the end the remaining patches have been applied. But

here we also

Quoted 1 line
Quoted 1 line

have Sourcery CodeBench Nios-II 2018.05 toolchain that contain the bug,

so I

Quoted 2 lines
Quoted 1 line

don't know how to deal with this situation to avoid build failures.

Quoted 10 lines
Quoted 3 lines

First of all, thanks for following up on this, I'm really happy to see that we are not always *adding* more GCC/binutils bug options, but sometimes *removing* some of them.

It would be great if some Microblaze or Sh4 bug could be patched too. There’s a patch proposed by Vincent for a Microblaze gcc ICE. Vincent, it would be great if you provide a patchset similar to this for gcc, or I can deal with it.

I can certainly post the patch for BR. I've been a bit busy recently so haven't done so and I'm a bit concerned with push back when trying to upstream it, so don't know if it's worth submitting it without an upstream submission.

Quoted 10 lines
Quoted 6 lines

Regarding the CodeBench NIOSII toolchain from 2018.05, I think we could simply delete it. It makes sense to support old toolchains to some extent, but NIOSII is a very confidential architecture, and almost 6 years old toolchain is really ancient. So I would be entirely fine with dropping this toolchain.

It sounds good to me and it’s similat suggestion of Yann.

Any patch for the MicroBlaze stuff (and other fixes) will have to slowly bleed into BR. As may have already been brought up, there are external toolchains that we do _not_ control which make it difficult to drop these types of flags.

I don't want to get too far off topic, but some of the things I brought up in https://bugs.buildroot.org/show_bug.cgi?id=15943 seem at least quasi-related.

Basically, it may behoove us to be very specific about what toolchains _must_ have in order to be supported by a specific version of BR, such as:

* Minimum version of kernel headers
* Minimum libc + other tool versions
* Prequisite patches

This would largely push consumers to vetted external toolchains such as the pre-created Bootlin toolchains that meet these requirements or to use BR generated toolchains. Otherwise, we'll be "supporting" a hodge-podge of toolchains with various mixtures of software indefinitely.

One thing is left out to deal with, Bootlin toolchains that need to be

Quoted 8 lines

patched/rebuilt/redeployed.

So I can give a respin to this series adding another patch dropping Sourcery external toolchain and you can apply it only after updating Bootlin Nios2 toolchain(this should be sufficient since the bug shows up only on Nios2).
That way Buildroot will be bug 27597 free.

Quoted 15 lines

Thanks for commenting!

Best regards
Giulio

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

-Vincent

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#18 lore raw

v2 cover Patch and remove Nios2 binutils bug 27597

In reply to Thomas Petazzoni via buildroot

This patchset:
* add backported patches for Buildroot Nios2 binutils bug 27597
* remove Codesourcery Nios2 external toolchain that is affected from bug above (I've tried to update to latest 2023.09-5 just for testing and yes, it's still affected by that bug, maybe once they will release toolchain based on latest binutils 2.42 that has patch applied to fix bug 27597 we can add it back)

* HERE we need Bootlin Nios2 Toolchain to be patched, rebuilt and updated. I've opened a PR with binutils patches for bug 27597:
https://github.com/bootlin/buildroot-toolchains/pull/2

* drop all bug 27597 bug depencies
* drop the bug 27597 itself

Best regards
Giulio

Giulio Benetti (9):
toolchain/toolchain-external: drop external codesourcery niosII
toolchain
package/binutils: add local patches to fix Nios2 bug 27597 package/gdal: drop nios2 binutils bug 27597 dependency package/kf5/kf5-kcoreaddons: drop nios2 binutils bug 27597 dependency package/libcamera: drop nios2 binutils bug 27597 dependency package/libgeos: drop nios2 binutils bug 27597 dependency package/pistache: drop nios2 binutils bug 27597 dependency package/postgis: drop nios2 binutils bug 27597 dependency
toolchain: remove binutils bug 27597

 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 package/gdal/Config.in                        |   4 +-
 package/kf5/kf5-kcoreaddons/Config.in         |   1 -
 package/libcamera/Config.in                   |   1 -
 package/libgeos/Config.in                     |   6 +-
 package/pistache/Config.in                    |   6 +-
 package/postgis/Config.in                     |   6 +-
 toolchain/Config.in                           |   6 -
 toolchain/toolchain-external/Config.in        |   6 -
 .../pkg-toolchain-external.mk                 |   2 +-
 .../Config.in                                 |  16 ---
 .../Config.in.options                         |   9 --
 ...oolchain-external-codesourcery-niosII.hash |   6 -
 .../toolchain-external-codesourcery-niosII.mk |  13 --
 16 files changed, 383 insertions(+), 74 deletions(-)
 create mode 100644 package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#19 lore raw

PATCH v2 1/9 toolchain/toolchain-external: drop external codesourcery niosII toolchain

This toolchain is pretty old and unlikely used. It's also affected by binutils bug 27597, so let's remove it.

---
 toolchain/toolchain-external/Config.in           |  6 ------
 .../toolchain-external/pkg-toolchain-external.mk |  2 +-
 .../Config.in                                    | 16 ----------------
 .../Config.in.options                            |  9 ---------
 .../toolchain-external-codesourcery-niosII.hash  |  6 ------
 .../toolchain-external-codesourcery-niosII.mk    | 13 -------------
 6 files changed, 1 insertion(+), 51 deletions(-)
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash
 delete mode 100644 toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk
toolchain/toolchain-external/Config.in +0 -6
index c1c159cb8e..cb678b7886 100644
@@ -33,9 +33,6 @@ source "toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config
 source "toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in"
 source "toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in"
 
-# NIOSII
-source "toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in"
-
 # Bootlin toolchains, available for virtually all architectures
 source "toolchain/toolchain-external/toolchain-external-bootlin/Config.in"
 
@@ -137,9 +134,6 @@ source "toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config
 source "toolchain/toolchain-external/toolchain-external-codescape-img-mips/Config.in.options"
 source "toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in.options"
 
-# NIOSII
-source "toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options"
-
 # Bootlin toolchains
 source "toolchain/toolchain-external/toolchain-external-bootlin/Config.in.options"
 
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
index ddf1d70ab4..aa5365b5bd 100644
@@ -13,7 +13,7 @@
 #  * Toolchains provided by Linaro for the ARM and AArch64
 #    architectures
 #  * Sourcery CodeBench toolchains (from Mentor Graphics) for the ARM,
-#    MIPS, PowerPC, x86_64 and NIOS 2 architectures. For the MIPS
+#    MIPS, PowerPC, and x86_64 architectures. For the MIPS
 #    toolchain, the -muclibc variant isn't supported yet, only the
 #    default glibc-based variant is.
 #  * Synopsys DesignWare toolchains for ARC cores
toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in deleted +0 -16
deleted file mode 100644
index cf3ce69a68..0000000000
@@ -1,16 +0,0 @@
-config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
-	bool "Sourcery CodeBench Nios-II 2018.05"
-	depends on BR2_nios2
-	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8
-	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
-	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
-	select BR2_TOOLCHAIN_HAS_SSP
-	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
-	select BR2_INSTALL_LIBSTDCPP
-	select BR2_HOSTARCH_NEEDS_IA32_LIBS
-	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
-	select BR2_TOOLCHAIN_GCC_AT_LEAST_7
-	help
-	  Sourcery CodeBench toolchain for the Nios-II architecture,
-	  from Mentor Graphics. It uses gcc 7.3, binutils 2.28,
-	  glibc 2.27, gdb 8.0.1 and kernel headers 4.15.5.
toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in.options deleted +0 -9
deleted file mode 100644
index 07cc5ede94..0000000000
@@ -1,9 +0,0 @@
-if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
-
-config BR2_TOOLCHAIN_EXTERNAL_PREFIX
-	default "nios2-linux-gnu"
-
-config BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL
-	default "toolchain-external-codesourcery-niosII"
-
-endif
toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.hash deleted +0 -6
deleted file mode 100644
index 47893ab7e2..0000000000
@@ -1,6 +0,0 @@
-# From https://sourcery.mentor.com/GNUToolchain/release3374
-md5  4f536b3b9b4e00f483e82e304c0a27ae  sourceryg++-2018.05-5-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
-md5  be42ab83da2e8db7b73dc890c2549570  sourceryg++-2018.05-5-nios2-linux-gnu.src.tar.bz2
-# Locally calculated
-sha256  c19afb432b5b23f8d5d639831d3a423a3ea3c9cc62e0015020d20ea2eb36dd1b  sourceryg++-2018.05-5-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
-sha256  d73a6364106dd62352711f932d3be8e97fdaaa548995678b5d38d9f21e22437a  sourceryg++-2018.05-5-nios2-linux-gnu.src.tar.bz2
toolchain/toolchain-external/toolchain-external-codesourcery-niosII/toolchain-external-codesourcery-niosII.mk deleted +0 -13
deleted file mode 100644
index cb0fe760ff..0000000000
@@ -1,13 +0,0 @@
-################################################################################
-#
-# toolchain-external-codesourcery-niosII
-#
-################################################################################
-
-TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION = 2018.05-5
-
-TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_SITE = https://sourcery.mentor.com/public/gnu_toolchain/$(TOOLCHAIN_EXTERNAL_PREFIX)
-TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_SOURCE = sourceryg++-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX)-i686-pc-linux-gnu.tar.bz2
-TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_ACTUAL_SOURCE_TARBALL = sourceryg++-$(TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII_VERSION)-$(TOOLCHAIN_EXTERNAL_PREFIX).src.tar.bz2
-
-$(eval $(toolchain-external-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#20 lore raw

PATCH v2 2/9 package/binutils: add local patches to fix Nios2 bug 27597

In reply to Giulio Benetti

These backported patches fix Nios2 linker bug 27597 that affects packages gdal, kf5-kcoreaddons, libgeos, libcamera, pistache.

---
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 ...ertion-fail-in-nios2_elf32_install_i.patch | 125 ++++++++++++++++++
 3 files changed, 375 insertions(+)
 create mode 100644 package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
 create mode 100644 package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch
package/binutils/2.39/0004-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0
new file mode 100644
index 0000000000..4753ae13c4
@@ -0,0 +1,125 @@
+From 900c0f0aa3d78cd9e67ccd26fbc86224cef4c5b1 Mon Sep 17 00:00:00 2001
+From: Alan Modra <[email protected]>
+Date: Fri, 16 Feb 2024 22:33:29 +1030
+Subject: [PATCH] PR27597, nios: assertion fail in nios2_elf32_install_imm16
+
+The assertion in nios2_elf32_install_imm16 triggers when the PLT is
+twice the maximum allowable size for a branch from PLTn to reach
+.PLTresolve, and on no other call to nios2_elf32_install_imm16.  That
+makes the assertion completely useless.  We can handle a PIC PLT
+exceeding 0x8000 in size by bouncing branches that won't reach through
+previous branches.
+
+	PR 27597
+	* elf32-nios2.c (nios2_elf32_install_imm16): Delete BFD_ASSERT.
+	(nios2_build_one_stub): Don't bother masking value passed to
+	nios2_elf32_install_imm16.
+	(nios2_elf32_finish_dynamic_symbol): Likewise.  Handle overflow
+	of PLTn branch to .PLTresolve by bouncing through prior branches.
+
+Upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=900c0f0aa3d78cd9e67ccd26fbc86224cef4c5b1
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-nios2.c | 40 ++++++++++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 16 deletions(-)
+
+diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
+index bebf4239958..7f61e2f8507 100644
+--- a/bfd/elf32-nios2.c
++++ b/bfd/elf32-nios2.c
+@@ -1878,8 +1878,6 @@ nios2_elf32_install_imm16 (asection *sec, bfd_vma offset, bfd_vma value)
+ {
+   bfd_vma word = bfd_get_32 (sec->owner, sec->contents + offset);
+ 
+-  BFD_ASSERT (value <= 0xffff || ((bfd_signed_vma) value) >= -0xffff);
+-
+   bfd_put_32 (sec->owner, word | ((value & 0xffff) << 6),
+ 	      sec->contents + offset);
+ }
+@@ -2518,7 +2516,7 @@ nios2_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_U
+       nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset,
+ 				 hiadj (sym_value));
+       nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset + 4,
+-				 (sym_value & 0xffff));
++				 sym_value);
+       stub_sec->size += 12;
+       break;
+     default:
+@@ -4986,16 +4984,28 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
+       /* Emit the PLT entry.  */
+       if (bfd_link_pic (info))
+ 	{
++	  bfd_vma br_offset;
++
+ 	  nios2_elf32_install_data (splt, nios2_so_plt_entry, h->plt.offset,
+ 				    3);
+ 	  plt_index = (h->plt.offset - 24) / 12;
+ 	  got_offset = (plt_index + 3) * 4;
+ 	  nios2_elf32_install_imm16 (splt, h->plt.offset,
+-				     hiadj(plt_index * 4));
++				     hiadj (plt_index * 4));
+ 	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+-				     (plt_index * 4) & 0xffff);
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset + 8,
+-				     0xfff4 - h->plt.offset);
++				     plt_index * 4);
++	  br_offset = -(h->plt.offset + 12);
++	  /* If this plt entry is too far away from the start of .plt
++	     for the "br" to reach .PLTresolve, bounce through one or
++	     more of the previous "br" instructions.  */
++	  if (br_offset < (bfd_vma) -32768)
++	    {
++	      br_offset += 32768 / 12 * 12 - 4;
++	      while (br_offset < (bfd_vma) -32768)
++		br_offset += 32768 / 12 * 12;
++	    }
++	  nios2_elf32_install_imm16 (splt, h->plt.offset + 8, br_offset);
++
+ 	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+ 			 + got_offset);
+ 
+@@ -5014,9 +5024,8 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
+ 	  nios2_elf32_install_data (splt, nios2_plt_entry, h->plt.offset, 3);
+ 	  got_address = (sgotplt->output_section->vma + sgotplt->output_offset
+ 			 + got_offset);
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset, hiadj(got_address));
+-	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4,
+-				     got_address & 0xffff);
++	  nios2_elf32_install_imm16 (splt, h->plt.offset, hiadj (got_address));
++	  nios2_elf32_install_imm16 (splt, h->plt.offset + 4, got_address);
+ 
+ 	  /* Fill in the entry in the global offset table.  */
+ 	  bfd_put_32 (output_bfd,
+@@ -5217,8 +5226,8 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
+ 	      BFD_ASSERT ((got_pcrel & 0xf) == 0);
+ 	      nios2_elf32_install_data (splt, nios2_so_plt0_entry, 0, 6);
+ 	      nios2_elf32_install_imm16 (splt, 4, hiadj (got_pcrel));
+-	      nios2_elf32_install_imm16 (splt, 12, got_pcrel & 0xffff);
+-	      nios2_elf32_install_imm16 (splt, 16, (got_pcrel + 4) & 0xffff);
++	      nios2_elf32_install_imm16 (splt, 12, got_pcrel);
++	      nios2_elf32_install_imm16 (splt, 16, got_pcrel + 4);
+ 	    }
+ 	  else
+ 	    {
+@@ -5240,14 +5249,13 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
+ 
+ 	      nios2_elf32_install_data (splt, nios2_plt0_entry, res_size, 7);
+ 	      nios2_elf32_install_imm16 (splt, res_size, hiadj (res_start));
+-	      nios2_elf32_install_imm16 (splt, res_size + 4,
+-					 res_start & 0xffff);
++	      nios2_elf32_install_imm16 (splt, res_size + 4, res_start);
+ 	      nios2_elf32_install_imm16 (splt, res_size + 12,
+ 					 hiadj (got_address));
+ 	      nios2_elf32_install_imm16 (splt, res_size + 16,
+-					 (got_address + 4) & 0xffff);
++					 got_address + 4);
+ 	      nios2_elf32_install_imm16 (splt, res_size + 20,
+-					 (got_address + 8) & 0xffff);
++					 got_address + 8);
+ 	    }
+ 	}
+     }
+-- 
+2.34.1
+
package/binutils/2.40/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0

125 lines not on this page · raw message

package/binutils/2.41/0003-PR27597-nios-assertion-fail-in-nios2_elf32_install_i.patch new file +125 -0

125 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#21 lore raw

PATCH v2 3/9 package/gdal: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/gdal/Config.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/gdal/Config.in +1 -3
index 24a1f06af2..839a1bd7ea 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_GDAL
 	# configure can't find proj, when linking statically
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	depends on BR2_TOOLCHAIN_HAS_THREADS # proj
 	depends on BR2_USE_WCHAR # proj
 	select BR2_PACKAGE_GIFLIB
@@ -26,9 +25,8 @@ config BR2_PACKAGE_GDAL
 
 	  https://gdal.org/
 
-comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, not binutils bug 27597, threads, wchar"
+comment "gdal needs a toolchain w/ C++, dynamic library, gcc >= 4.7, threads, wchar"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || \
-		BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#22 lore raw

PATCH v2 4/9 package/kf5/kf5-kcoreaddons: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/kf5/kf5-kcoreaddons/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/kf5/kf5-kcoreaddons/Config.in +0 -1
index 02bd38e395..88fda03ee0 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_KF5_KCOREADDONS
 	bool "kf5-kcoreaddons"
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	select BR2_PACKAGE_KF5_EXTRA_CMAKE_MODULES
 	select BR2_PACKAGE_QT5TOOLS
 	select BR2_PACKAGE_QT5TOOLS_LINGUIST_TOOLS
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#23 lore raw

PATCH v2 5/9 package/libcamera: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/libcamera/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/libcamera/Config.in +0 -1
index ccb5281b4b..e84b8d342e 100644
@@ -3,7 +3,6 @@ config BR2_PACKAGE_LIBCAMERA_ARCH_SUPPORTS
 	default y
 	# Invalid packing size of ControlValue struct on m68k
 	depends on !BR2_m68k
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 
 menuconfig BR2_PACKAGE_LIBCAMERA
 	bool "libcamera"
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#24 lore raw

PATCH v2 6/9 package/libgeos: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/libgeos/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/libgeos/Config.in +2 -4
index 2a27c6f2a4..76cbb9bdcd 100644
@@ -4,7 +4,6 @@ config BR2_PACKAGE_LIBGEOS
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++14
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	help
 	  GEOS (Geometry Engine - Open Source) is a C++ port of the
 	  JTS Topology Suite (JTS). It aims to contain the complete
@@ -14,8 +13,7 @@ config BR2_PACKAGE_LIBGEOS
 
 	  https://trac.osgeo.org/geos
 
-comment "libgeos needs a toolchain w/ C++, wchar, gcc >= 4.9, threads not binutils bug 27597"
+comment "libgeos needs a toolchain w/ C++, wchar, gcc >= 4.9, threads"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
 		   !BR2_TOOLCHAIN_HAS_THREADS || \
-		   !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
-		   BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		   !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#25 lore raw

PATCH v2 7/9 package/pistache: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/pistache/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/pistache/Config.in +2 -4
index 3acf1f53f0..ca2d2833cd 100644
@@ -4,7 +4,6 @@ config BR2_PACKAGE_PISTACHE
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	select BR2_PACKAGE_RAPIDJSON
 	help
 	  Pistache is a modern and elegant HTTP and REST framework
@@ -13,9 +12,8 @@ config BR2_PACKAGE_PISTACHE
 
 	  https://github.com/oktal/pistache
 
-comment "pistache needs a toolchain w/ C++, gcc >= 7, threads, wchar, not binutils bug 27597"
+comment "pistache needs a toolchain w/ C++, gcc >= 7, threads, wchar"
 	depends on !BR2_INSTALL_LIBSTDCPP || \
 		   !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \
 		   !BR2_TOOLCHAIN_HAS_THREADS || \
-		   !BR2_USE_WCHAR || \
-		   BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		   !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#26 lore raw

PATCH v2 8/9 package/postgis: drop nios2 binutils bug 27597 dependency

In reply to Giulio Benetti

Now that binutils patch has been backported to every Buildroot binutils version we can drop nios2 binutils bug 27597 dependency.

---
 package/postgis/Config.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
package/postgis/Config.in +2 -4
index 7d42390677..78569d63be 100644
@@ -5,7 +5,6 @@ config BR2_PACKAGE_POSTGIS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # libgeos
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libgeos, proj
 	depends on BR2_USE_WCHAR # libgeos, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 # libgeos
 	select BR2_PACKAGE_LIBGEOS
 	select BR2_PACKAGE_PROJ
 	select BR2_PACKAGE_LIBXML2
@@ -18,7 +17,6 @@ config BR2_PACKAGE_POSTGIS
 
 	  https://postgis.net/
 
-comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.9, not binutils bug 27597"
+comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.9"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
-		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
-		BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
+		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#27 lore raw

PATCH v2 9/9 toolchain: remove binutils bug 27597

In reply to Giulio Benetti

Binutils bug 27597 is not present anymore in Buildroot so let's remove it.

---
 toolchain/Config.in | 6 ------
 1 file changed, 6 deletions(-)
toolchain/Config.in +0 -6
index 407a03c42e..9e6cff1950 100644
@@ -71,12 +71,6 @@ source "package/gdb/Config.in.host"
 
 comment "Toolchain Generic Options"
 
-# https://sourceware.org/bugzilla/show_bug.cgi?id=27597
-# Affect toolchains built with binutils 2.36.1, still not fixed.
-config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
-	bool
-	default y if BR2_nios2
-
 # https://sourceware.org/bugzilla/show_bug.cgi?id=30730
 # Affect toolchains built with binutils 2.40, still not fixed.
 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_30730
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot