diff mbox series

[3/6] package/gdb: remove special arc version

Message ID 20231231172538.1279608-4-wbx@openadk.org
State Superseded
Headers show
Series rework arc architecture support | expand

Commit Message

Waldemar Brodkorb Dec. 31, 2023, 5:25 p.m. UTC
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 package/gdb/Config.in.host                    |   3 -
 ...t-define-basic_string_view-to_string.patch | 114 ------------------
 package/gdb/gdb.hash                          |   3 -
 package/gdb/gdb.mk                            |  23 +---
 4 files changed, 2 insertions(+), 141 deletions(-)
 delete mode 100644 package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch

Comments

Yann E. MORIN Dec. 31, 2023, 8:24 p.m. UTC | #1
Waldemar, All,

On 2023-12-31 18:25 +0100, Waldemar Brodkorb spake thusly:
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

This commit really needs some more information, as to why it is correct
to drop the arch specific version.

Indeed, until now, for gcc and binutils, it was possible to select
generic version of gcc or binutils, so dropping the arc version is not
too impactoing.

However, for gdb, the situation is different: until now, it was not
possible to select a generic version for arc. So this patch is doing
more than dropping the arc version: it makes the generic version
available, and only the generic versions, while they were not available
at all until then.

I believe this is a bigger tchange than we want to do all at once, at
should at the very least be done in two different patches: first make
the generic versions available for arc, then drop the arc version.

And both commit should have a proper commit log that explains why that
is an OK change.

Plus, see below...

> ---
>  package/gdb/Config.in.host                    |   3 -
>  ...t-define-basic_string_view-to_string.patch | 114 ------------------
>  package/gdb/gdb.hash                          |   3 -
>  package/gdb/gdb.mk                            |  23 +---
>  4 files changed, 2 insertions(+), 141 deletions(-)
>  delete mode 100644 package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch
> 
> diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host
> index da35fd94f7..69b13e9eb0 100644
> --- a/package/gdb/Config.in.host
> +++ b/package/gdb/Config.in.host
> @@ -35,14 +35,12 @@ config BR2_PACKAGE_HOST_GDB_PYTHON3
>  
>  config BR2_PACKAGE_HOST_GDB_SIM
>  	bool "Simulator support"
> -	depends on !BR2_arc

So the simulator was not available on arc until now, and this chjange
also makes it available.

This should be in a separate patch, most probably after the generic
versions are made available for arc, and even after the generic version
is dropped.

And in any case, the commit log should explain why it is now possible to
enable the simulator for arc.

Regards,
Yann E. MORIN.

>  	help
>  	  This option enables the simulator support in the cross gdb.
>  
>  choice
>  	prompt "GDB debugger Version"
>  	default BR2_GDB_VERSION_13
> -	depends on !BR2_arc
>  	help
>  	  Select the version of gdb you wish to use.
>  
> @@ -62,7 +60,6 @@ endif
>  # If cross-gdb is not enabled, the latest stable version is chosen.
>  config BR2_GDB_VERSION
>  	string
> -	default "arc-2020.09-release-gdb" if BR2_arc
>  	default "12.1"     if BR2_GDB_VERSION_12
>  	default "13.2"     if BR2_GDB_VERSION_13 || !BR2_PACKAGE_HOST_GDB
>  	# When making 14.x the default, or 14.x becomes the oldest version,
> diff --git a/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch b/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch
> deleted file mode 100644
> index 210ba6d609..0000000000
> --- a/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch
> +++ /dev/null
> @@ -1,114 +0,0 @@
> -From 5ac588997c3c2d032d5d5145d9245eb37354c23b Mon Sep 17 00:00:00 2001
> -From: Tom Tromey <tromey@adacore.com>
> -Date: Tue, 30 Jun 2020 07:53:03 -0600
> -Subject: [PATCH] Do not define basic_string_view::to_string
> -
> -gdb's copy of basic_string_view includes a to_string method.  However,
> -according to cppreference, this is not a method on the real
> -std::basic_string_view:
> -
> -https://en.cppreference.com/w/cpp/string/basic_string_view
> -
> -This difference matters because gdb_string_view.h will use the
> -standard implementation when built with a C++17 or later.  This caused
> -PR build/26183.
> -
> -This patch fixes the problem by changing the method to be a standalone
> -helper function, and then rewriting the uses.  Tested by rebuilding
> -with a version of GCC that defaults to C++17.
> -
> -(Note that the build still is not clean; and also I noticed that the
> -libstdc++ string_view forbids the use of nullptr ... I wonder if gdb
> -violates that.)
> -
> -gdb/ChangeLog
> -2020-06-30  Tom Tromey  <tromey@adacore.com>
> -
> -	PR build/26183:
> -	* ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use
> -	gdb::to_string.
> -
> -gdbsupport/ChangeLog
> -2020-06-30  Tom Tromey  <tromey@adacore.com>
> -
> -	PR build/26183:
> -	* gdb_string_view.h (basic_string_view::to_string): Remove.
> -	(gdb::to_string): New function.
> -
> -Upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5ac588997c3c2d032d5d5145d9245eb37354c23b
> -Bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=26183
> -
> -Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ----
> - gdb/ChangeLog                |  6 ++++++
> - gdb/ada-lang.c               |  8 ++++----
> - gdbsupport/ChangeLog         |  6 ++++++
> - gdbsupport/gdb_string_view.h | 17 ++++++++++-------
> - 4 files changed, 26 insertions(+), 11 deletions(-)
> -
> -diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
> -index 9b0c2efbfe2..98508c168bc 100644
> ---- a/gdb/ada-lang.c
> -+++ b/gdb/ada-lang.c
> -@@ -13553,10 +13553,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
> -     {
> -       if (user_name.back () == '>')
> - 	m_encoded_name
> --	  = user_name.substr (1, user_name.size () - 2).to_string ();
> -+	  = gdb::to_string (user_name.substr (1, user_name.size () - 2));
> -       else
> - 	m_encoded_name
> --	  = user_name.substr (1, user_name.size () - 1).to_string ();
> -+	  = gdb::to_string (user_name.substr (1, user_name.size () - 1));
> -       m_encoded_p = true;
> -       m_verbatim_p = true;
> -       m_wild_match_p = false;
> -@@ -13575,10 +13575,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
> - 	  if (encoded != NULL)
> - 	    m_encoded_name = encoded;
> - 	  else
> --	    m_encoded_name = user_name.to_string ();
> -+	    m_encoded_name = gdb::to_string (user_name);
> - 	}
> -       else
> --	m_encoded_name = user_name.to_string ();
> -+	m_encoded_name = gdb::to_string (user_name);
> - 
> -       /* Handle the 'package Standard' special case.  See description
> - 	 of m_standard_p.  */
> -diff --git a/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
> -index c0ae7a8a2d9..65124e67e54 100644
> ---- a/gdbsupport/gdb_string_view.h
> -+++ b/gdbsupport/gdb_string_view.h
> -@@ -245,13 +245,6 @@ namespace gdb {
> - 	  return { this->_M_str, this->_M_len };
> - 	}
> - 
> --      template<typename _Allocator = std::allocator<_CharT>>
> --	std::basic_string<_CharT, _Traits, _Allocator>
> --	to_string(const _Allocator& __alloc = _Allocator()) const
> --	{
> --	  return { this->_M_str, this->_M_len, __alloc };
> --	}
> --
> -       size_type
> -       copy(_CharT* __str, size_type __n, size_type __pos = 0) const
> -       {
> -@@ -560,4 +553,14 @@ namespace gdb {
> - 
> - #endif // __cplusplus < 201703L
> - 
> -+namespace gdb {
> -+
> -+static inline std::string
> -+to_string(const gdb::string_view &view)
> -+{
> -+  return { view.data (), view.size () };
> -+}
> -+
> -+}
> -+
> - #endif /* COMMON_GDB_STRING_VIEW_H */
> --- 
> -2.39.3
> -
> diff --git a/package/gdb/gdb.hash b/package/gdb/gdb.hash
> index ba90bff5d6..bdc236daf3 100644
> --- a/package/gdb/gdb.hash
> +++ b/package/gdb/gdb.hash
> @@ -4,6 +4,3 @@ sha512  07e9026423438049b11f4f784d57401ece4e940570f613bd6958b3714fe7fbc2c048470b
>  sha512  425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d  gdb-12.1.tar.xz
>  sha512  8185d3e11ab60dafff5860a5016577bfe7dd7547ef01ebc867bc247603d82b74ff74c4f29492c7d2aee57076f52be33e289f4c6b414a4b870d4b3004909f4c34  gdb-13.2.tar.xz
>  sha512  575e198105076fc4a88f68591aa114ab9c1196e84386a3f7b9b58fe5f30cdeed33f6a5f957b68f08c47284ec922bb60c964627e238471419673fd913575ce427  gdb-14.1.tar.xz
> -
> -# Locally calculated (fetched from Github)
> -sha512  5a2acf2fd33ab2ff589e1037ca40abda54328997dcff26b2b49b874bd3be980be5a63342962254f3c3bda98e32ce7a33af704d37353352833dee193135600458  gdb-arc-2020.09-release-gdb.tar.gz
> diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
> index af40f7f986..26695b2cd4 100644
> --- a/package/gdb/gdb.mk
> +++ b/package/gdb/gdb.mk
> @@ -8,12 +8,6 @@ GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
>  GDB_SITE = $(BR2_GNU_MIRROR)/gdb
>  GDB_SOURCE = gdb-$(GDB_VERSION).tar.xz
>  
> -ifeq ($(BR2_arc),y)
> -GDB_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(GDB_VERSION))
> -GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
> -GDB_FROM_GIT = y
> -endif
> -
>  GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
>  GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
>  GDB_CPE_ID_VENDOR = gnu
> @@ -56,11 +50,8 @@ GDB_DEPENDENCIES += host-flex host-bison
>  HOST_GDB_DEPENDENCIES += host-flex host-bison
>  endif
>  
> -# All newer versions of GDB need host-gmp, so it's only for older
> -# versions that the dependency can be avoided.
> -ifeq ($(BR2_arc),)
> +# All newer versions of GDB need host-gmp
>  HOST_GDB_DEPENDENCIES += host-gmp
> -endif
>  
>  # When gdb sources are fetched from the binutils-gdb repository, they
>  # also contain the binutils sources, but binutils shouldn't be built,
> @@ -158,13 +149,10 @@ GDB_CONF_OPTS += \
>  endif
>  
>  # Starting from GDB 11.x, gmp is needed as a dependency to build full
> -# gdb. So we avoid the dependency only for the special version used on
> -# ARC.
> -ifeq ($(BR2_arc):$(BR2_PACKAGE_GDB_DEBUGGER),:y)
> +# gdb.
>  GDB_CONF_OPTS += \
>  	--with-libgmp-prefix=$(STAGING_DIR)/usr
>  GDB_DEPENDENCIES += gmp
> -endif
>  
>  # Starting from GDB 14.x, mpfr is needed as a dependency to build full
>  # gdb.
> @@ -182,13 +170,6 @@ else
>  GDB_CONF_OPTS += --disable-gdbserver
>  endif
>  
> -# When gdb is built as C++ application for ARC it segfaults at runtime
> -# So we pass --disable-build-with-cxx config option to force gdb not to
> -# be built as C++ app.
> -ifeq ($(BR2_arc),y)
> -GDB_CONF_OPTS += --disable-build-with-cxx
> -endif
> -
>  # gdb 7.12+ by default builds with a C++ compiler, which doesn't work
>  # when we don't have C++ support in the toolchain
>  ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
> -- 
> 2.30.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host
index da35fd94f7..69b13e9eb0 100644
--- a/package/gdb/Config.in.host
+++ b/package/gdb/Config.in.host
@@ -35,14 +35,12 @@  config BR2_PACKAGE_HOST_GDB_PYTHON3
 
 config BR2_PACKAGE_HOST_GDB_SIM
 	bool "Simulator support"
-	depends on !BR2_arc
 	help
 	  This option enables the simulator support in the cross gdb.
 
 choice
 	prompt "GDB debugger Version"
 	default BR2_GDB_VERSION_13
-	depends on !BR2_arc
 	help
 	  Select the version of gdb you wish to use.
 
@@ -62,7 +60,6 @@  endif
 # If cross-gdb is not enabled, the latest stable version is chosen.
 config BR2_GDB_VERSION
 	string
-	default "arc-2020.09-release-gdb" if BR2_arc
 	default "12.1"     if BR2_GDB_VERSION_12
 	default "13.2"     if BR2_GDB_VERSION_13 || !BR2_PACKAGE_HOST_GDB
 	# When making 14.x the default, or 14.x becomes the oldest version,
diff --git a/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch b/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch
deleted file mode 100644
index 210ba6d609..0000000000
--- a/package/gdb/arc-2020.09-release-gdb/0001-Do-not-define-basic_string_view-to_string.patch
+++ /dev/null
@@ -1,114 +0,0 @@ 
-From 5ac588997c3c2d032d5d5145d9245eb37354c23b Mon Sep 17 00:00:00 2001
-From: Tom Tromey <tromey@adacore.com>
-Date: Tue, 30 Jun 2020 07:53:03 -0600
-Subject: [PATCH] Do not define basic_string_view::to_string
-
-gdb's copy of basic_string_view includes a to_string method.  However,
-according to cppreference, this is not a method on the real
-std::basic_string_view:
-
-https://en.cppreference.com/w/cpp/string/basic_string_view
-
-This difference matters because gdb_string_view.h will use the
-standard implementation when built with a C++17 or later.  This caused
-PR build/26183.
-
-This patch fixes the problem by changing the method to be a standalone
-helper function, and then rewriting the uses.  Tested by rebuilding
-with a version of GCC that defaults to C++17.
-
-(Note that the build still is not clean; and also I noticed that the
-libstdc++ string_view forbids the use of nullptr ... I wonder if gdb
-violates that.)
-
-gdb/ChangeLog
-2020-06-30  Tom Tromey  <tromey@adacore.com>
-
-	PR build/26183:
-	* ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use
-	gdb::to_string.
-
-gdbsupport/ChangeLog
-2020-06-30  Tom Tromey  <tromey@adacore.com>
-
-	PR build/26183:
-	* gdb_string_view.h (basic_string_view::to_string): Remove.
-	(gdb::to_string): New function.
-
-Upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5ac588997c3c2d032d5d5145d9245eb37354c23b
-Bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=26183
-
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
----
- gdb/ChangeLog                |  6 ++++++
- gdb/ada-lang.c               |  8 ++++----
- gdbsupport/ChangeLog         |  6 ++++++
- gdbsupport/gdb_string_view.h | 17 ++++++++++-------
- 4 files changed, 26 insertions(+), 11 deletions(-)
-
-diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
-index 9b0c2efbfe2..98508c168bc 100644
---- a/gdb/ada-lang.c
-+++ b/gdb/ada-lang.c
-@@ -13553,10 +13553,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
-     {
-       if (user_name.back () == '>')
- 	m_encoded_name
--	  = user_name.substr (1, user_name.size () - 2).to_string ();
-+	  = gdb::to_string (user_name.substr (1, user_name.size () - 2));
-       else
- 	m_encoded_name
--	  = user_name.substr (1, user_name.size () - 1).to_string ();
-+	  = gdb::to_string (user_name.substr (1, user_name.size () - 1));
-       m_encoded_p = true;
-       m_verbatim_p = true;
-       m_wild_match_p = false;
-@@ -13575,10 +13575,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
- 	  if (encoded != NULL)
- 	    m_encoded_name = encoded;
- 	  else
--	    m_encoded_name = user_name.to_string ();
-+	    m_encoded_name = gdb::to_string (user_name);
- 	}
-       else
--	m_encoded_name = user_name.to_string ();
-+	m_encoded_name = gdb::to_string (user_name);
- 
-       /* Handle the 'package Standard' special case.  See description
- 	 of m_standard_p.  */
-diff --git a/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
-index c0ae7a8a2d9..65124e67e54 100644
---- a/gdbsupport/gdb_string_view.h
-+++ b/gdbsupport/gdb_string_view.h
-@@ -245,13 +245,6 @@ namespace gdb {
- 	  return { this->_M_str, this->_M_len };
- 	}
- 
--      template<typename _Allocator = std::allocator<_CharT>>
--	std::basic_string<_CharT, _Traits, _Allocator>
--	to_string(const _Allocator& __alloc = _Allocator()) const
--	{
--	  return { this->_M_str, this->_M_len, __alloc };
--	}
--
-       size_type
-       copy(_CharT* __str, size_type __n, size_type __pos = 0) const
-       {
-@@ -560,4 +553,14 @@ namespace gdb {
- 
- #endif // __cplusplus < 201703L
- 
-+namespace gdb {
-+
-+static inline std::string
-+to_string(const gdb::string_view &view)
-+{
-+  return { view.data (), view.size () };
-+}
-+
-+}
-+
- #endif /* COMMON_GDB_STRING_VIEW_H */
--- 
-2.39.3
-
diff --git a/package/gdb/gdb.hash b/package/gdb/gdb.hash
index ba90bff5d6..bdc236daf3 100644
--- a/package/gdb/gdb.hash
+++ b/package/gdb/gdb.hash
@@ -4,6 +4,3 @@  sha512  07e9026423438049b11f4f784d57401ece4e940570f613bd6958b3714fe7fbc2c048470b
 sha512  425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d  gdb-12.1.tar.xz
 sha512  8185d3e11ab60dafff5860a5016577bfe7dd7547ef01ebc867bc247603d82b74ff74c4f29492c7d2aee57076f52be33e289f4c6b414a4b870d4b3004909f4c34  gdb-13.2.tar.xz
 sha512  575e198105076fc4a88f68591aa114ab9c1196e84386a3f7b9b58fe5f30cdeed33f6a5f957b68f08c47284ec922bb60c964627e238471419673fd913575ce427  gdb-14.1.tar.xz
-
-# Locally calculated (fetched from Github)
-sha512  5a2acf2fd33ab2ff589e1037ca40abda54328997dcff26b2b49b874bd3be980be5a63342962254f3c3bda98e32ce7a33af704d37353352833dee193135600458  gdb-arc-2020.09-release-gdb.tar.gz
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index af40f7f986..26695b2cd4 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -8,12 +8,6 @@  GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
 GDB_SITE = $(BR2_GNU_MIRROR)/gdb
 GDB_SOURCE = gdb-$(GDB_VERSION).tar.xz
 
-ifeq ($(BR2_arc),y)
-GDB_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(GDB_VERSION))
-GDB_SOURCE = gdb-$(GDB_VERSION).tar.gz
-GDB_FROM_GIT = y
-endif
-
 GDB_LICENSE = GPL-2.0+, LGPL-2.0+, GPL-3.0+, LGPL-3.0+
 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
 GDB_CPE_ID_VENDOR = gnu
@@ -56,11 +50,8 @@  GDB_DEPENDENCIES += host-flex host-bison
 HOST_GDB_DEPENDENCIES += host-flex host-bison
 endif
 
-# All newer versions of GDB need host-gmp, so it's only for older
-# versions that the dependency can be avoided.
-ifeq ($(BR2_arc),)
+# All newer versions of GDB need host-gmp
 HOST_GDB_DEPENDENCIES += host-gmp
-endif
 
 # When gdb sources are fetched from the binutils-gdb repository, they
 # also contain the binutils sources, but binutils shouldn't be built,
@@ -158,13 +149,10 @@  GDB_CONF_OPTS += \
 endif
 
 # Starting from GDB 11.x, gmp is needed as a dependency to build full
-# gdb. So we avoid the dependency only for the special version used on
-# ARC.
-ifeq ($(BR2_arc):$(BR2_PACKAGE_GDB_DEBUGGER),:y)
+# gdb.
 GDB_CONF_OPTS += \
 	--with-libgmp-prefix=$(STAGING_DIR)/usr
 GDB_DEPENDENCIES += gmp
-endif
 
 # Starting from GDB 14.x, mpfr is needed as a dependency to build full
 # gdb.
@@ -182,13 +170,6 @@  else
 GDB_CONF_OPTS += --disable-gdbserver
 endif
 
-# When gdb is built as C++ application for ARC it segfaults at runtime
-# So we pass --disable-build-with-cxx config option to force gdb not to
-# be built as C++ app.
-ifeq ($(BR2_arc),y)
-GDB_CONF_OPTS += --disable-build-with-cxx
-endif
-
 # gdb 7.12+ by default builds with a C++ compiler, which doesn't work
 # when we don't have C++ support in the toolchain
 ifneq ($(BR2_INSTALL_LIBSTDCPP),y)