Ping^2: [PATCH 0/3] Recover in-tree libiconv build support

2024-06-15 Thread Arsen Arsenović
Hi!

Another gentle ping on this patch series.  Could it be merged into
trunk?

TIA, have a lovely day!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping: [PATCH 0/3] Recover in-tree libiconv build support

2024-05-04 Thread Arsen Arsenović
Hi!

Given that trunk is now GCC 15, it might be good to land this patch
early.  I will re-test it just in case after a rebase but, otherwise, OK
for trunk?

TIA, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 2/3] gitignore: ignore /libiconv*

2024-04-13 Thread Arsen Arsenović
ChangeLog:

* .gitignore: Ignore /libiconv* as with other possibly-in-tree
libs.
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 93a16b0b950c..3528d9a115ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,3 +70,4 @@ stamp-*
 /gmp*
 /isl*
 /gettext*
+/libiconv*
-- 
2.44.0



[PATCH 3/3] *: support in-tree libiconv again

2024-04-13 Thread Arsen Arsenović
ChangeLog:

* Makefile.def: Inform gettext of our freshly-built libiconv.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac (LIBICONV_SIBLING): If an in-tree host libiconv
is being built, set this variable to the path to libiconv.a
(LTLIBICONV_SIBLING): If an in-tree host libiconv is being
built, set this variable to the path to libiconv.la.
(LIBICONV_EXTRA_CPPFLAGS): If an in-tree host libiconv is being,
set this variable to the appropriate CPPFLAGS for using the new
libiconv.
(LIBICONV_CVS): If an in-tree host libiconv is being, set this
variable to the cache variables that iconv.m4 uses that need to
be specicified in order to use the related variables.

config/ChangeLog:

* iconv.m4: Restore modifications from GCC commit
d485982286692075d175dbbcf17d00431106ce96 and co.

gcc/ChangeLog:

* configure: Regenerate.

libcpp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.
---
 Makefile.def   |   7 +-
 Makefile.in|  60 +--
 config/iconv.m4|  50 +++--
 configure  |  25 +
 configure.ac   |  21 
 gcc/configure  | 240 +++--
 libcpp/configure   | 206 ---
 libstdc++-v3/configure | 121 -
 8 files changed, 572 insertions(+), 158 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index d25edb6ed76d..c37f78f2e1da 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -78,11 +78,16 @@ host_modules= { module= gettext; bootstrap=true; 
no_install=true;
 module_srcdir= "gettext/gettext-runtime";
// Don't override configure-discovered build arguments
all_args_override="";
+   // The toolchain build system overrides LDFLAGS that configure
+   // discovers, so specifying these flags as part of the
+   // configure arguments will not work.  Instead, we need to
+   // export them at configure time as well as make time.
+   extra_exports='LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export 
LDFLAGS;';
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
// user-facing output.
-   extra_configure_flags='--disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf';
+   extra_configure_flags='--disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf 
CPPFLAGS="@LIBICONV_EXTRA_CPPFLAGS@ $$CPPFLAGS" @LIBICONV_CVS@';
missing= pdf;
missing= html;
missing= info;
diff --git a/Makefile.in b/Makefile.in
index f71f515b7aa1..d65b4b2994a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -19856,7 +19856,7 @@ configure-gettext:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
test ! -f $(HOST_SUBDIR)/gettext/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext; \
-   $(HOST_EXPORTS)  \
+   $(HOST_EXPORTS) LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export 
LDFLAGS; \
echo Configuring in $(HOST_SUBDIR)/gettext; \
cd "$(HOST_SUBDIR)/gettext" || exit 1; \
case $(srcdir) in \
@@ -19869,7 +19869,7 @@ configure-gettext:
  $$s/$$module_srcdir/configure \
  --srcdir=$${topdir}/$$module_srcdir \
  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
- --target=${target_alias} --disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf \
+ --target=${target_alias} --disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf 
CPPFLAGS="@LIBICONV_EXTRA_CPPFLAGS@ $$CPPFLAGS" @LIBICONV_CVS@ \
  || exit 1
 @endif gettext
 
@@ -19889,7 +19889,7 @@ configure-stage1-gettext:
$(HOST_EXPORTS) \
CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
-   LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS;  \
+   LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; 
LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export LDFLAGS; \
echo Configuring stage 1 in $(HOST_SUBDIR)/gettext; \
$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext; \
cd $(HOST_SUBDIR)/gettext || exit 1; \
@@ -19905,7 +19905,7 @@ configure-stage1-gettext:
  --target=${target_alias} \
   \
  $(STAGE1_CONFIGURE_FLAGS) \
- --disable-shared --disable-threads --disable-java --disable-csharp 
--with-pic --disable-libasprintf
+ 

[PATCH 1/3] toplevel: don't override gettext-runtime/configure-discovered build args

2024-04-13 Thread Arsen Arsenović
ChangeLog:
PR bootstrap/112534
* Makefile.def (host-gettext): Set all_args_override="".
* Makefile.in: Regenerate.
* Makefile.tpl (all--args): Define as a helper macro for
computing extra arguments to make.
(all): Use all--args over args.
---
 Makefile.def |  2 ++
 Makefile.in  | 40 +---
 Makefile.tpl |  8 +---
 3 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 19954e7d7318..d25edb6ed76d 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -76,6 +76,8 @@ host_modules= { module= gprof; };
 host_modules= { module= gprofng; };
 host_modules= { module= gettext; bootstrap=true; no_install=true;
 module_srcdir= "gettext/gettext-runtime";
+   // Don't override configure-discovered build arguments
+   all_args_override="";
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
diff --git a/Makefile.in b/Makefile.in
index db4fa6c62605..f71f515b7aa1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3174,6 +3174,8 @@ TAGS: do-TAGS
 
 
 
+
+
 # --
 # Modules which run on the build machine
 # --
@@ -20195,7 +20197,7 @@ all-gettext: configure-gettext
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS)  \
(cd $(HOST_SUBDIR)/gettext && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
+ $(MAKE) $(BASE_FLAGS_TO_PASS)  $(STAGE1_FLAGS_TO_PASS)  \
$(TARGET-gettext))
 @endif gettext
 
@@ -20225,7 +20227,7 @@ all-stage1-gettext: configure-stage1-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS)  \
+ \
$(STAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE1_TFLAGS)"  \
$(TARGET-stage1-gettext)
@@ -20240,7 +20242,7 @@ clean-stage1-gettext:
  $(MAKE) stage1-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS)  \
+   $(MAKE)   \
$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
@@ -20270,7 +20272,7 @@ all-stage2-gettext: configure-stage2-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE2_TFLAGS)"  \
$(TARGET-stage2-gettext)
 
@@ -20284,7 +20286,7 @@ clean-stage2-gettext:
  $(MAKE) stage2-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20313,7 +20315,7 @@ all-stage3-gettext: configure-stage3-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE3_TFLAGS)"  \
$(TARGET-stage3-gettext)
 
@@ -20327,7 +20329,7 @@ clean-stage3-gettext:
  $(MAKE) stage3-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20356,7 +20358,7 @@ all-stage4-gettext: configure-stage4-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE4_TFLAGS)"  \
$(TARGET-stage4-gettext)
 
@@ -20370,7 +20372,7 @@ clean-stage4-gettext:
  $(MAKE) stage4-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20399,7 +20401,7 @@ all-stageprofile-gettext: configure-stageprofile-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \

[PATCH 0/3] Recover in-tree libiconv build support

2024-04-13 Thread Arsen Arsenović
Evening!

This patchset recovers support for building the toolchain tree with
in-tree libiconv being used for host modules and gettext.  As spotted by
Kévin Le Gouguec , I accidentally removed this
functionality earlier.

This patchset includes the patch sent as:

https://inbox.sourceware.gcc-patches/20231221193243.368541-1-ar...@aarsen.me/

... and so, supersedes that patchset.

For the in-tree case, the old patch functionality was restored and
rebased on top of current iconv.m4.  Of course, this does not work for
gettext, an out-of-tree lib depending on the in-tree libiconv, so, for
that case, we needed to provide the right information to configure, and
suppress logic in iconv.m4 using cache vars.

Build-tested on arm64-apple-darwin21.6.0, and I intend to do further
testing tomorrow.

OK for trunk?  It would be good to get these patches into GCC 14.

I apologize for being quite late with delivering these, I have,
unfortunately, been busied by various external factors.  Hopefully, it
is not too late yet.

Thanks in advance, have a lovely night!

Arsen Arsenović (3):
  toplevel: don't override gettext-runtime/configure-discovered build
args
  gitignore: ignore /libiconv*
  *: support in-tree libiconv again

 .gitignore |   1 +
 Makefile.def   |   9 +-
 Makefile.in| 100 -
 Makefile.tpl   |   8 +-
 config/iconv.m4|  50 +++--
 configure  |  25 +
 configure.ac   |  21 
 gcc/configure  | 240 +++--
 libcpp/configure   | 206 ---
 libstdc++-v3/configure | 121 -
 10 files changed, 601 insertions(+), 180 deletions(-)

-- 
2.44.0



[pushed] libstdc++-v3: drop GCC Runtime Library Exception from gen tests

2024-03-29 Thread Arsen Arsenović
It was mistakenly added to these files.

libstdc++-v3/ChangeLog:

* testsuite/24_iterators/range_generators/01.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/02.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/copy.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/except.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/subrange.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/synopsis.cc: Drop GCC
Runtime Library Exception.
* testsuite/24_iterators/range_generators/iter_deref_return.cc:
Drop GCC Runtime Library Exception from the "You should have
received a copy" paragraph.
---
I am the original author of these files and I'm re-contributing them
without the GCC Runtime Library Exception as it is not relevant to
tests.

 .../testsuite/24_iterators/range_generators/01.cc| 9 ++---
 .../testsuite/24_iterators/range_generators/02.cc| 9 ++---
 .../testsuite/24_iterators/range_generators/copy.cc  | 9 ++---
 .../testsuite/24_iterators/range_generators/except.cc| 9 ++---
 .../24_iterators/range_generators/iter_deref_return.cc   | 4 
 .../testsuite/24_iterators/range_generators/subrange.cc  | 9 ++---
 .../testsuite/24_iterators/range_generators/synopsis.cc  | 9 ++---
 7 files changed, 16 insertions(+), 42 deletions(-)

diff --git a/libstdc++-v3/testsuite/24_iterators/range_generators/01.cc 
b/libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
index 2af5ed1895a..81837e156fe 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
+++ b/libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
@@ -12,13 +12,8 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
 // .
 
 #include 
diff --git a/libstdc++-v3/testsuite/24_iterators/range_generators/02.cc 
b/libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
index 8e23a9c4933..da2d2d42f04 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
+++ b/libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
@@ -12,13 +12,8 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
 // .
 
 #include 
diff --git a/libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc 
b/libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
index c74fb0cf09e..7ceec33dd78 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
+++ b/libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
@@ -12,13 +12,8 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
 // .
 
 #include 
diff --git a/libstdc++-v3/testsuite/24_iterators/range_generators/except.cc 
b/libstdc++-v3/testsuite/24_iterators/range_generators/except.cc
index 82f6e4e45f6..87d8cebb185 100644
--- a/libstdc++-v3/testsuite/24_iterators/range_generators/except.cc
+++ 

[PATCH 0/2] A few minor fixes in

2024-03-23 Thread Arsen Arsenović
From: Arsen Arsenović 

Afternoon!

These couple of patches fix two minor issues in the generator
implementation that were informally reported a while ago.

Tested on x86_64-pc-linux-gnu.

OK for trunk?

TIA, have a lovely day!

Arsen Arsenović (2):
  libstdc++: fix _V badname in 
  libstdc++: fix generator iterator operator* return type

 libstdc++-v3/include/std/generator| 22 ++--
 .../range_generators/iter_deref_return.cc | 34 +++
 2 files changed, 46 insertions(+), 10 deletions(-)
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/iter_deref_return.cc

-- 
2.44.0



[PATCH 1/2] libstdc++: fix _V badname in

2024-03-23 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/std/generator: Fix _V badname.
---
 libstdc++-v3/include/std/generator | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libstdc++-v3/include/std/generator 
b/libstdc++-v3/include/std/generator
index 87983ee5e7c6..2d1dcced1e57 100644
--- a/libstdc++-v3/include/std/generator
+++ b/libstdc++-v3/include/std/generator
@@ -76,14 +76,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @headerfile generator
* @since C++23
*/
-  template
+  template
 class generator;
 
   /// @cond undocumented
   namespace __gen
   {
 /// _Reference type for a generator whose reference (first argument) and
-/// value (second argument) types are _Ref and _V.
+/// value (second argument) types are _Ref and _Val.
 template
 using _Reference_t = __conditional_t,
 _Ref&&, _Ref>;
@@ -642,14 +642,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   } // namespace __gen
   /// @endcond
 
-  template
+  template
 class generator
-  : public ranges::view_interface>
+  : public ranges::view_interface>
 {
-  using _Value = __conditional_t, remove_cvref_t<_Ref>, _V>;
+  using _Value = __conditional_t,
+remove_cvref_t<_Ref>,
+_Val>;
   static_assert(__gen::_Cv_unqualified_object<_Value>,
"Generator value must be a cv-unqualified object type");
-  using _Reference = __gen::_Reference_t<_Ref, _V>;
+  using _Reference = __gen::_Reference_t<_Ref, _Val>;
   static_assert(is_reference_v<_Reference>
|| (__gen::_Cv_unqualified_object<_Reference>
&& copy_constructible<_Reference>),
@@ -737,8 +739,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   bool _M_began = false;
 };
 
-  template
-struct generator<_Ref, _V, _Alloc>::_Iterator
+  template
+struct generator<_Ref, _Val, _Alloc>::_Iterator
 {
   using value_type = _Value;
   using difference_type = ptrdiff_t;
-- 
2.44.0



[PATCH 2/2] libstdc++: fix generator iterator operator* return type

2024-03-23 Thread Arsen Arsenović
Per the standard, the return type of a generators ranges iterator op*
should be the reference type rather than the yielded type.

The yielded type was used here by mistake.

libstdc++-v3/ChangeLog:

* include/std/generator (generator::_Iterator::operator*): Fix
return type.
* testsuite/24_iterators/range_generators/iter_deref_return.cc:
New test.
---
 libstdc++-v3/include/std/generator|  4 +--
 .../range_generators/iter_deref_return.cc | 34 +++
 2 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/iter_deref_return.cc

diff --git a/libstdc++-v3/include/std/generator 
b/libstdc++-v3/include/std/generator
index 2d1dcced1e57..789016b5a883 100644
--- a/libstdc++-v3/include/std/generator
+++ b/libstdc++-v3/include/std/generator
@@ -773,12 +773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   operator++(int)
   { this->operator++(); }
 
-  yielded
+  _Reference
   operator*()
const noexcept(is_nothrow_move_constructible_v<_Reference>)
   {
auto& __p = this->_M_coro.promise();
-   return static_cast(*__p._M_value());
+   return static_cast<_Reference>(*__p._M_value());
   }
 
 private:
diff --git 
a/libstdc++-v3/testsuite/24_iterators/range_generators/iter_deref_return.cc 
b/libstdc++-v3/testsuite/24_iterators/range_generators/iter_deref_return.cc
new file mode 100644
index ..7bdbf4d489ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/range_generators/iter_deref_return.cc
@@ -0,0 +1,34 @@
+// { dg-do compile { target c++23 } }
+// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+#include 
+
+// Check that the return type of iterator::operator* is the reference type.
+// Pre-op* return type fix, this'd have resulted in a op* return type of const
+// bool&.
+
+std::generator
+foo();
+
+static_assert(std::is_same_v);
+static_assert(std::is_same_v);
-- 
2.44.0



Re: [PATCH 2/2] libstdc++: Handle encodings in localized chrono formatting [PR109162]

2024-02-01 Thread Arsen Arsenović
std/time/month_day_last/io.cc 
> b/libstdc++-v3/testsuite/std/time/month_day_last/io.cc
> index c12cee848ed..94d54b9b124 100644
> --- a/libstdc++-v3/testsuite/std/time/month_day_last/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/month_day_last/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/month_weekday/io.cc 
> b/libstdc++-v3/testsuite/std/time/month_weekday/io.cc
> index 82cac648905..0fee88bb3a3 100644
> --- a/libstdc++-v3/testsuite/std/time/month_weekday/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/month_weekday/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/month_weekday_last/io.cc 
> b/libstdc++-v3/testsuite/std/time/month_weekday_last/io.cc
> index 47968d0e06d..e6a6751bb4a 100644
> --- a/libstdc++-v3/testsuite/std/time/month_weekday_last/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/month_weekday_last/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/time_zone/get_info_local.cc 
> b/libstdc++-v3/testsuite/std/time/time_zone/get_info_local.cc
> index d2972aca7df..af830374700 100644
> --- a/libstdc++-v3/testsuite/std/time/time_zone/get_info_local.cc
> +++ b/libstdc++-v3/testsuite/std/time/time_zone/get_info_local.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-effective-target tzdb }
>
> diff --git a/libstdc++-v3/testsuite/std/time/weekday/io.cc 
> b/libstdc++-v3/testsuite/std/time/weekday/io.cc
> index a56cdaef88c..f102c9250e9 100644
> --- a/libstdc++-v3/testsuite/std/time/weekday/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/weekday/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/weekday_indexed/io.cc 
> b/libstdc++-v3/testsuite/std/time/weekday_indexed/io.cc
> index 29255ad5c06..42fc9b914a1 100644
> --- a/libstdc++-v3/testsuite/std/time/weekday_indexed/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/weekday_indexed/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/weekday_last/io.cc 
> b/libstdc++-v3/testsuite/std/time/weekday_last/io.cc
> index 6f76922195d..d069d857ff0 100644
> --- a/libstdc++-v3/testsuite/std/time/weekday_last/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/weekday_last/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year/io.cc 
> b/libstdc++-v3/testsuite/std/time/year/io.cc
> index bcaa57faeb7..1bdc95ddbd1 100644
> --- a/libstdc++-v3/testsuite/std/time/year/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year_month/io.cc 
> b/libstdc++-v3/testsuite/std/time/year_month/io.cc
> index 7bb3442e299..e7963d31ae6 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_day/io.cc 
> b/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
> index cb82ef3b612..e7dc60b9dea 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_day_last/io.cc 
> b/libstdc++-v3/testsuite/std/time/year_month_day_last/io.cc
> index 3241536a2e6..a57e56a1805 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_day_last/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_day_last/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_weekday/io.cc 
> b/libstdc++-v3/testsuite/std/time/year_month_weekday/io.cc
> index 65baf1d37ae..e9a5bee7666 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_weekday/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_weekday/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_weekday_last/io.cc 
> b/libstdc++-v3/testsuite/std/time/year_month_weekday_last/io.cc
> index 17f2244420d..fc2328ac001 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_weekday_last/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_weekday_last/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-namedlocale "fr_FR.ISO8859-15" }
>  // { dg-timeout-factor 2 }
> diff --git a/libstdc++-v3/testsuite/std/time/zoned_time/1.cc 
> b/libstdc++-v3/testsuite/std/time/zoned_time/1.cc
> index 1623aca1c7a..e773f50ae73 100644
> --- a/libstdc++-v3/testsuite/std/time/zoned_time/1.cc
> +++ b/libstdc++-v3/testsuite/std/time/zoned_time/1.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-effective-target tzdb }
>  // { dg-require-effective-target cxx11_abi }
> diff --git a/libstdc++-v3/testsuite/std/time/zoned_time/io.cc 
> b/libstdc++-v3/testsuite/std/time/zoned_time/io.cc
> index 376b2734f19..c19e2a3c882 100644
> --- a/libstdc++-v3/testsuite/std/time/zoned_time/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/zoned_time/io.cc
> @@ -1,3 +1,4 @@
> +// { dg-options "-lstdc++exp" { target c++23 } }
>  // { dg-do run { target c++20 } }
>  // { dg-require-effective-target cxx11_abi }
>  // { dg-timeout-factor 2 }


--
Arsen Arsenović



Ping^2: [PATCH] toplevel: don't override gettext-runtime/configure-discovered build args

2024-01-15 Thread Arsen Arsenović
Evening folks,

Hope you had wonderful holidays.

Gentle ping on this patch.

Have a lovely night!
--
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH wwwdocs 1/1] gcc-14: document P1689R5 scanning output support

2024-01-06 Thread Arsen Arsenović
Hi Ben,

Ben Boeckel  writes:

> Ping? Is this the right place to submit this patch?

Yes, this is the correct list, though it is usually recommended to use
--subject-prefix='PATCH wwwdocs' or such, to catch the right eyes.  See:
https://gcc.gnu.org/contribute.html#webchanges

I've added it to my subject, hopefully that works.

Have a lovely day!
--
Arsen Arsenović


signature.asc
Description: PGP signature


[pushed 1/2] libstdc++: rename _A badname in

2024-01-04 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/std/generator (_Stateless_alloc): Rename typename _A
to _All.
---
Pushed as obvious.

Happy new year, have a lovely day!

 libstdc++-v3/include/std/generator | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/std/generator 
b/libstdc++-v3/include/std/generator
index e1c1ad583abb..a8ad9c443531 100644
--- a/libstdc++-v3/include/std/generator
+++ b/libstdc++-v3/include/std/generator
@@ -405,9 +405,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 };
 
-template
-concept _Stateless_alloc = (allocator_traits<_A>::is_always_equal::value
-   && default_initializable<_A>);
+template
+concept _Stateless_alloc = (allocator_traits<_All>::is_always_equal::value
+   && default_initializable<_All>);
 
 template
   class _Promise_alloc
-- 
2.43.0



[pushed 2/2] libstdc++: fix typo in

2024-01-04 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/std/generator (_Subyield_state::_M_jump_in): Fix typo
reported by Will Hawkins .
---
 libstdc++-v3/include/std/generator | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/generator 
b/libstdc++-v3/include/std/generator
index a8ad9c443531..e7ef5ddfdd34 100644
--- a/libstdc++-v3/include/std/generator
+++ b/libstdc++-v3/include/std/generator
@@ -269,7 +269,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
  __glibcxx_assert(&__new.promise()._M_nest == this);
  __glibcxx_assert(this->_M_is_bottom());
- // We're bottom.  We're also top of top is unset (note that this is
+ // We're bottom.  We're also top if top is unset (note that this is
  // not true if something was added to the coro stack and then popped,
  // but in that case we can't possibly be yielded from, as it would
  // require rerunning begin()).
-- 
2.43.0



Re: [PATCH v2 2/2] libstdc++: implement std::generator

2024-01-04 Thread Arsen Arsenović

Jonathan Wakely  writes:

> On Thu, 21 Dec 2023 at 21:26, Arsen Arsenović wrote:
>> +
>> +template
>> +concept _Stateless_alloc = (allocator_traits<_A>::is_always_equal::value
>> +   && default_initializable<_A>);
>
> The _A here is a BADNAME and needs to be more than one letter.
>
> FAIL: 17_intro/badnames.cc  -std=gnu++23 (test for excess errors)
> Excess errors:
> /home/test/src/gcc/libstdc++-v3/testsuite/17_intro/badnames.cc:61:
> error: expected nested-name-specifier before '_A'

Ah - my bad, will fix, and push along with that typo fix that Will
Hawkins mentioned.
--
Arsen Arsenović


signature.asc
Description: PGP signature


Ping: [PATCH] toplevel: don't override gettext-runtime/configure-discovered build args

2023-12-30 Thread Arsen Arsenović
Hi,

Ping on this patch.

TIA, have a lovely day and happy holidays!
--
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 2/2] libstdc++: implement std::generator

2023-12-26 Thread Arsen Arsenović
Hi Will,

Will Hawkins  writes:

> On Thu, Dec 21, 2023 at 4:26 PM Arsen Arsenović  wrote:
>>
>> libstdc++-v3/ChangeLog:
>>
>
> ... snip ...
>
>> +   void
>> +   _M_jump_in(_Coro_handle __rest, _Coro_handle __new) noexcept
>> +   {
>> + __glibcxx_assert(&__new.promise()._M_nest == this);
>> + __glibcxx_assert(this->_M_is_bottom());
>> + // We're bottom.  We're also top of top is unset (note that this is
>
> Should this read:
>
> // We're bottom.  We're also top if top is unset (note that this is
>
> ?

Yes, I am decently sure so - well spotted.  I'll leave your message
unread to correct this typo later.  Thanks!

> Very impressive work -- I learned a ton by reading your implementation.
> Will

Happy to hear that :-)

Have a lovely night!
--
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2 2/2] libstdc++: implement std::generator

2023-12-21 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/Makefile.am: Install std/generator, bits/elements_of.h
as freestanding.
* include/Makefile.in: Regenerate.
* include/bits/version.def: Add __cpp_lib_generator.
* include/bits/version.h: Regenerate.
* include/precompiled/stdc++.h: Include .
* include/std/ranges: Include bits/elements_of.h
* include/bits/elements_of.h: New file.
* include/std/generator: New file.
* testsuite/24_iterators/range_generators/01.cc: New test.
* testsuite/24_iterators/range_generators/02.cc: New test.
* testsuite/24_iterators/range_generators/copy.cc: New test.
* testsuite/24_iterators/range_generators/except.cc: New test.
* testsuite/24_iterators/range_generators/synopsis.cc: New test.
* testsuite/24_iterators/range_generators/subrange.cc: New test.
---
 libstdc++-v3/include/Makefile.am  |   2 +
 libstdc++-v3/include/Makefile.in  |   2 +
 libstdc++-v3/include/bits/elements_of.h   |  72 ++
 libstdc++-v3/include/bits/version.def |   9 +
 libstdc++-v3/include/bits/version.h   |  11 +
 libstdc++-v3/include/precompiled/stdc++.h |   1 +
 libstdc++-v3/include/std/generator| 812 ++
 libstdc++-v3/include/std/ranges   |   4 +
 .../24_iterators/range_generators/01.cc   |  55 ++
 .../24_iterators/range_generators/02.cc   | 219 +
 .../24_iterators/range_generators/copy.cc |  97 +++
 .../24_iterators/range_generators/except.cc   |  97 +++
 .../24_iterators/range_generators/subrange.cc |  45 +
 .../24_iterators/range_generators/synopsis.cc |  38 +
 14 files changed, 1464 insertions(+)
 create mode 100644 libstdc++-v3/include/bits/elements_of.h
 create mode 100644 libstdc++-v3/include/std/generator
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/except.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/subrange.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/synopsis.cc

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 368b92eafbc7..ca76afbcc77f 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -35,6 +35,7 @@ std_freestanding = \
${std_srcdir}/coroutine \
${std_srcdir}/expected \
${std_srcdir}/functional \
+   ${std_srcdir}/generator \
${std_srcdir}/iterator \
${std_srcdir}/limits \
${std_srcdir}/memory \
@@ -123,6 +124,7 @@ bits_freestanding = \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/cpp_type_traits.h \
+   ${bits_srcdir}/elements_of.h \
${bits_srcdir}/enable_special_members.h \
${bits_srcdir}/functexcept.h \
${bits_srcdir}/functional_hash.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index a31588c01002..4fa4a259fef3 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -393,6 +393,7 @@ std_freestanding = \
${std_srcdir}/coroutine \
${std_srcdir}/expected \
${std_srcdir}/functional \
+   ${std_srcdir}/generator \
${std_srcdir}/iterator \
${std_srcdir}/limits \
${std_srcdir}/memory \
@@ -478,6 +479,7 @@ bits_freestanding = \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/cpp_type_traits.h \
+   ${bits_srcdir}/elements_of.h \
${bits_srcdir}/enable_special_members.h \
${bits_srcdir}/functexcept.h \
${bits_srcdir}/functional_hash.h \
diff --git a/libstdc++-v3/include/bits/elements_of.h 
b/libstdc++-v3/include/bits/elements_of.h
new file mode 100644
index ..663e15a94aa7
--- /dev/null
+++ b/libstdc++-v3/include/bits/elements_of.h
@@ -0,0 +1,72 @@
+// Tag type for yielding ranges rather than values in   -*- C++ -*-
+
+// Copyright (C) 2023 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 

[PATCH v2 0/2] libstdc++: generators v2

2023-12-21 Thread Arsen Arsenović
traits<_Alloc_block>;
  +
  +  static_assert(is_pointer_v,
 @@ libstdc++-v3/include/std/generator (new)
  +  return __p;
  + }
  +
 -+ template
 ++ template
  + void*
  + operator new(std::size_t __sz,
 -+ allocator_arg_t, const _NA& __na,
 ++ allocator_arg_t, const _Na& __na,
  + const _Args&...)
  + { return _M_allocate(__na, __sz); }
  +
 -+ template
 ++ template
  + void*
  + operator new(std::size_t __sz,
  + const _This&,
 -+ allocator_arg_t, const _NA& __na,
 ++ allocator_arg_t, const _Na& __na,
  + const _Args&...)
  + { return _M_allocate(__na, __sz); }
  +
 @@ libstdc++-v3/include/std/generator (new)
  + }
  +  };
  +
 -+template
 -+concept _Cv_unqualified_object = is_object_v<_T>
 -+  && same_as<_T, remove_cv_t<_T>>;
 ++template
 ++concept _Cv_unqualified_object = is_object_v<_Tp>
 ++  && same_as<_Tp, remove_cv_t<_Tp>>;
  +  } // namespace __gen
  +  /// @endcond
  +
 @@ libstdc++-v3/include/std/generator (new)
  +  using difference_type = ptrdiff_t;
  +
  +  friend bool
 -+  operator==(const _Iterator& i, default_sentinel_t) noexcept
 -+  { return i._M_coro.done(); }
 ++  operator==(const _Iterator& __i, default_sentinel_t) noexcept
 ++  { return __i._M_coro.done(); }
  +
  +  friend class generator;
  +
 @@ libstdc++-v3/include/std/generator (new)
  +
  +#if _GLIBCXX_HOSTED
  +  namespace pmr {
 -+template
 -+using generator = std::generator>;
 ++template
 ++using generator = std::generator<_Ref, _Val, 
polymorphic_allocator>;
  +  }
  +#endif // HOSTED
  +

Tested libstdc++ on x86_64-pc-linux-gnu.

TIA, have a lovely day.

Arsen Arsenović (2):
  libstdc++: add missing include in ranges_util.h
  libstdc++: implement std::generator

 libstdc++-v3/include/Makefile.am  |   2 +
 libstdc++-v3/include/Makefile.in  |   2 +
 libstdc++-v3/include/bits/elements_of.h   |  72 ++
 libstdc++-v3/include/bits/ranges_util.h   |   1 +
 libstdc++-v3/include/bits/version.def |   9 +
 libstdc++-v3/include/bits/version.h   |  11 +
 libstdc++-v3/include/precompiled/stdc++.h |   1 +
 libstdc++-v3/include/std/generator| 812 ++
 libstdc++-v3/include/std/ranges   |   4 +
 .../24_iterators/range_generators/01.cc   |  55 ++
 .../24_iterators/range_generators/02.cc   | 219 +
 .../24_iterators/range_generators/copy.cc |  97 +++
 .../24_iterators/range_generators/except.cc   |  97 +++
 .../24_iterators/range_generators/subrange.cc |  45 +
 .../24_iterators/range_generators/synopsis.cc |  38 +
 15 files changed, 1465 insertions(+)
 create mode 100644 libstdc++-v3/include/bits/elements_of.h
 create mode 100644 libstdc++-v3/include/std/generator
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/except.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/subrange.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/synopsis.cc

-- 
2.43.0



[PATCH v2 1/2] libstdc++: add missing include in ranges_util.h

2023-12-21 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h: Add missing 
include.
---
 libstdc++-v3/include/bits/ranges_util.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/include/bits/ranges_util.h 
b/libstdc++-v3/include/bits/ranges_util.h
index 185e46ec7a94..ad61a19dd33d 100644
--- a/libstdc++-v3/include/bits/ranges_util.h
+++ b/libstdc++-v3/include/bits/ranges_util.h
@@ -33,6 +33,7 @@
 #if __cplusplus > 201703L
 # include 
 # include 
+# include 
 
 #ifdef __glibcxx_ranges
 namespace std _GLIBCXX_VISIBILITY(default)
-- 
2.43.0



[PATCH] toplevel: don't override gettext-runtime/configure-discovered build args

2023-12-21 Thread Arsen Arsenović
ChangeLog:
PR bootstrap/112534
* Makefile.def (host-gettext): Set all_args_override="".
* Makefile.in: Regenerate.
* Makefile.tpl (all--args): Define as a helper macro for
computing extra arguments to make.
(all): Use all--args over args.
---
Hi,

This patch fixes the build failure noted in PR112534 by preventing the
build system from overriding the compiler flags the gettext-runtime
subconfigure discovers.

This would appear to keep bootstrap working correctly, as shown in:

  [arsen@gcc2-power8 build2]$ readelf -p .comment */intl/dcgettext.o

  File: gettext/intl/dcgettext.o

  String dump of section '.comment':
[ 1]  GCC: (GNU) 14.0.0 20231220 (experimental)


  File: prev-gettext/intl/dcgettext.o

  String dump of section '.comment':
[ 1]  GCC: (GNU) 14.0.0 20231220 (experimental)


  File: stage1-gettext/intl/dcgettext.o

  String dump of section '.comment':
[ 1]  GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)

Tested on ppc64le-redhat-linux, OK for trunk?

TIA, have a lovely day.

 Makefile.def |  2 ++
 Makefile.in  | 40 +---
 Makefile.tpl |  8 +---
 3 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 3f8962c28032..93222bfd7a4b 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -76,6 +76,8 @@ host_modules= { module= gprof; };
 host_modules= { module= gprofng; };
 host_modules= { module= gettext; bootstrap=true; no_install=true;
 module_srcdir= "gettext/gettext-runtime";
+   // Don't override configure-discovered build arguments
+   all_args_override="";
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
diff --git a/Makefile.in b/Makefile.in
index c6313048c914..e67a50750c76 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3168,6 +3168,8 @@ TAGS: do-TAGS
 
 
 
+
+
 # --
 # Modules which run on the build machine
 # --
@@ -20189,7 +20191,7 @@ all-gettext: configure-gettext
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS)  \
(cd $(HOST_SUBDIR)/gettext && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
+ $(MAKE) $(BASE_FLAGS_TO_PASS)  $(STAGE1_FLAGS_TO_PASS)  \
$(TARGET-gettext))
 @endif gettext
 
@@ -20219,7 +20221,7 @@ all-stage1-gettext: configure-stage1-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS)  \
+ \
$(STAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE1_TFLAGS)"  \
$(TARGET-stage1-gettext)
@@ -20234,7 +20236,7 @@ clean-stage1-gettext:
  $(MAKE) stage1-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS)  \
+   $(MAKE)   \
$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
@@ -20264,7 +20266,7 @@ all-stage2-gettext: configure-stage2-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE2_TFLAGS)"  \
$(TARGET-stage2-gettext)
 
@@ -20278,7 +20280,7 @@ clean-stage2-gettext:
  $(MAKE) stage2-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20307,7 +20309,7 @@ all-stage3-gettext: configure-stage3-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE3_TFLAGS)"  \
$(TARGET-stage3-gettext)
 
@@ -20321,7 +20323,7 @@ clean-stage3-gettext:
  $(MAKE) stage3-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20350,7 +20352,7 @@ all-stage4-gettext: configure-stage4-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" 

Re: [PATCH] gettext: disable install, docs targets, libasprintf, threads

2023-12-04 Thread Arsen Arsenović

Richard Biener  writes:

> OK.

Thanks.  I'll wait for the Binutils and GDB maintainers to weigh in
before pushing (plus, I can't push there).

Have a lovely day!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH] download_prerequisites: add --only-gettext

2023-12-02 Thread Arsen Arsenović
contrib/ChangeLog:

* download_prerequisites
: Parse --only-gettext.
(echo_archives): Check only_gettext and stop early if true.
(helptext): Document --only-gettext.
---
Afternoon,

This patch adds a --only-gettext option to download_prerequisites for
when the only useful dependency to download is gettext (which will
restore a gcc source tree to a similar 'intlness' as before the
externalization of gettext-runtime).

For context, see
https://inbox.sourceware.org/CAFiYyc2-JxH358GUcZfR4iBMq5qj6Nf4W=7lyoqyw6b-u8d...@mail.gmail.com/

OK for trunk?

TIA, have a lovely day!

 contrib/download_prerequisites | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
index 9568091c0dba..30ff0cc9491a 100755
--- a/contrib/download_prerequisites
+++ b/contrib/download_prerequisites
@@ -36,16 +36,18 @@ gettext='gettext-0.22.tar.gz'
 base_url='http://gcc.gnu.org/pub/gcc/infrastructure/'
 
 echo_archives() {
+echo "${gettext}"
+if "${only_gettext}"; then return; fi
 echo "${gmp}"
 echo "${mpfr}"
 echo "${mpc}"
-echo "${gettext}"
 if [ ${graphite} -gt 0 ]; then echo "${isl}"; fi
 }
 
 graphite=1
 verify=1
 force=0
+only_gettext=false
 OS=$(uname)
 
 if type wget > /dev/null ; then
@@ -74,6 +76,7 @@ The following options are available:
  --no-verify  don't verify package integrity
  --sha512 use SHA512 checksum to verify package integrity (default)
  --md5use MD5 checksum to verify package integrity
+ --only-gettext   inhibit downloading any package but gettext
  --help   show this text and exit
  --versionshow version information and exit
 "
@@ -159,6 +162,9 @@ do
 chksum_extension='md5'
 verify=1
 ;;
+--only-gettext)
+only_gettext=true
+;;
 -*)
 die "unknown option: ${arg}"
 ;;
-- 
2.43.0



[PATCH] gettext: disable install, docs targets, libasprintf, threads

2023-12-02 Thread Arsen Arsenović
This fixes issues reported by David Edelsohn , and by
Eric Gallager .

ChangeLog:

* Makefile.def (gettext): Disable (via missing)
{install-,}{pdf,html,info,dvi} and TAGS targets.  Set no_install
to true.  Add --disable-threads --disable-libasprintf.  Drop the
lib_path (as there are no shared libs).
---
Afternoon,

This patch disables various targets and features on the gettext module
to fix problems reported by David Edelsohn and Eric Gallager in
https://inbox.sourceware.org/CAGWvnynmWgNjup4cAwSbsy1vw_MJLQqSULwM=kth_+lt+_s...@mail.gmail.com/
and followups and on IRC, respectively.

The gettext module does not actually require any of these to be usable
for the purposes of the toolchain, so disabling them seems to be a
decent workaround.

This seemed to fix the respective issues for both Eric and David,
though, I could not get GDB to build on AIX with or without this patch
applied (I needed to disable sim, gdb and gnulib modules).

It is possible I am missing something.  Due to some unfortunate
circumstances, it's taken more time than anticipated to actually get
this change tested, and I've had to context swap quite a few bits.  Such
a process has quite a lot of room for error.

Tested on x86_64-unknown-freebsd13.2.

 Makefile.def |  13 +++-
 Makefile.in  | 202 ---
 [removed regenerated file from the patch below]
 2 files changed, 40 insertions(+), 175 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 792f81447e1b..ba89d46b2495 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -80,8 +80,17 @@ host_modules= { module= gettext; bootstrap=true; 
no_install=true;
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
// user-facing output.
-extra_configure_flags='--disable-shared --disable-java 
--disable-csharp --with-pic';
-lib_path=intl/.libs; };
+   extra_configure_flags='--disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf';
+   missing= pdf;
+   missing= html;
+   missing= info;
+   missing= dvi;
+   missing= install-pdf;
+   missing= install-html;
+   missing= install-info;
+   missing= install-dvi;
+   missing= TAGS;
+   no_install= true; };
 host_modules= { module= tcl;
 missing=mostlyclean; };
 host_modules= { module= itcl; };
diff --git a/Makefile.in b/Makefile.in
index da2344b3f3dc..3bd7d37e9605 100644
 
-- 
2.43.0



Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-21 Thread Arsen Arsenović

Arsen Arsenović  writes:

> Bruno Haible  writes:
>
>> Arsen Arsenović wrote:
>>>   Comparing stages 2 and 3
>>>   Bootstrap comparison failure!
>>>   gettext/libasprintf/autosprintf.o differs
>>>   make[2]: *** [Makefile:23435: compare] Error 1
>>
>> You should be able to work around this by passing the additional option
>> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
>> libasprintf; therefore there is no need to build it.
>
> Ah, sure, that works for me too (note that the fix is to pass
> -frandom-seed=, according to Jakub, should this show up again).

Indeed, that got a bootstrap to pass.  I've also taken the opportunity
to check the problems Eric Gallager reported.  The install tree seems
clean now, and the info et al targets appear to work again.  David,
Eric, could you check whether the attached patch works for you in the
scenarios you ran into problems with?  Make sure to fetch gettext-0.22.4
into your trees.

From d0f8b623f9720947b805d71c05a5d6a638daefb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Thu, 16 Nov 2023 23:50:30 +0100
Subject: [PATCH] gettext: disable install, docs targets, libasprintf, threads

This fixes issues reported by David Edelsohn , and by
Eric Gallager .

ChangeLog:

	* Makefile.def (gettext): Disable (via missing)
	{install-,}{pdf,html,info,dvi} and TAGS targets.  Set no_install
	to true.  Add --disable-threads --disable-libasprintf.
	* Makefile.in: Regenerate.
---
 Makefile.def |  13 +++-
 Makefile.in  | 202 ---
 2 files changed, 40 insertions(+), 175 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 792f81447e1b..6b03deb49506 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -80,8 +80,17 @@ host_modules= { module= gettext; bootstrap=true; no_install=true;
 		// need it in some configuratons, which is determined via nontrivial tests.
 		// Always enabling pic seems to make sense for something tied to
 		// user-facing output.
-extra_configure_flags='--disable-shared --disable-java --disable-csharp --with-pic';
-lib_path=intl/.libs; };
+extra_configure_flags='--disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf';
+		missing= pdf;
+		missing= html;
+		missing= info;
+		missing= dvi;
+		missing= install-pdf;
+		missing= install-html;
+		missing= install-info;
+		missing= install-dvi;
+		missing= TAGS;
+		no_install= true;};
 host_modules= { module= tcl;
 missing=mostlyclean; };
 host_modules= { module= itcl; };
diff --git a/Makefile.in b/Makefile.in
index da2344b3f3dc..3bd7d37e9605 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -768,7 +768,7 @@ TARGET_LIB_PATH_libatomic = $$r/$(TARGET_SUBDIR)/libatomic/.libs:
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)$(HOST_LIB_PATH_gettext)
+HOST_LIB_PATH = $(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)
 
 # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch
 @if gcc
@@ -796,11 +796,6 @@ HOST_LIB_PATH_isl = \
   $$r/$(HOST_SUBDIR)/isl/.libs:$$r/$(HOST_SUBDIR)/prev-isl/.libs:
 @endif isl
 
-@if gettext
-HOST_LIB_PATH_gettext = \
-  $$r/$(HOST_SUBDIR)/gettext/intl/.libs:$$r/$(HOST_SUBDIR)/prev-gettext/intl/.libs:
-@endif gettext
-
 
 CXX_FOR_TARGET_FLAG_TO_PASS = \
 	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
@@ -19827,7 +19822,7 @@ configure-gettext:
 	  $$s/$$module_srcdir/configure \
 	  --srcdir=$${topdir}/$$module_srcdir \
 	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
-	  --target=${target_alias} --disable-shared --disable-java --disable-csharp --with-pic \
+	  --target=${target_alias} --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf \
 	  || exit 1
 @endif gettext
 
@@ -19863,7 +19858,7 @@ configure-stage1-gettext:
 	  --target=${target_alias} \
 	   \
 	  $(STAGE1_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stage2-gettext maybe-configure-stage2-gettext
@@ -19897,7 +19892,7 @@ configure-stage2-gettext:
 	  --target=${target_alias} \
 	  --with-build-libsubdir=$(HOST_SUBDIR) \
 	  $(STAGE2_CONFIGURE_FLAGS) \
-	  --disable-shared --disable-java --disable-csharp --with-pic
+	  --disable-shared --disable-threads --disable-java --disable-csharp --with-pic --disable-libasprintf
 @endif gettext-bootstrap
 
 .PHONY: configure-stage3-gettext maybe-configure-stage3-gettext
@@ -19931,7 +19926,7 @@ configure-stage3-gettext:
 	  --target=${target_alias} \
 	  -

Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-20 Thread Arsen Arsenović

Bruno Haible  writes:

> Arsen Arsenović wrote:
>>   Comparing stages 2 and 3
>>   Bootstrap comparison failure!
>>   gettext/libasprintf/autosprintf.o differs
>>   make[2]: *** [Makefile:23435: compare] Error 1
>
> You should be able to work around this by passing the additional option
> --disable-libasprintf to gettext-runtime/configure. Nothing in GCC needs
> libasprintf; therefore there is no need to build it.

Ah, sure, that works for me too (note that the fix is to pass
-frandom-seed=, according to Jakub, should this show up again).

> And while at it, I would also pass --disable-java and --disable-csharp.

Yes, I noticed those and disabled them already.

> Bruno


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-20 Thread Arsen Arsenović

David Edelsohn  writes:

> _GLOBAL__F_xxx is the EH frame data.
>
> It's using the filename with full path for the unique name, which is why it
> includes .._.._.. .  Apparently it is adding a random number as well for
> uniqueness.  I guess that this is the downside of building in tree, and
> apparently it is rebuilding gettext itself with the different stages of the
> compiler, so the appended random number changes.

Jakub pointed me to -frandom-seed=, which stabilized this, it'd seem.
Running a clean build to test (hacking an existing one worked).

Will report back.

> Thanks, David
>
>
> On Mon, Nov 20, 2023 at 4:23 PM Arsen Arsenović  wrote:
>
>>
>> David Edelsohn  writes:
>>
>> > On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible  wrote:
>> >
>> >> David Edelsohn wrote:
>> >> > --disable-threads currently does not completely disable threads.
>> Bruno
>> >> is
>> >> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
>> >> libc.
>> >>
>> >> Unfortunately, as said in the other mail today, relying only on mtx_*
>> >> functions
>> >> did not drop the dependency towards libpthreads.
>> >>
>> >> So, I've made a new release gettext-0.22.4, that includes only these
>> >> changes:
>> >>
>> >>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS
>> and
>> >> AIX.
>> >>
>> >>   - Passing --disable-threads now builds a libintl that, on AIX, does
>> not
>> >> need -lpthread.
>> >>
>> >>   - Other build fixes on AIX.
>> >>
>> >> > Yes, GCC should configure the in tree gettext with --disable-threads,
>> but
>> >> > that configure option is not completely effective and does not
>> produce a
>> >> > build without threads references.
>> >>
>> >> Now it is effective. But you (Arsen) should state in the documentation
>> >> (gcc/doc/install.texi) that for --disable-threads to have this effect,
>> >> one needs gettext version 0.22.4 or newer.
>> >>
>> >
>> > So the question is do we want to change GCC on AIX to always link against
>> > pthreads so that GCC can build with default, external builds of gettext
>> > libintl.  I don't see a path for i18n support to work for GCC on AIX
>> > without that unfortunate change.
>>
>> Well, if detectable by the build system for, I imagine we could avoid
>> pthread if gettext is built without them.  With the 'private' gettext
>> build, we should never need threads anyway.
>>
>> P.S: Building on AIX is nearly successful.  gettext-0.22.4 builds, twice
>> or even thrice, but ends up producing a bootstrap comparison fail:
>>
>>   make[3]: Leaving directory '/home/arsen/build'
>>   Comparing stages 2 and 3
>>   Bootstrap comparison failure!
>>   gettext/libasprintf/autosprintf.o differs
>>   make[2]: *** [Makefile:23435: compare] Error 1
>>
>> Upon inspecting these files, I see the following diff:
>>
>> ~ 1 $ git diff <(objdump --all-headers autosprintf.o2) <(objdump
>> --all-headers autosprintf.o3)
>> diff --git a/dev/fd/63 b/dev/fd/62
>> --- a/dev/fd/63
>> +++ b/dev/fd/62
>> ...
>> @@ -92,7 +92,7 @@ AUX indx   30 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0
>> snstb 0
>>  AUX val23 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
>>  [ 58](sec  1)(fl 0x00)(ty0)(scl 107) (nx 1) 0x0460
>> _autosprintf.ro_
>>  AUX val   312 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
>> -[ 60](sec  1)(fl 0x00)(ty0)(scl   2) (nx 1) 0x0460
>> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0xa20d51b1d7a1772f
>> +[ 60](sec  1)(fl 0x00)(ty0)(scl   2) (nx 1) 0x0460
>> _GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0x9c04058e89d7a7a4
>>  AUX indx   58 prmhsh 0 snhsh 0 typ 2 algn 0 clss 1 stb 0 snstb 0
>>  [ 62](sec  2)(fl 0x00)(ty0)(scl 107) (nx 1) 0x05a0
>> _autosprintf.rw_
>>  AUX val 0 prmhsh 0 snhsh 0 typ 1 algn 4 clss 5 stb 0 snstb 0
>>
>> I am unsure what this symbol is.  It does not appear in the stripped
>> binary.
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-20 Thread Arsen Arsenović

David Edelsohn  writes:

> On Sun, Nov 19, 2023 at 5:15 PM Bruno Haible  wrote:
>
>> David Edelsohn wrote:
>> > --disable-threads currently does not completely disable threads.  Bruno
>> is
>> > suggesting --enable-threads=isoc that relies on mtx mutex functions in
>> libc.
>>
>> Unfortunately, as said in the other mail today, relying only on mtx_*
>> functions
>> did not drop the dependency towards libpthreads.
>>
>> So, I've made a new release gettext-0.22.4, that includes only these
>> changes:
>>
>>   - AM_GNU_GETTEXT now recognizes a statically built libintl on macOS and
>> AIX.
>>
>>   - Passing --disable-threads now builds a libintl that, on AIX, does not
>> need -lpthread.
>>
>>   - Other build fixes on AIX.
>>
>> > Yes, GCC should configure the in tree gettext with --disable-threads, but
>> > that configure option is not completely effective and does not produce a
>> > build without threads references.
>>
>> Now it is effective. But you (Arsen) should state in the documentation
>> (gcc/doc/install.texi) that for --disable-threads to have this effect,
>> one needs gettext version 0.22.4 or newer.
>>
>
> So the question is do we want to change GCC on AIX to always link against
> pthreads so that GCC can build with default, external builds of gettext
> libintl.  I don't see a path for i18n support to work for GCC on AIX
> without that unfortunate change.

Well, if detectable by the build system for, I imagine we could avoid
pthread if gettext is built without them.  With the 'private' gettext
build, we should never need threads anyway.

P.S: Building on AIX is nearly successful.  gettext-0.22.4 builds, twice
or even thrice, but ends up producing a bootstrap comparison fail:

  make[3]: Leaving directory '/home/arsen/build'
  Comparing stages 2 and 3
  Bootstrap comparison failure!
  gettext/libasprintf/autosprintf.o differs
  make[2]: *** [Makefile:23435: compare] Error 1

Upon inspecting these files, I see the following diff:

~ 1 $ git diff <(objdump --all-headers autosprintf.o2) <(objdump --all-headers 
autosprintf.o3)
diff --git a/dev/fd/63 b/dev/fd/62
--- a/dev/fd/63
+++ b/dev/fd/62
...
@@ -92,7 +92,7 @@ AUX indx   30 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 
snstb 0
 AUX val23 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
 [ 58](sec  1)(fl 0x00)(ty0)(scl 107) (nx 1) 0x0460 _autosprintf.ro_
 AUX val   312 prmhsh 0 snhsh 0 typ 1 algn 4 clss 1 stb 0 snstb 0
-[ 60](sec  1)(fl 0x00)(ty0)(scl   2) (nx 1) 0x0460 
_GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0xa20d51b1d7a1772f
+[ 60](sec  1)(fl 0x00)(ty0)(scl   2) (nx 1) 0x0460 
_GLOBAL__F_.._.._.._gcc_gettext_gettext_runtime_libasprintf_autosprintf.cc_DFF67DD7_0x9c04058e89d7a7a4
 AUX indx   58 prmhsh 0 snhsh 0 typ 2 algn 0 clss 1 stb 0 snstb 0
 [ 62](sec  2)(fl 0x00)(ty0)(scl 107) (nx 1) 0x05a0 _autosprintf.rw_
 AUX val 0 prmhsh 0 snhsh 0 typ 1 algn 4 clss 5 stb 0 snstb 0

I am unsure what this symbol is.  It does not appear in the stripped
binary.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH] libstdc++: implement std::generator

2023-11-18 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* include/Makefile.am: Install std/generator, bits/elements_of.h
as freestanding.
* include/Makefile.in: Regenerate.
* include/bits/version.def: Add __cpp_lib_generator.
* include/bits/version.h: Regenerate.
* include/precompiled/stdc++.h: Include .
* include/std/ranges: Include bits/elements_of.h
* include/bits/elements_of.h: New file.
* include/std/generator: New file.
* testsuite/24_iterators/range_generators/01.cc: New test.
* testsuite/24_iterators/range_generators/02.cc: New test.
* testsuite/24_iterators/range_generators/copy.cc: New test.
* testsuite/24_iterators/range_generators/except.cc: New test.
* testsuite/24_iterators/range_generators/synopsis.cc: New test.
* testsuite/24_iterators/range_generators/subrange.cc: New test.
---
Evening,

This is an implementation of  from C++23.  It should be
feature-complete, though it doesn't have all the tests that it ought to
and is missing a few tweaks.

Posting to get reviews in the meanwhile, in case something obvious was
missed.

Have a lovely night :-)

 libstdc++-v3/include/Makefile.am  |   2 +
 libstdc++-v3/include/Makefile.in  |   2 +
 libstdc++-v3/include/bits/elements_of.h   |  72 ++
 libstdc++-v3/include/bits/version.def |   9 +
 libstdc++-v3/include/bits/version.h   |  11 +
 libstdc++-v3/include/precompiled/stdc++.h |   1 +
 libstdc++-v3/include/std/generator| 820 ++
 libstdc++-v3/include/std/ranges   |   4 +
 .../24_iterators/range_generators/01.cc   |  55 ++
 .../24_iterators/range_generators/02.cc   | 219 +
 .../24_iterators/range_generators/copy.cc |  97 +++
 .../24_iterators/range_generators/except.cc   |  97 +++
 .../24_iterators/range_generators/subrange.cc |  45 +
 .../24_iterators/range_generators/synopsis.cc |  38 +
 14 files changed, 1472 insertions(+)
 create mode 100644 libstdc++-v3/include/bits/elements_of.h
 create mode 100644 libstdc++-v3/include/std/generator
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/01.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/02.cc
 create mode 100644 libstdc++-v3/testsuite/24_iterators/range_generators/copy.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/except.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/subrange.cc
 create mode 100644 
libstdc++-v3/testsuite/24_iterators/range_generators/synopsis.cc

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 17d9d9cec313..0b764f2b8a9e 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -35,6 +35,7 @@ std_freestanding = \
${std_srcdir}/coroutine \
${std_srcdir}/expected \
${std_srcdir}/functional \
+   ${std_srcdir}/generator \
${std_srcdir}/iterator \
${std_srcdir}/limits \
${std_srcdir}/memory \
@@ -122,6 +123,7 @@ bits_freestanding = \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/cpp_type_traits.h \
+   ${bits_srcdir}/elements_of.h \
${bits_srcdir}/enable_special_members.h \
${bits_srcdir}/functexcept.h \
${bits_srcdir}/functional_hash.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index f038af709cc4..7f1a6592942e 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -393,6 +393,7 @@ std_freestanding = \
${std_srcdir}/coroutine \
${std_srcdir}/expected \
${std_srcdir}/functional \
+   ${std_srcdir}/generator \
${std_srcdir}/iterator \
${std_srcdir}/limits \
${std_srcdir}/memory \
@@ -477,6 +478,7 @@ bits_freestanding = \
${bits_srcdir}/concept_check.h \
${bits_srcdir}/char_traits.h \
${bits_srcdir}/cpp_type_traits.h \
+   ${bits_srcdir}/elements_of.h \
${bits_srcdir}/enable_special_members.h \
${bits_srcdir}/functexcept.h \
${bits_srcdir}/functional_hash.h \
diff --git a/libstdc++-v3/include/bits/elements_of.h 
b/libstdc++-v3/include/bits/elements_of.h
new file mode 100644
index ..663e15a94aa7
--- /dev/null
+++ b/libstdc++-v3/include/bits/elements_of.h
@@ -0,0 +1,72 @@
+// Tag type for yielding ranges rather than values in   -*- C++ -*-
+
+// Copyright (C) 2023 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied 

Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-18 Thread Arsen Arsenović

David Edelsohn  writes:

> On Fri, Nov 17, 2023 at 10:17 AM Arsen Arsenović  wrote:
>
>>
>> David Edelsohn  writes:
>>
>> > On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović  wrote:
>> >
>> >>
>> >> David Edelsohn  writes:
>> >>
>> >> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović 
>> wrote:
>> >> >
>> >> > [snip]
>> >> >> Sure, but my patch does insert --disable-shared:
>> >> >>
>> >> >> --8<---cut here---start->8---
>> >> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >> >> module_srcdir= "gettext/gettext-runtime";
>> >> >> // We always build gettext with pic, because some
>> >> packages
>> >> >> (e.g. gdbserver)
>> >> >> // need it in some configuratons, which is determined
>> >> via
>> >> >> nontrivial tests.
>> >> >> // Always enabling pic seems to make sense for
>> something
>> >> >> tied to
>> >> >> // user-facing output.
>> >> >> extra_configure_flags='--disable-shared
>> --disable-java
>> >> >> --disable-csharp --with-pic';
>> >> >> lib_path=intl/.libs; };
>> >> >> --8<---cut here---end--->8---
>> >> >>
>> >> >> ... and it is applied:
>> >> >>
>> >> >> --8<---cut here---start->8---
>> >> >> -bash-5.1$ ./config.status --config
>> >> >> --srcdir=../../gcc/gettext/gettext-runtime
>> --cache-file=./config.cache
>> >> >>   --disable-werror --with-gmp=/opt/cfarm
>> >> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >> >>   --disable-coverage --enable-languages=c,c++
>> >> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >> >>   host_alias=powerpc-ibm-aix7.3.1.0
>> target_alias=powerpc-ibm-aix7.3.1.0
>> >> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> >> --8<---cut here---end--->8---
>> >> >>
>> >> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I
>> see
>> >> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >> >>
>> >> >
>> >> > An AIX shared library created by libtool will look like
>> >> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> >> > Normally with one file.
>> >>
>> >> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> >> > with multiple object files.
>> >> >
>> >> > An AIX archive can contain a combination of shared objects and
>> >> > normal object files.
>> >> >
>> >> > AIX normally uses the convention shr.o or shr_64.o for the name
>> >> > of the shared object file.  Hint, hint, an AIX archive can contain
>> >> > both 32 bit and 64 bit object files or shared objects.
>> >> >
>> >> > I don't know why the gettext build system would create
>> >> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> >> > if --disable-shared was requested.  That clearly is using the
>> >> > naming of a libtool AIX shared object and failing due to
>> >> > the missing shared object.  Although in this case, the problem
>> >> > seems to be the shared library load path.  AIX uses LIBPATH,
>> >> > not LD_LIBRARY_PATH.
>> >>
>> >> It doe

Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-17 Thread Arsen Arsenović

David Edelsohn  writes:

> On Fri, Nov 17, 2023 at 3:46 AM Arsen Arsenović  wrote:
>
>>
>> David Edelsohn  writes:
>>
>> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović  wrote:
>> >
>> > [snip]
>> >> Sure, but my patch does insert --disable-shared:
>> >>
>> >> --8<---cut here---start->8---
>> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >> module_srcdir= "gettext/gettext-runtime";
>> >> // We always build gettext with pic, because some
>> packages
>> >> (e.g. gdbserver)
>> >> // need it in some configuratons, which is determined
>> via
>> >> nontrivial tests.
>> >> // Always enabling pic seems to make sense for something
>> >> tied to
>> >> // user-facing output.
>> >> extra_configure_flags='--disable-shared --disable-java
>> >> --disable-csharp --with-pic';
>> >> lib_path=intl/.libs; };
>> >> --8<---cut here---end--->8---
>> >>
>> >> ... and it is applied:
>> >>
>> >> --8<---cut here---start->8---
>> >> -bash-5.1$ ./config.status --config
>> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>> >>   --disable-werror --with-gmp=/opt/cfarm
>> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >>   --disable-coverage --enable-languages=c,c++
>> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> --8<---cut here---end--->8---
>> >>
>> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >>
>> >
>> > An AIX shared library created by libtool will look like
>> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> > Normally with one file.
>>
>> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> > with multiple object files.
>> >
>> > An AIX archive can contain a combination of shared objects and
>> > normal object files.
>> >
>> > AIX normally uses the convention shr.o or shr_64.o for the name
>> > of the shared object file.  Hint, hint, an AIX archive can contain
>> > both 32 bit and 64 bit object files or shared objects.
>> >
>> > I don't know why the gettext build system would create
>> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> > if --disable-shared was requested.  That clearly is using the
>> > naming of a libtool AIX shared object and failing due to
>> > the missing shared object.  Although in this case, the problem
>> > seems to be the shared library load path.  AIX uses LIBPATH,
>> > not LD_LIBRARY_PATH.
>>
>> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
>> libintl.a contains a bunch of objects, as I'd expect of a static
>> library:
>>
>> --8<---cut here---start->8---
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
>> bindtextdom.o
>> dcgettext.o
>> ...
>> --8<---cut here---end--->8---
>>
>>
>> > Also, for me, the out of tree path was
>> >
>> > gettext/gettext-runtime/intl/.libs
>> >
>> > Is your search path missing a level?
>>
>> No, the above is generated by the GCC build system and builds
>> gettext-runtime directly (per Brunos recomme

Re: building GNU gettext on AIX

2023-11-17 Thread Arsen Arsenović

Bruno Haible  writes:

> David Edelsohn and Richard Biener wrote:
>> > >   * GCC can pass --enable-threads=isoc, to avoid the libpthread 
>> > > dependency
>> > > on AIX ≥ 7.2.
>> >
>> > Hmm, would that option work everywhere, though?  Or would we have to
>> > wire up configury to detect which flag to use?  If so, what would it
>> > look like.
>
> --enable-threads=isoc should only be used where needed, i.e. on AIX 7.2
> or higher. Yes, this needs a configure test.
>
>> I'd highly recommend the in-tree gettext to be built with thread
>> support _disabled_,
>> only a static library built and never installed (but linked statically
>> into the host binaries).
>
> As long as this static libintl.a gets never installed (but linked statically
> into the host binaries), that's perfectly fine.
>
> It only needs a fixed gettext.m4, to deal with the bug that David Edelsohn
> noticed on AIX (but that exists on macOS as well). [1]

That should always work for us, then (the only case in which the GCC
build system sets up flags for gettext is when building it in-tree, in
which case we already want a --disable-shared build).

If that library gets installed, then, so far, it is unintentional.  I'll
check that (as well as the docs targets that Eric Gallager mentioned on
IRC) tonight.

> Bruno
>
> [1] https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00164.html


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-17 Thread Arsen Arsenović

Richard Biener  writes:

> On Fri, Nov 17, 2023 at 9:46 AM Arsen Arsenović  wrote:
>>
>>
>> David Edelsohn  writes:
>>
>> > On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović  wrote:
>> >
>> > [snip]
>> >> Sure, but my patch does insert --disable-shared:
>> >>
>> >> --8<---cut here---start->8---
>> >> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> >> module_srcdir= "gettext/gettext-runtime";
>> >> // We always build gettext with pic, because some packages
>> >> (e.g. gdbserver)
>> >> // need it in some configuratons, which is determined via
>> >> nontrivial tests.
>> >> // Always enabling pic seems to make sense for something
>> >> tied to
>> >> // user-facing output.
>> >> extra_configure_flags='--disable-shared --disable-java
>> >> --disable-csharp --with-pic';
>> >> lib_path=intl/.libs; };
>> >> --8<---cut here---end--->8---
>> >>
>> >> ... and it is applied:
>> >>
>> >> --8<---cut here---start->8---
>> >> -bash-5.1$ ./config.status --config
>> >> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>> >>   --disable-werror --with-gmp=/opt/cfarm
>> >>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>> >>   --with-included-gettext --program-transform-name=s,y,y,
>> >>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>> >>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>> >>   --disable-intermodule --enable-checking=yes,types,extra
>> >>   --disable-coverage --enable-languages=c,c++
>> >>   --disable-build-format-warnings --disable-shared --disable-java
>> >>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>> >>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>> >>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>> >>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> >> --8<---cut here---end--->8---
>> >>
>> >> I'm unsure how to tell what the produced binaries are w.r.t static or
>> >> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> >> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>> >>
>> >
>> > An AIX shared library created by libtool will look like
>> > libfoo.a[libfoo.so.N], where N is the package major version number.
>> > Normally with one file.
>>
>> > An AIX static library will look like libfoo.a[a.o, b.o, c.o]
>> > with multiple object files.
>> >
>> > An AIX archive can contain a combination of shared objects and
>> > normal object files.
>> >
>> > AIX normally uses the convention shr.o or shr_64.o for the name
>> > of the shared object file.  Hint, hint, an AIX archive can contain
>> > both 32 bit and 64 bit object files or shared objects.
>> >
>> > I don't know why the gettext build system would create
>> > /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
>> > if --disable-shared was requested.  That clearly is using the
>> > naming of a libtool AIX shared object and failing due to
>> > the missing shared object.  Although in this case, the problem
>> > seems to be the shared library load path.  AIX uses LIBPATH,
>> > not LD_LIBRARY_PATH.
>>
>> It doesn't create libintl.a with a libintl.so.8 inside of it.  The
>> libintl.a contains a bunch of objects, as I'd expect of a static
>> library:
>>
>> --8<---cut here---start->8---
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
>> -bash-5.1$ ar -t gettext/intl/.libs/libintl.a
>> bindtextdom.o
>> dcgettext.o
>> ...
>> --8<---cut here---end--->8---
>>
>>
>> > Also, for me, the out of tree path was
>> >
>> > gettext/gettext-runtime/intl/.libs
>> >
>> > Is your search path missing a level?
>>
>> No, the above is generated by the GCC build system and builds
>> gettext-runtime directly (per Brunos recommendation a while ago) as it
>> is replacing intl/ of similar functionality.
>>
>> I'm currently building GCC with libintl with the threads hack you
>> mentioned applied (as I got undefined references to the pthread
>> functions you discovered).  I suspect that, bar this issue (which, IIUC,
>> Bruno will fix in a new release?) the patch above will fix the issues
>> you've encountered on AIX (note that if you want to use gettext in-tree,
>> you'd still have to fetch gettext into the tree).
>>
>> Maybe we should provide a download-prerequisite-y script that skips
>> everything but GNU gettext, to retain same behavior?
>
> You could add --only-gettext as option to it?

Sure, that sounds good to me.

>>
>> Have a lovely day.
>> --
>> Arsen Arsenović


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: building GNU gettext on AIX

2023-11-17 Thread Arsen Arsenović

Richard Biener  writes:

> On Fri, Nov 17, 2023 at 12:13 AM Arsen Arsenović  wrote:
>>
>>
>> Bruno Haible  writes:
>>
>> > Hi David,
>> >
>> >> the default, distributed libintl library will not allow GCC to be built
>> >> with NLS enabled.
>> >
>> > The problem is this configure test from gettext.m4
>> >
>> >   checking for GNU gettext in libintl... no
>> >
>> > It should say
>> >
>> >   checking for GNU gettext in libintl... yes
>> >
>> > I reproduce it with simple hello-world package, outside GCC.
>> >
>> > It tests whether a program that uses gettext() can be linked with
>> >   -lintl -liconv
>> > But now, on AIX, it needs to test whether such a program can be linked with
>> >   -lintl -liconv -lpthread
>> >
>> >> Were you suggesting that --enable-threads=isoc would work now or that it
>> >> would require further changes for a future release?
>> >
>> > It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
>> > if --enable-threads=isoc was provided.
>> >
>> > I can prepare a new gettext release that has both issues fixed:
>> >   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
>> > to "-Lsome/libdir -lintl -liconv -lpthread",
>> >   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
>> > mutexes when requested.
>> >
>> > But you then need to make up your mind w.r.t. what I wrote in the earlier
>> > mail.
>> >
>> >   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
>> > on AIX ≥ 7.2.
>>
>> Hmm, would that option work everywhere, though?  Or would we have to
>> wire up configury to detect which flag to use?  If so, what would it
>> look like.
>
> I'd highly recommend the in-tree gettext to be built with thread
> support _disabled_,
> only a static library built and never installed (but linked statically
> into the host
> binaries).
>
> So if --disable-threads (or how it is called) does not work you need
> to fix _that_.
> Likewise if --disable-shared doesn't work correctly on all platforms
> you have to fix
> that as well.

That seems like the best choice to me too (and I'm testing a patch that
does that currently).

> Richard.
>
>>
>> >   * Or GCC can (continue to?) use the variable LIBINTL. This will work on
>>
>> If you mean the one generated by gettext.m4/uninstalled-config.sh, it is
>> utilized today:
>>
>> LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
>> $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
>>
>> (from gcc/Makefile.in)
>>
>>
>> > AIX 7.1 as well but the programs will then be linked against 
>> > libpthread.
>> > One additional library.
>> > $ ldd gcc
>> > /opt/freeware/bin/gcc needs:
>> >  /usr/lib/libc.a(shr.o)
>> >  /opt/freeware/lib/libiconv.a(libiconv.so.2)
>> >  /usr/lib/libc.a(_shr.o)
>> >  /unix
>> >  /usr/lib/libcrypt.a(shr.o)
>> >  /opt/freeware/lib/libgcc_s.a(shr.o)
>> > libpthread.a will be added to this list.
>> >
>> > ibm-clang links against libpthread.a as well:
>> > $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
>> > /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
>> >      /usr/lib/libpthreads.a(shr_xpg5_64.o)
>> >  /usr/opt/zlibNX/lib/libz.a(libz.so.1)
>> >  /usr/lib/libcurses.a(shr42_64.o)
>> >  /usr/lib/libiconv.a(shr4_64.o)
>> >  /usr/lib/libc++.a(shr_64.o)
>> >  /usr/lib/libc++abi.a(libc++abi.so.1)
>> >  /usr/lib/libc.a(shr_64.o)
>> >  /usr/lib/libpthreads.a(_shr_xpg5_64.o)
>> >  /usr/lib/libc++.a(libc++.so.1)
>> >  /usr/lib/libunwind.a(libunwind.so.1)
>> >  /usr/lib/libc.a(_shr_64.o)
>> >  /unix
>> >  /usr/lib/libcrypt.a(shr_64.o)
>>
>> David, I'll leave that decision up to you.
>>
>> > Bruno
>>
>>
>> --
>> Arsen Arsenović


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-17 Thread Arsen Arsenović

David Edelsohn  writes:

> On Thu, Nov 16, 2023 at 5:52 PM Arsen Arsenović  wrote:
>
> [snip]
>> Sure, but my patch does insert --disable-shared:
>>
>> --8<---cut here---start->8---
>> host_modules= { module= gettext; bootstrap=true; no_install=true;
>> module_srcdir= "gettext/gettext-runtime";
>> // We always build gettext with pic, because some packages
>> (e.g. gdbserver)
>> // need it in some configuratons, which is determined via
>> nontrivial tests.
>> // Always enabling pic seems to make sense for something
>> tied to
>> // user-facing output.
>> extra_configure_flags='--disable-shared --disable-java
>> --disable-csharp --with-pic';
>> lib_path=intl/.libs; };
>> --8<---cut here---end--->8---
>>
>> ... and it is applied:
>>
>> --8<---cut here---start->8---
>> -bash-5.1$ ./config.status --config
>> --srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
>>   --disable-werror --with-gmp=/opt/cfarm
>>   --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
>>   --with-included-gettext --program-transform-name=s,y,y,
>>   --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
>>   --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
>>   --disable-intermodule --enable-checking=yes,types,extra
>>   --disable-coverage --enable-languages=c,c++
>>   --disable-build-format-warnings --disable-shared --disable-java
>>   --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
>>   host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
>>   CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
>>   -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
>> --8<---cut here---end--->8---
>>
>> I'm unsure how to tell what the produced binaries are w.r.t static or
>> shared, but I only see .o files inside intl/.libs/libintl.a, while I see
>> a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)
>>
>
> An AIX shared library created by libtool will look like
> libfoo.a[libfoo.so.N], where N is the package major version number.
> Normally with one file.

> An AIX static library will look like libfoo.a[a.o, b.o, c.o]
> with multiple object files.
>
> An AIX archive can contain a combination of shared objects and
> normal object files.
>
> AIX normally uses the convention shr.o or shr_64.o for the name
> of the shared object file.  Hint, hint, an AIX archive can contain
> both 32 bit and 64 bit object files or shared objects.
>
> I don't know why the gettext build system would create
> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8)
> if --disable-shared was requested.  That clearly is using the
> naming of a libtool AIX shared object and failing due to
> the missing shared object.  Although in this case, the problem
> seems to be the shared library load path.  AIX uses LIBPATH,
> not LD_LIBRARY_PATH.

It doesn't create libintl.a with a libintl.so.8 inside of it.  The
libintl.a contains a bunch of objects, as I'd expect of a static
library:

--8<---cut here---start->8---
-bash-5.1$ ar -t gettext/intl/.libs/libintl.a  | grep libintl
-bash-5.1$ ar -t gettext/intl/.libs/libintl.a
bindtextdom.o
dcgettext.o
...
--8<---cut here---end--->8---


> Also, for me, the out of tree path was
>
> gettext/gettext-runtime/intl/.libs
>
> Is your search path missing a level?

No, the above is generated by the GCC build system and builds
gettext-runtime directly (per Brunos recommendation a while ago) as it
is replacing intl/ of similar functionality.

I'm currently building GCC with libintl with the threads hack you
mentioned applied (as I got undefined references to the pthread
functions you discovered).  I suspect that, bar this issue (which, IIUC,
Bruno will fix in a new release?) the patch above will fix the issues
you've encountered on AIX (note that if you want to use gettext in-tree,
you'd still have to fetch gettext into the tree).

Maybe we should provide a download-prerequisite-y script that skips
everything but GNU gettext, to retain same behavior?

Have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: building GNU gettext on AIX

2023-11-16 Thread Arsen Arsenović

Bruno Haible  writes:

> Hi David,
>
>> the default, distributed libintl library will not allow GCC to be built
>> with NLS enabled.
>
> The problem is this configure test from gettext.m4
>
>   checking for GNU gettext in libintl... no
>
> It should say
>
>   checking for GNU gettext in libintl... yes
>
> I reproduce it with simple hello-world package, outside GCC.
>
> It tests whether a program that uses gettext() can be linked with
>   -lintl -liconv
> But now, on AIX, it needs to test whether such a program can be linked with
>   -lintl -liconv -lpthread
>
>> Were you suggesting that --enable-threads=isoc would work now or that it
>> would require further changes for a future release?
>
> It requires a change, effectively to do as if HAVE_PTHREAD_API is undefined
> if --enable-threads=isoc was provided.
>
> I can prepare a new gettext release that has both issues fixed:
>   - gettext.m4 that fixes the configure test and sets the variable LIBINTL
> to "-Lsome/libdir -lintl -liconv -lpthread",
>   - mbrtowc.o and setlocale*.o that use mtx_* locks instead of pthread_*
> mutexes when requested.
>
> But you then need to make up your mind w.r.t. what I wrote in the earlier
> mail.
>
>   * GCC can pass --enable-threads=isoc, to avoid the libpthread dependency
> on AIX ≥ 7.2.

Hmm, would that option work everywhere, though?  Or would we have to
wire up configury to detect which flag to use?  If so, what would it
look like.

>   * Or GCC can (continue to?) use the variable LIBINTL. This will work on

If you mean the one generated by gettext.m4/uninstalled-config.sh, it is
utilized today:

LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)

(from gcc/Makefile.in)


> AIX 7.1 as well but the programs will then be linked against libpthread.
> One additional library.
> $ ldd gcc
> /opt/freeware/bin/gcc needs:
>  /usr/lib/libc.a(shr.o)
>  /opt/freeware/lib/libiconv.a(libiconv.so.2)
>  /usr/lib/libc.a(_shr.o)
>  /unix
>  /usr/lib/libcrypt.a(shr.o)
>  /opt/freeware/lib/libgcc_s.a(shr.o)
> libpthread.a will be added to this list.
>
> ibm-clang links against libpthread.a as well:
> $ ldd /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig
> /opt/IBM/openxlC/17.1.1/bin/.ibm-clang.orig needs:
>  /usr/lib/libpthreads.a(shr_xpg5_64.o)
>  /usr/opt/zlibNX/lib/libz.a(libz.so.1)
>  /usr/lib/libcurses.a(shr42_64.o)
>  /usr/lib/libiconv.a(shr4_64.o)
>  /usr/lib/libc++.a(shr_64.o)
>  /usr/lib/libc++abi.a(libc++abi.so.1)
>  /usr/lib/libc.a(shr_64.o)
>  /usr/lib/libpthreads.a(_shr_xpg5_64.o)
>  /usr/lib/libc++.a(libc++.so.1)
>  /usr/lib/libunwind.a(libunwind.so.1)
>  /usr/lib/libc.a(_shr_64.o)
>  /unix
>  /usr/lib/libcrypt.a(shr_64.o)

David, I'll leave that decision up to you.

> Bruno


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-16 Thread Arsen Arsenović

David Edelsohn  writes:

> On Thu, Nov 16, 2023 at 5:22 PM Arsen Arsenović  wrote:
>
>>
>> David Edelsohn  writes:
>>
>> > Don't build with the dependent libraries in tree.  Don't build the
>> > dependent libraries as shared libraries. The libraries are already built
>> > and in /opt/cfarm, as mentioned in the Compile Farm wiki.
>> >
>> > AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
>> > libraries *ARE* shared object files in archives.  Shared object
>> versioning
>> > is handled by multiple objects in the same archive.
>>
>> Hmm, I see.  I removed all the deps but gettext from the tree.
>>
>> This leaves gettext-runtime fulfilling the previous role of intl/.
>>
>> However, I'm confused about how this worked before, in that case, since,
>> IIRC, intl also produced libraries and was also put into host exports.
>>
>> Leaving gettext in tree produces:
>>
>> Could not load program gawk:
>> Dependent module
>> /home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could not be
>> loaded.
>> Member libintl.so.8 is not found in archive
>>
>> I'll try to see why intl/ didn't cause the same issue soon.
>>
>> Thanks, have a lovely evening.
>>
>
> The previous version of "intl" was built as a static library.  Configure in
> the older package had the option --enable-host-shared,
> which I did not use.  Based on the failure message, the in-tree gettext
> seems to be built as a shared library.  If you explicitly
> pass --disable-shared to the in-tree configure, you may get farther.  I'm
> currently using --disable-shared --disable-threads.
> As we have discussed, the current gettext will retain some references to
> pthreads despite the configure option.

Sure, but my patch does insert --disable-shared:

--8<---cut here---start->8---
host_modules= { module= gettext; bootstrap=true; no_install=true;
module_srcdir= "gettext/gettext-runtime";
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
// user-facing output.
extra_configure_flags='--disable-shared --disable-java 
--disable-csharp --with-pic';
lib_path=intl/.libs; };
--8<---cut here---end--->8---

... and it is applied:

--8<---cut here---start->8---
-bash-5.1$ ./config.status --config
--srcdir=../../gcc/gettext/gettext-runtime --cache-file=./config.cache
  --disable-werror --with-gmp=/opt/cfarm
  --with-libiconv-prefix=/opt/cfarm --disable-libstdcxx-pch
  --with-included-gettext --program-transform-name=s,y,y,
  --disable-option-checking --build=powerpc-ibm-aix7.3.1.0
  --host=powerpc-ibm-aix7.3.1.0 --target=powerpc-ibm-aix7.3.1.0
  --disable-intermodule --enable-checking=yes,types,extra
  --disable-coverage --enable-languages=c,c++
  --disable-build-format-warnings --disable-shared --disable-java
  --disable-csharp --with-pic build_alias=powerpc-ibm-aix7.3.1.0
  host_alias=powerpc-ibm-aix7.3.1.0 target_alias=powerpc-ibm-aix7.3.1.0
  CC=gcc CFLAGS=-g 'LDFLAGS=-static-libstdc++ -static-libgcc
  -Wl,-bbigtoc' 'CXX=g++ -std=c++11' CXXFLAGS=-g
--8<---cut here---end--->8---

I'm unsure how to tell what the produced binaries are w.r.t static or
shared, but I only see .o files inside intl/.libs/libintl.a, while I see
a .so.1 in (e.g.) /lib/libz.a, hinting at it not being shared (?)

I do see that the build system adds intl to the LD_LIBRARY_PATH.

I will be testing dropping lib_path from the module definition above.
It might be superflous (I think it is only used for LD_LIBRARY_PATH, for
when the libs built by the build system are shared - which they never
are for in-tree gettext).  I'll take the shot to add --disable-threads,
too, for this test.

From 4b75355d5ee9162a922a85517ef3c0a16931544d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Thu, 16 Nov 2023 23:50:30 +0100
Subject: [PATCH] disable threads, lib_path on gettext

---
 Makefile.def |  3 +--
 Makefile.in  | 27 +++
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 792f81447e1b..78414b4cd89c 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -80,8 +80,7 @@ host_modules= { module= gettext; bootstrap=true; no_install=true;
 		// need it in some configuratons, which is determined via nontrivial tests.
 		// Always enabling pic seems to make sense for something tied to
 	

Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-16 Thread Arsen Arsenović

David Edelsohn  writes:

> Don't build with the dependent libraries in tree.  Don't build the
> dependent libraries as shared libraries. The libraries are already built
> and in /opt/cfarm, as mentioned in the Compile Farm wiki.
>
> AIX is not Solaris and not Linux.  It doesn't use ELF.  AIX shared
> libraries *ARE* shared object files in archives.  Shared object versioning
> is handled by multiple objects in the same archive.

Hmm, I see.  I removed all the deps but gettext from the tree.

This leaves gettext-runtime fulfilling the previous role of intl/.

However, I'm confused about how this worked before, in that case, since,
IIRC, intl also produced libraries and was also put into host exports.

Leaving gettext in tree produces:

Could not load program gawk:
Dependent module 
/home/arsen/build/./gettext/intl/.libs/libintl.a(libintl.so.8) could not be 
loaded.
Member libintl.so.8 is not found in archive 

I'll try to see why intl/ didn't cause the same issue soon.

Thanks, have a lovely evening.

> Thanks, David
>
>
>
> On Thu, Nov 16, 2023 at 4:15 PM Arsen Arsenović  wrote:
>
>>
>> Arsen Arsenović  writes:
>>
>> > [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović
>> (Gentoo Developer UID)  (trust ultimate) created at
>> 2023-11-16T19:47:16+0100 using EDDSA]]
>> >
>> > David Edelsohn  writes:
>> >
>> >> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović 
>> wrote:
>> >>
>> >>>
>> >>> David Edelsohn  writes:
>> >>>
>> >>> > GCC had been working on AIX with NLS, using
>> "--with-included-gettext".
>> >>> > --disable-nls gets past the breakage, but GCC does not build for me
>> on
>> >>> AIX
>> >>> > with NLS enabled.
>> >>>
>> >>> That should still work with gettext 0.22+ extracted in-tree (it should
>> >>> be fetched by download_prerequisites).
>> >>>
>> >>> > A change in dependencies for GCC should have been announced and more
>> >>> widely
>> >>> > socialized in the GCC development mailing list, not just GCC patches
>> >>> > mailing list.
>> >>> >
>> >>> > I have tried both the AIX Open Source libiconv and libgettext
>> package,
>> >>> and
>> >>> > the ones that I previously built.  Both fail because GCC configure
>> >>> decides
>> >>> > to disable NLS, despite being requested, while libcpp is satisfied,
>> so
>> >>> > tools in the gcc subdirectory don't link against libiconv and the
>> build
>> >>> > fails.  With the included gettext, I was able to rely on a
>> >>> self-consistent
>> >>> > solution.
>> >>>
>> >>> That is interesting.  They should be using the same checks.  I've
>> >>> checked trunk and regenerated files on it, and saw no significant diff
>> >>> (some whitespace changes only).  Could you post the config.log of both?
>> >>>
>> >>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>> >>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>> >>> haven't poked around much further due to time constraints.
>> >>>
>> >>
>> >> The AIX system in the Compile Farm has a complete complement of Open
>> Source
>> >> software installed.
>> >>
>> >> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC
>> Wiki
>> >> Compile Farm page has build tips that include AIX
>> >>
>> >>
>> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>> >
>> > Thanks, that got me further.
>> >
>> >> that recommended --with-included-gettext configuration option.
>> >
>> > This flag should still exist and operate the same if gettext is present
>> > in tree.  I've cloned gcc and downloaded prerequisites (via
>> > contrib/download_prerequisites) and I am trying to configure it now.
>>
>> The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
>> and added to library paths, further GCC processes fail to run:
>>
>> configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc
>> conftest.c  >&5
>> Could not load program
>> /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
>> Dependent module
>> /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) could not be loaded.
>> Member libgmp.so.10 is not found in archive
>>
>> This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
>> in archives, or how it knows about these archives..  I suspect it's
>> getting tripped by something in HOST_EXPORTS.
>>
>> >> Thanks, David
>> >>
>> >>
>> >>>
>> >>> TIA, sorry about the inconvenience.  Have a lovely day.
>> >>>
>> >>> > The current gettext-0.22.3 fails to build for me on AIX.
>> >>> >
>> >>> > libcpp configure believes that NLS functions on AIX, but gcc
>> configure
>> >>> > fails in its tests of gettext functionality, which leads to an
>> >>> inconsistent
>> >>> > configuration and build breakage.
>> >>> >
>> >>> > Thanks, David
>> >>>
>> >>>
>> >>> --
>> >>> Arsen Arsenović
>> >>>
>>
>>
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-16 Thread Arsen Arsenović

Arsen Arsenović  writes:

> [[PGP Signed Part:Good signature from 52C294301EA2C493 Arsen Arsenović 
> (Gentoo Developer UID)  (trust ultimate) created at 
> 2023-11-16T19:47:16+0100 using EDDSA]]
>
> David Edelsohn  writes:
>
>> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović  wrote:
>>
>>>
>>> David Edelsohn  writes:
>>>
>>> > GCC had been working on AIX with NLS, using "--with-included-gettext".
>>> > --disable-nls gets past the breakage, but GCC does not build for me on
>>> AIX
>>> > with NLS enabled.
>>>
>>> That should still work with gettext 0.22+ extracted in-tree (it should
>>> be fetched by download_prerequisites).
>>>
>>> > A change in dependencies for GCC should have been announced and more
>>> widely
>>> > socialized in the GCC development mailing list, not just GCC patches
>>> > mailing list.
>>> >
>>> > I have tried both the AIX Open Source libiconv and libgettext package,
>>> and
>>> > the ones that I previously built.  Both fail because GCC configure
>>> decides
>>> > to disable NLS, despite being requested, while libcpp is satisfied, so
>>> > tools in the gcc subdirectory don't link against libiconv and the build
>>> > fails.  With the included gettext, I was able to rely on a
>>> self-consistent
>>> > solution.
>>>
>>> That is interesting.  They should be using the same checks.  I've
>>> checked trunk and regenerated files on it, and saw no significant diff
>>> (some whitespace changes only).  Could you post the config.log of both?
>>>
>>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>>> haven't poked around much further due to time constraints.
>>>
>>
>> The AIX system in the Compile Farm has a complete complement of Open Source
>> software installed.
>>
>> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC Wiki
>> Compile Farm page has build tips that include AIX
>>
>> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines
>
> Thanks, that got me further.
>
>> that recommended --with-included-gettext configuration option.
>
> This flag should still exist and operate the same if gettext is present
> in tree.  I've cloned gcc and downloaded prerequisites (via
> contrib/download_prerequisites) and I am trying to configure it now.

The build failed.  After gettext/gmp/... (in-tree hostlibs) get built
and added to library paths, further GCC processes fail to run:

configure:3305: gcc -g  -static-libstdc++ -static-libgcc -Wl,-bbigtoc 
conftest.c  >&5
Could not load program /opt/freeware/libexec/gcc/powerpc-ibm-aix7.3.0.0/10/cc1:
Dependent module /home/arsen/build/./gmp/.libs/libgmp.a(libgmp.so.10) 
could not be loaded.
Member libgmp.so.10 is not found in archive 

This seems odd.  I am not sure what compels the RTDL (?) to look up .sos
in archives, or how it knows about these archives..  I suspect it's
getting tripped by something in HOST_EXPORTS.

>> Thanks, David
>>
>>
>>>
>>> TIA, sorry about the inconvenience.  Have a lovely day.
>>>
>>> > The current gettext-0.22.3 fails to build for me on AIX.
>>> >
>>> > libcpp configure believes that NLS functions on AIX, but gcc configure
>>> > fails in its tests of gettext functionality, which leads to an
>>> inconsistent
>>> > configuration and build breakage.
>>> >
>>> > Thanks, David
>>>
>>>
>>> --
>>> Arsen Arsenović
>>>


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: building GNU gettext on AIX

2023-11-16 Thread Arsen Arsenović

Bruno Haible  writes:

> Arsen Arsenović wrote:
>> >   * If yes, then the question is how distributors will in general package
>> > libintl on AIX. If it's installed in public locations (such as in
>> > /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
>> > have a problem: It may cause undefined behaviour in multithreaded
>> > packages that use GNU libintl.
>> > If you can guarantee that it will be installed in GCC-private 
>> > directories
>> > (and outside the path where GCC looks for libraries to link with!) then
>> > it would be OK to install such a non-thread-safe libintl.
>> > But if you cannot guarantee that, we are in trouble.
>> 
>> The in-tree configuration already passes --disable-shared, so I imagine
>> passing --disable-threads would be OK too, for the case that it is
>> utilized.  (relevant for the latter case: GCC-private build of libintl)
>
> Yeah, but this affects only those people who use the in-tree build of
> the libraries.
>
> The problem for distributors remains the same: They have a strong tendency
> of building libraries indepently, with --enable-shared (so that they can
> easily apply fixes without rebuilding the world). These distributors on AIX
> would notice that the GCC configuration attempts to link with "-lintl"
> but not with "-lintl -pthread" and thus the configuration detects that NLS
> is not usable.
>
> Arsen: Where in the GCC tree is this part of the GCC configuration? Is it
> in some configure.ac owned by GCC, or does it come from gettext.m4 ?

See Makefile.def.  It specifies a host-gettext module that has the extra
flags set.

If the in-tree configuration is used, then the uninstalled-config.sh
gettext generates is used.  See config/gettext-sister.m4.

gettext.m4 is unaltered, but it is essentially only used when the
gettext in-tree source is not present (because, otherwise,
gettext-runtime generates uninstalled-config.sh even if it builds
nothing)

Hope that answers it.

> Bruno


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: building GNU gettext on AIX

2023-11-16 Thread Arsen Arsenović

Bruno Haible  writes:

> David Edelsohn wrote:
>> > It is great that gettext and libintl can be built thread-safe, but GCC
>> > (cc1, gcov, etc.) are not pthreads applications and are not built with
>> > pthreads.  Because libintl defaults to pthreads enabled, NLS cannot
>> > function in GCC on AIX by default.  
>> ...
>> The latest issue is that a few files in gettext ignore --disable-pthreads
>> and creates a dependency on pthread_mutex.
>
> GNU gettext does not have an option '--disable-pthreads'. Instead, it has
> options
>
>   --enable-threads={isoc|posix|isoc+posix|windows}
>   specify multithreading API
>
>   --disable-threads   build without multithread safety
>
>> The issue appears to be that intl/gnulib-lib/{mbrtowc.c,setlocale_null.c}
>> include pthread.h based on HAVE_PTHREAD_API, which is defined as 1 in
>> intl/config.h build directory
>
> Yup, I confirm that the dependency comes from these two object files.
>
> Will the next GCC release support AIX 7.1.x ? Recall that AIX 7.1 went
> end-of-life on 2023-04-30 [1]
>
>   * If no, then the simple solution would be to pass the configure option
>   --enable-threads=isoc
> This should not introduce a link dependency, because the mtx_lock,
> mtx_unlock, and mtx_init functions are in libc in AIX ≥ 7.2. Currently it
> does not work (it still uses pthread_mutex_lock and pthread_mutex_unlock
> despite --enable-threads=isoc). But I could make this work and release
> a gettext 0.22.4 with the fix.
>
>   * If yes, then the question is how distributors will in general package
> libintl on AIX. If it's installed in public locations (such as in
> /opt/freeware/{lib,lib64}/libintl.a on gcc119.fsffrance.org), then we
> have a problem: It may cause undefined behaviour in multithreaded
> packages that use GNU libintl.
> If you can guarantee that it will be installed in GCC-private directories
> (and outside the path where GCC looks for libraries to link with!) then
> it would be OK to install such a non-thread-safe libintl.
> But if you cannot guarantee that, we are in trouble.

The in-tree configuration already passes --disable-shared, so I imagine
passing --disable-threads would be OK too, for the case that it is
utilized.  (relevant for the latter case: GCC-private build of libintl)

> How do other library vendors handle this issue on AIX? Do they ship two
> libraries, one MT-safe and one not? Under different names? Or in different
> library search paths?
>
> Bruno
>
> [1] https://www.ibm.com/support/pages/aix-support-lifecycle-information


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-16 Thread Arsen Arsenović

Xi Ruoyao  writes:

> On Wed, 2023-11-15 at 15:14 +0100, Arsen Arsenović wrote:
>> That is interesting.  They should be using the same checks.  I've
>> checked trunk and regenerated files on it, and saw no significant diff
>> (some whitespace changes only).  Could you post the config.log of
>> both?
>
> You did not regenerate config.in.  But I've regenerated it in r14-5434
> anyway.
>
> The related changes:
>
> +/* Define to 1 if you have the Mac OS X function
> +   CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
> +#endif
> +
> +
> +/* Define to 1 if you have the Mac OS X function
> CFPreferencesCopyAppValue in
> +   the CoreFoundation framework. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_CFPREFERENCESCOPYAPPVALUE
> +#endif
>
> +/* Define if the GNU dcgettext() function is already present or preinstalled.
> +   */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_DCGETTEXT
> +#endif
>
> +/* Define if the GNU gettext() function is already present or preinstalled. 
> */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_GETTEXT
> +#endif
>
> I don't know if they are related to the issue on AIX though.

Ah, thanks for doing that.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-16 Thread Arsen Arsenović

David Edelsohn  writes:

> On Wed, Nov 15, 2023 at 9:22 AM Arsen Arsenović  wrote:
>
>>
>> David Edelsohn  writes:
>>
>> > GCC had been working on AIX with NLS, using "--with-included-gettext".
>> > --disable-nls gets past the breakage, but GCC does not build for me on
>> AIX
>> > with NLS enabled.
>>
>> That should still work with gettext 0.22+ extracted in-tree (it should
>> be fetched by download_prerequisites).
>>
>> > A change in dependencies for GCC should have been announced and more
>> widely
>> > socialized in the GCC development mailing list, not just GCC patches
>> > mailing list.
>> >
>> > I have tried both the AIX Open Source libiconv and libgettext package,
>> and
>> > the ones that I previously built.  Both fail because GCC configure
>> decides
>> > to disable NLS, despite being requested, while libcpp is satisfied, so
>> > tools in the gcc subdirectory don't link against libiconv and the build
>> > fails.  With the included gettext, I was able to rely on a
>> self-consistent
>> > solution.
>>
>> That is interesting.  They should be using the same checks.  I've
>> checked trunk and regenerated files on it, and saw no significant diff
>> (some whitespace changes only).  Could you post the config.log of both?
>>
>> I've never used AIX.  Can I reproduce this on one of the cfarm machines
>> to poke around?  I've tried cfarm119, but that one lacked git, and I
>> haven't poked around much further due to time constraints.
>>
>
> The AIX system in the Compile Farm has a complete complement of Open Source
> software installed.
>
> Please ensure that /opt/freeware/bin is in your path.  Also, the GCC Wiki
> Compile Farm page has build tips that include AIX
>
> https://gcc.gnu.org/wiki/CompileFarm#Services_and_software_installed_on_farm_machines

Thanks, that got me further.

> that recommended --with-included-gettext configuration option.

This flag should still exist and operate the same if gettext is present
in tree.  I've cloned gcc and downloaded prerequisites (via
contrib/download_prerequisites) and I am trying to configure it now.

> Thanks, David
>
>
>>
>> TIA, sorry about the inconvenience.  Have a lovely day.
>>
>> > The current gettext-0.22.3 fails to build for me on AIX.
>> >
>> > libcpp configure believes that NLS functions on AIX, but gcc configure
>> > fails in its tests of gettext functionality, which leads to an
>> inconsistent
>> > configuration and build breakage.
>> >
>> > Thanks, David
>>
>>
>> --
>> Arsen Arsenović
>>


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-15 Thread Arsen Arsenović

David Edelsohn  writes:

> GCC had been working on AIX with NLS, using "--with-included-gettext".
> --disable-nls gets past the breakage, but GCC does not build for me on AIX
> with NLS enabled.

That should still work with gettext 0.22+ extracted in-tree (it should
be fetched by download_prerequisites).

> A change in dependencies for GCC should have been announced and more widely
> socialized in the GCC development mailing list, not just GCC patches
> mailing list.
>
> I have tried both the AIX Open Source libiconv and libgettext package, and
> the ones that I previously built.  Both fail because GCC configure decides
> to disable NLS, despite being requested, while libcpp is satisfied, so
> tools in the gcc subdirectory don't link against libiconv and the build
> fails.  With the included gettext, I was able to rely on a self-consistent
> solution.

That is interesting.  They should be using the same checks.  I've
checked trunk and regenerated files on it, and saw no significant diff
(some whitespace changes only).  Could you post the config.log of both?

I've never used AIX.  Can I reproduce this on one of the cfarm machines
to poke around?  I've tried cfarm119, but that one lacked git, and I
haven't poked around much further due to time constraints.

TIA, sorry about the inconvenience.  Have a lovely day.

> The current gettext-0.22.3 fails to build for me on AIX.
>
> libcpp configure believes that NLS functions on AIX, but gcc configure
> fails in its tests of gettext functionality, which leads to an inconsistent
> configuration and build breakage.
>
> Thanks, David


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-14 Thread Arsen Arsenović
Hi David,

David Edelsohn  writes:

> Arsen,
>
> Unfortunately this broke bootstrap on AIX.
>
> I had not seen this series of patches.

I've added Bruno to CC as the libintl maintainer, to keep him in the
loop.  Could you provide some extra information w.r.t. the failure mode?

I'll try to investigate ASAP.

In the meanwhile, does disabling NLS etc work?

Thanks in advance, have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[committed] libcpp: Regenerate config.in

2023-11-13 Thread Arsen Arsenović
The previous commit did not include regenerating files maintained by
autoheader.

libcpp/ChangeLog:

* config.in: Regenerate.
---
Pushed as obvious in response to the quite neat buildbot:
https://builder.sourceware.org/buildbot/#/builders/269/builds/56

 libcpp/config.in | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libcpp/config.in b/libcpp/config.in
index 32397b821667..df4fd44c9ef6 100644
--- a/libcpp/config.in
+++ b/libcpp/config.in
@@ -38,9 +38,21 @@
*/
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the Mac OS X function
+   CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
+#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
+
+/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+
 /* Define to 1 if you have the `clearerr_unlocked' function. */
 #undef HAVE_CLEARERR_UNLOCKED
 
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#undef HAVE_DCGETTEXT
+
 /* Define to 1 if you have the declaration of `abort', and to 0 if you don't.
*/
 #undef HAVE_DECL_ABORT
@@ -171,7 +183,10 @@
 /* Define to 1 if you have the `getc_unlocked' function. */
 #undef HAVE_GETC_UNLOCKED
 
-/* Define if you have the iconv() function. */
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#undef HAVE_GETTEXT
+
+/* Define if you have the iconv() function and it works. */
 #undef HAVE_ICONV
 
 /* Define to 1 if you have the  header file. */
-- 
2.42.1



Re: [RFC PATCH] Detecting lifetime-dse issues via Valgrind

2023-11-11 Thread Arsen Arsenović
Hi,

I like the idea of emitting Valgrind annotations.  Instrumenting the
compiler /a little/ could make a very useful tool even more useful.

I have a minor remark, though (as someone not qualified to talk about
the middle-end bits of code), in the case that the annotation built-in
remains a libgcc bit:

exactl...@ispras.ru writes:

> +#else
> +# define VALGRIND_MAKE_MEM_UNDEFINED(ptr, sz) __builtin_trap ()
> +#endif
> +
> +void __valgrind_make_mem_undefined (void *ptr, unsigned long sz)
> +{
> +  VALGRIND_MAKE_MEM_UNDEFINED (ptr, sz);
> +}

Would it be preferable to have a link-time error here if missing?

Have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 1/2] libstdc++: declare std::allocator in !HOSTED as an extension

2023-11-09 Thread Arsen Arsenović

Jonathan Wakely  writes:

> OK

Thanks, pushed (tests did pass).

Have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 2/2] libstdc++: mark 20_util/scoped_allocator/noexcept.cc R-E-T hosted

2023-11-09 Thread Arsen Arsenović
libstdc++-v3/ChangeLog:

* testsuite/20_util/scoped_allocator/noexcept.cc: Mark as
requiring hosted.
---
 libstdc++-v3/testsuite/20_util/scoped_allocator/noexcept.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/noexcept.cc 
b/libstdc++-v3/testsuite/20_util/scoped_allocator/noexcept.cc
index 16992968d3b9..f14eff2c46f5 100644
--- a/libstdc++-v3/testsuite/20_util/scoped_allocator/noexcept.cc
+++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/noexcept.cc
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target hosted }
 
 #include 
 
-- 
2.42.1



[PATCH 1/2] libstdc++: declare std::allocator in !HOSTED as an extension

2023-11-09 Thread Arsen Arsenović
This allows us to add features to freestanding which allow specifying
non-default allocators (generators, collections, ...) without having to
modify them.

libstdc++-v3/ChangeLog:

* include/bits/memoryfwd.h: Remove HOSTED check around allocator
and its specializations.
---
Evening,

This patch adds std::allocator as a declaration to freestanding, so that
it doesn't block various other bits of the library (such as collections
or the generators that I intend to send in soon) from being added to
freestanding anymore.

I don't intend to pull in anything but  into freestanding
in this release, though, so, this patch will have little impact for now.

Testing on x86_64-pc-linux-gnu (the tests are not done yet, but I see no
relevant fails in previous test runs).  The follow-up patch also marks a
new test as freestanding (as it was failing).

OK for trunk?

Have a lovely evening!

 libstdc++-v3/include/bits/memoryfwd.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/memoryfwd.h 
b/libstdc++-v3/include/bits/memoryfwd.h
index 330a6df7f44a..2b79cd8880a1 100644
--- a/libstdc++-v3/include/bits/memoryfwd.h
+++ b/libstdc++-v3/include/bits/memoryfwd.h
@@ -60,13 +60,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
 
-#if _GLIBCXX_HOSTED
+  // Included in freestanding as a libstdc++ extension.
   template
 class allocator;
 
   template<>
 class allocator;
-#endif
 
 #if __cplusplus >= 201103L
   /// Declare uses_allocator so it can be specialized in `` etc.
-- 
2.42.1



[PATCH v3 2/2] *: add modern gettext

2023-11-02 Thread Arsen Arsenović
This patch updates gettext.m4 and related .m4 files and adds
gettext-runtime as a gmp/mpfr/... style host library, allowing newer
libintl to be used.

This patch /does not/ add build-time tools required for
internationalizing (msgfmt et al), instead, it just updates the runtime
library.  The result should be a distribution that acts exactly the same
when a copy of gettext is present, and disables internationalization
otherwise.

There should be no changes in behavior when gettext is included in-tree.
When gettext is not included in tree, nor available on the system, the
programs will be built without localization.

ChangeLog:

PR bootstrap/12596
* .gitignore: Add '/gettext*'.
* configure.ac (host_libs): Replace intl with gettext.
(hbaseargs, bbaseargs, baseargs): Split baseargs into
{h,b}baseargs.
(skip_barg): New flag.  Skips appending current flag to
bbaseargs.
: Exempt --with-libintl-{type,prefix} from
target and build machine argument passing.
* configure: Regenerate.
* Makefile.def (host_modules): Replace intl module with gettext
module.
(configure-ld): Depend on configure-gettext.
* Makefile.in: Regenerate.

config/ChangeLog:

* intlmacosx.m4: Import from gettext-0.22 (serial 8).
* gettext.m4: Sync with gettext-0.22 (serial 77).
* gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettext's
uninstalled-config.sh, or call AM_GNU_GETTEXT if missing.
* iconv.m4: Sync with gettext-0.22 (serial 26).

contrib/ChangeLog:

* prerequisites.sha512: Add gettext.
* prerequisites.md5: Add gettext.
* download_prerequisites: Add gettext.

gcc/ChangeLog:

* configure: Regenerate.
* aclocal.m4: Regenerate.
* Makefile.in (LIBDEPS): Remove (potential) ./ prefix from
LIBINTL_DEP.
* doc/install.texi: Document new (notable) flags added by the
optional gettext tree and by AM_GNU_GETTEXT.  Document libintl/libc
with gettext dependency.

libcpp/ChangeLog:

* configure: Regenerate.
* aclocal.m4: Regenerate.
---
 .gitignore |1 +
 Makefile.def   |   72 +-
 Makefile.in| 1612 
 config/gettext-sister.m4   |   35 +-
 config/gettext.m4  |  357 +++---
 config/iconv.m4|  313 +++--
 config/intlmacosx.m4   |   69 ++
 configure  |   44 +-
 configure.ac   |   44 +-
 contrib/download_prerequisites |2 +
 contrib/prerequisites.md5  |1 +
 contrib/prerequisites.sha512   |1 +
 gcc/Makefile.in|8 +-
 gcc/aclocal.m4 |4 +
 gcc/configure  | 2001 +++---
 gcc/doc/install.texi   |   72 +-
 libcpp/aclocal.m4  |5 +
 libcpp/configure   | 2139 
 libstdc++-v3/configure |  727 ---
 19 files changed, 5467 insertions(+), 2040 deletions(-)
 create mode 100644 config/intlmacosx.m4

diff --git a/.gitignore b/.gitignore
index 5cc4a0fdfa61..93a16b0b950c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,3 +69,4 @@ stamp-*
 /mpc*
 /gmp*
 /isl*
+/gettext*
diff --git a/Makefile.def b/Makefile.def
index 15c068e4ac40..792f81447e1b 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -74,8 +74,14 @@ host_modules= { module= isl; lib_path=.libs; bootstrap=true;
 host_modules= { module= gold; bootstrap=true; };
 host_modules= { module= gprof; };
 host_modules= { module= gprofng; };
-// intl acts on 'host_shared' directly, and does not support --with-pic.
-host_modules= { module= intl; bootstrap=true; };
+host_modules= { module= gettext; bootstrap=true; no_install=true;
+module_srcdir= "gettext/gettext-runtime";
+   // We always build gettext with pic, because some packages 
(e.g. gdbserver)
+   // need it in some configuratons, which is determined via 
nontrivial tests.
+   // Always enabling pic seems to make sense for something tied to
+   // user-facing output.
+extra_configure_flags='--disable-shared --disable-java 
--disable-csharp --with-pic';
+lib_path=intl/.libs; };
 host_modules= { module= tcl;
 missing=mostlyclean; };
 host_modules= { module= itcl; };
@@ -345,7 +351,7 @@ dependencies = { module=all-build-fixincludes; 
on=all-build-libiberty; };
 dependencies = { module=all-build-libcpp; on=all-build-libiberty; };
 
 // Host modules specific to gcc.
-dependencies = { module=configure-gcc; on=configure-intl; };
+dependencies = { module=configure-gcc; on=configure-gettext; };
 dependencies = { module=configure-gcc; on=all-gmp; };
 dependencies = { module=configure-gcc; on=all-mpfr; };
 dependencies = { module=configure-gcc; on=all-mpc; };
@@ -357,7 +363,7 @@ dependencies = { 

[PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-02 Thread Arsen Arsenović
Morning!

This patch is a rebase and slight wording tweak of
https://inbox.sourceware.org/20231006140501.3370874-1-ar...@aarsen.me

Changes since v2:
- Elaborate on the libintl requirement on non-glibc hosts, per Andrews
  request

Range diff since v2 (since it seems sufficiently readable here):
@@ gcc/doc/install.texi: which lets GCC output diagnostics in languages
  English.  Native Language Support is enabled by default if not doing a
  canadian cross build.  The @option{--disable-nls} option disables NLS@.
  
++Note that this functionality requires either libintl (provided by GNU
++gettext) or C standard library that contains support for gettext (such
++as the GNU C Library).
++@xref{with-included-gettext,,--with-included-gettext} for more
++information on the conditions required to get gettext support.
++
 +@item --with-libintl-prefix=@var{dir}
 +@itemx --without-libintl-prefix
 +Searches for libintl in @file{@var{dir}/include} and
@@ gcc/doc/install.texi: which lets GCC output diagnostics in languages
 +Specifies the type of library to search for when looking for libintl.
 +@var{type} can be one of @code{auto}, @code{static} or @code{shared}.
 +
++@anchor{with-included-gettext}
  @item --with-included-gettext


OK for trunk?  (granted that a regstrap + hand-test for working
localization passes - build's ongoing asynchronously)

Thanks in advance, have a lovely day.

Arsen Arsenović (2):
  intl: remove, in favor of out-of-tree gettext
  *: add modern gettext

 .gitignore |1 +
 Makefile.def   |   72 +-
 Makefile.in| 1612 +++
 config/gettext-sister.m4   |   35 +-
 config/gettext.m4  |  357 +-
 config/iconv.m4|  313 +-
 config/intlmacosx.m4   |   69 +
 configure  |   44 +-
 configure.ac   |   44 +-
 contrib/download_prerequisites |2 +
 contrib/prerequisites.md5  |1 +
 contrib/prerequisites.sha512   |1 +
 gcc/Makefile.in|8 +-
 gcc/aclocal.m4 |4 +
 gcc/configure  | 2001 +++-
 gcc/doc/install.texi   |   72 +-
 intl/ChangeLog |  306 --
 intl/Makefile.in   |  264 -
 intl/README|   21 -
 intl/VERSION   |1 -
 intl/aclocal.m4|   33 -
 intl/bindtextdom.c |  374 --
 intl/config.h.in   |  280 --
 intl/config.intl.in|   12 -
 intl/configure | 8288 
 intl/configure.ac  |  108 -
 intl/dcgettext.c   |   59 -
 intl/dcigettext.c  | 1238 -
 intl/dcngettext.c  |   60 -
 intl/dgettext.c|   60 -
 intl/dngettext.c   |   62 -
 intl/eval-plural.h |  114 -
 intl/explodename.c |  192 -
 intl/finddomain.c  |  195 -
 intl/gettext.c |   64 -
 intl/gettextP.h|  224 -
 intl/gmo.h |  148 -
 intl/hash-string.h |   59 -
 intl/intl-compat.c |  151 -
 intl/l10nflist.c   |  453 --
 intl/libgnuintl.h  |  341 --
 intl/loadinfo.h|  156 -
 intl/loadmsgcat.c  | 1322 -
 intl/localcharset.c|  398 --
 intl/localcharset.h|   42 -
 intl/locale.alias  |   78 -
 intl/localealias.c |  419 --
 intl/localename.c  |  772 ---
 intl/log.c |  104 -
 intl/ngettext.c|   68 -
 intl/osdep.c   |   24 -
 intl/plural-config.h   |1 -
 intl/plural-exp.c  |  156 -
 intl/plural-exp.h  |  132 -
 intl/plural.c  | 1540 --
 intl/plural.y  |  434 --
 intl/relocatable.c |  439 --
 intl/relocatable.h |   67 -
 intl/textdomain.c  |  142 -
 libcpp/aclocal.m4  |5 +
 libcpp/configure   | 2139 -
 libstdc++-v3/configure |  727 +--
 62 files changed, 5467 insertions(+), 21441 deletions(-)
 create mode 100644 config/intlmacosx.m4
 delete mode 100644 intl/ChangeLog
 delete mode 100644 intl/Makefile.in
 delete mode 100644 intl/README
 delete mode 100644 intl/VERSION
 delete mode 100644 intl/aclocal.m4
 delete mode 100644 intl/bindtextdom.c
 delete mode 100644 intl/config.h.in
 delete mode 100644 intl/config.intl.in
 delete mode 100755 intl/configure
 delete mode 100644 intl/configure.ac
 delete mode 100644 intl/dcgettext.c
 delete mode 100644 intl/dcigettext.c
 delete mode 100644 intl/dcngettext.c
 delete mode 100644 intl/dgettext.c
 delete mode 100644 intl/dngettext.c
 delete mode 100644 intl/eval-plural.h
 delete mode 100644 intl/explodename.c
 delete mode 100644 intl/finddomain.c
 delete mode 100644 intl/gettext.c
 delete mode 100644 intl/gettextP.h
 delete mode 100644 intl/gmo.h
 delete mode

[PATCH v3 1/2] intl: remove, in favor of out-of-tree gettext

2023-11-02 Thread Arsen Arsenović
ChangeLog:

* intl/*: Remove.
---
 intl/ChangeLog   |  306 --
 intl/Makefile.in |  264 --
 intl/README  |   21 -
 intl/VERSION |1 -
 intl/aclocal.m4  |   33 -
 intl/bindtextdom.c   |  374 --
 intl/config.h.in |  280 --
 intl/config.intl.in  |   12 -
 intl/configure   | 8288 --
 intl/configure.ac|  108 -
 intl/dcgettext.c |   59 -
 intl/dcigettext.c| 1238 ---
 intl/dcngettext.c|   60 -
 intl/dgettext.c  |   60 -
 intl/dngettext.c |   62 -
 intl/eval-plural.h   |  114 -
 intl/explodename.c   |  192 -
 intl/finddomain.c|  195 -
 intl/gettext.c   |   64 -
 intl/gettextP.h  |  224 --
 intl/gmo.h   |  148 -
 intl/hash-string.h   |   59 -
 intl/intl-compat.c   |  151 -
 intl/l10nflist.c |  453 ---
 intl/libgnuintl.h|  341 --
 intl/loadinfo.h  |  156 -
 intl/loadmsgcat.c| 1322 ---
 intl/localcharset.c  |  398 --
 intl/localcharset.h  |   42 -
 intl/locale.alias|   78 -
 intl/localealias.c   |  419 ---
 intl/localename.c|  772 
 intl/log.c   |  104 -
 intl/ngettext.c  |   68 -
 intl/osdep.c |   24 -
 intl/plural-config.h |1 -
 intl/plural-exp.c|  156 -
 intl/plural-exp.h|  132 -
 intl/plural.c| 1540 
 intl/plural.y|  434 ---
 intl/relocatable.c   |  439 ---
 intl/relocatable.h   |   67 -
 intl/textdomain.c|  142 -
 43 files changed, 19401 deletions(-)
 delete mode 100644 intl/ChangeLog
 delete mode 100644 intl/Makefile.in
 delete mode 100644 intl/README
 delete mode 100644 intl/VERSION
 delete mode 100644 intl/aclocal.m4
 delete mode 100644 intl/bindtextdom.c
 delete mode 100644 intl/config.h.in
 delete mode 100644 intl/config.intl.in
 delete mode 100755 intl/configure
 delete mode 100644 intl/configure.ac
 delete mode 100644 intl/dcgettext.c
 delete mode 100644 intl/dcigettext.c
 delete mode 100644 intl/dcngettext.c
 delete mode 100644 intl/dgettext.c
 delete mode 100644 intl/dngettext.c
 delete mode 100644 intl/eval-plural.h
 delete mode 100644 intl/explodename.c
 delete mode 100644 intl/finddomain.c
 delete mode 100644 intl/gettext.c
 delete mode 100644 intl/gettextP.h
 delete mode 100644 intl/gmo.h
 delete mode 100644 intl/hash-string.h
 delete mode 100644 intl/intl-compat.c
 delete mode 100644 intl/l10nflist.c
 delete mode 100644 intl/libgnuintl.h
 delete mode 100644 intl/loadinfo.h
 delete mode 100644 intl/loadmsgcat.c
 delete mode 100644 intl/localcharset.c
 delete mode 100644 intl/localcharset.h
 delete mode 100644 intl/locale.alias
 delete mode 100644 intl/localealias.c
 delete mode 100644 intl/localename.c
 delete mode 100644 intl/log.c
 delete mode 100644 intl/ngettext.c
 delete mode 100644 intl/osdep.c
 delete mode 100644 intl/plural-config.h
 delete mode 100644 intl/plural-exp.c
 delete mode 100644 intl/plural-exp.h
 delete mode 100644 intl/plural.c
 delete mode 100644 intl/plural.y
 delete mode 100644 intl/relocatable.c
 delete mode 100644 intl/relocatable.h
 delete mode 100644 intl/textdomain.c

patch body dropped - it is just removals


Re: Ping: [PATCH v2 0/2] Replace intl/ with out-of-tree GNU gettext

2023-10-28 Thread Arsen Arsenović
Hi Iain,

Iain Sandoe  writes:

> Hi Arsen,
>
>> On 28 Oct 2023, at 10:22, Arsen Arsenović  wrote:
>
>> Andrew Pinski  writes:
>> 
>>> One comment from me. It would be nice to update install.texi in
>>> gcc/doc/ to make a mention of this requirement for non-glibc hosts.
>> 
>> What do you think of the following:
>
> The hiccup for me is that we need to mention that libintl is provided by a 
> package
> with a different name, that might not be obvious to someone unfamiliar with 
> this.

I'll throw in "provided by GNU gettext"

>> 
>> 
>> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
>> index a17016cd8977..e5137f9d7a1b 100644
>> --- a/gcc/doc/install.texi
>> +++ b/gcc/doc/install.texi
>> @@ -2215,6 +2215,11 @@ which lets GCC output diagnostics in languages other 
>> than American
>> English.  Native Language Support is enabled by default if not doing a
>> canadian cross build.  The @option{--disable-nls} option disables NLS@.
>> 
>> +Note that this functionality requires either libintl or C standard
>> +library that contains support for gettext (such as the GNU C Library).
> s/gettext/NLS/

Hmm, I was referring to the library function here, which matches the
table this sentence references (which names a column 'gettext present in
libc').

> +If your installation does not provide either, libibtl can be provided by the 
> gettext package 
>> +@xref{with-included-gettext,,--with-included-gettext} for more
> “see …"

@xref inserts 'See '
>> +information on the conditions required to get gettext support.
>
> information on the options for providing gettext {as part of the
> build?}

The table is more general.  It covers what happens with/without gettext
in-tree, with/without libintl on the system, with/without gettext in
libc and when passing --with/out-included-gettext.

Thanks, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: Ping: [PATCH v2 0/2] Replace intl/ with out-of-tree GNU gettext

2023-10-28 Thread Arsen Arsenović
Hi Andrew,

Andrew Pinski  writes:

> One comment from me. It would be nice to update install.texi in
> gcc/doc/ to make a mention of this requirement for non-glibc hosts.

What do you think of the following:


diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index a17016cd8977..e5137f9d7a1b 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2215,6 +2215,11 @@ which lets GCC output diagnostics in languages other 
than American
 English.  Native Language Support is enabled by default if not doing a
 canadian cross build.  The @option{--disable-nls} option disables NLS@.
 
+Note that this functionality requires either libintl or C standard
+library that contains support for gettext (such as the GNU C Library).
+@xref{with-included-gettext,,--with-included-gettext} for more
+information on the conditions required to get gettext support.
+
 @item --with-libintl-prefix=@var{dir}
 @itemx --without-libintl-prefix
 Searches for libintl in @file{@var{dir}/include} and
@@ -2225,6 +2230,7 @@ linker handle it.
 Specifies the type of library to search for when looking for libintl.
 @var{type} can be one of @code{auto}, @code{static} or @code{shared}.
 
+@anchor{with-included-gettext}
 @item --with-included-gettext
 Only available if @file{gettext} is present in the source tree.

Thanks.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping^2: [PATCH v2 0/2] Replace intl/ with out-of-tree GNU gettext

2023-10-26 Thread Arsen Arsenović
Ping^2

It'd be nice to get this patch into 14 (given the intended C strictness
changes, especially).

Have a lovely evening.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-10-22 Thread Arsen Arsenović

"Paul M. Bendixen"  writes:

> Updated patch, added the requested files, hopefully wrote the commit better.

LGTM.  Jonathan?
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping: [PATCH v2 0/2] Replace intl/ with out-of-tree GNU gettext

2023-10-15 Thread Arsen Arsenović
Evening,

Arsen Arsenović  writes:

> Afternoon,
>
> This patch is a rebase and rewording of
> https://inbox.sourceware.org/20230925150921.894157-1-ar...@aarsen.me/
>
> Changes since v1:
> - Implement Brunos suggested changes to install.texi.
> - Elaborate commit message in p2 (as requested by the Binutils
>   maintainers).
>
> Arsen Arsenović (2):
>   intl: remove, in favor of out-of-tree gettext
>   *: add modern gettext
>

Ping on this patch series.

TIA, have a lovely night :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 2/2] *: add modern gettext

2023-10-06 Thread Arsen Arsenović
Hi Bruno,

Bruno Haible  writes:

>> * intlmacosx.m4: Import from gettext-0.22 (serial 8).
>
> A further suggestion (can be done in a separate patch, later):
>
> Use intlmacosx.m4 from gettext-0.22.3 (serial 9).
>
> This version enables portability to macOS 14, which was released
> on 2023-09-26. (Older versions of libintl crash on macOS 14, due
> to an incompatible change in macOS.) [1]

Thanks.  I'll update before pushing.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2 0/2] Replace intl/ with out-of-tree GNU gettext

2023-10-06 Thread Arsen Arsenović
Afternoon,

This patch is a rebase and rewording of
https://inbox.sourceware.org/20230925150921.894157-1-ar...@aarsen.me/

Changes since v1:
- Implement Brunos suggested changes to install.texi.
- Elaborate commit message in p2 (as requested by the Binutils
  maintainers).

Arsen Arsenović (2):
  intl: remove, in favor of out-of-tree gettext
  *: add modern gettext

 .gitignore |1 +
 Makefile.def   |   72 +-
 Makefile.in| 1612 +++
 config/gettext-sister.m4   |   35 +-
 config/gettext.m4  |  357 +-
 config/iconv.m4|  313 +-
 config/intlmacosx.m4   |   65 +
 configure  |   44 +-
 configure.ac   |   44 +-
 contrib/download_prerequisites |2 +
 contrib/prerequisites.md5  |1 +
 contrib/prerequisites.sha512   |1 +
 gcc/Makefile.in|8 +-
 gcc/aclocal.m4 |4 +
 gcc/configure  | 2001 +++-
 gcc/doc/install.texi   |   65 +-
 intl/ChangeLog |  306 --
 intl/Makefile.in   |  264 -
 intl/README|   21 -
 intl/VERSION   |1 -
 intl/aclocal.m4|   33 -
 intl/bindtextdom.c |  374 --
 intl/config.h.in   |  280 --
 intl/config.intl.in|   12 -
 intl/configure | 8288 
 intl/configure.ac  |  108 -
 intl/dcgettext.c   |   59 -
 intl/dcigettext.c  | 1238 -
 intl/dcngettext.c  |   60 -
 intl/dgettext.c|   60 -
 intl/dngettext.c   |   62 -
 intl/eval-plural.h |  114 -
 intl/explodename.c |  192 -
 intl/finddomain.c  |  195 -
 intl/gettext.c |   64 -
 intl/gettextP.h|  224 -
 intl/gmo.h |  148 -
 intl/hash-string.h |   59 -
 intl/intl-compat.c |  151 -
 intl/l10nflist.c   |  453 --
 intl/libgnuintl.h  |  341 --
 intl/loadinfo.h|  156 -
 intl/loadmsgcat.c  | 1322 -
 intl/localcharset.c|  398 --
 intl/localcharset.h|   42 -
 intl/locale.alias  |   78 -
 intl/localealias.c |  419 --
 intl/localename.c  |  772 ---
 intl/log.c |  104 -
 intl/ngettext.c|   68 -
 intl/osdep.c   |   24 -
 intl/plural-config.h   |1 -
 intl/plural-exp.c  |  156 -
 intl/plural-exp.h  |  132 -
 intl/plural.c  | 1540 --
 intl/plural.y  |  434 --
 intl/relocatable.c |  439 --
 intl/relocatable.h |   67 -
 intl/textdomain.c  |  142 -
 libcpp/aclocal.m4  |5 +
 libcpp/configure   | 2139 -
 libstdc++-v3/configure |  727 +--
 62 files changed, 5456 insertions(+), 21441 deletions(-)
 create mode 100644 config/intlmacosx.m4
 delete mode 100644 intl/ChangeLog
 delete mode 100644 intl/Makefile.in
 delete mode 100644 intl/README
 delete mode 100644 intl/VERSION
 delete mode 100644 intl/aclocal.m4
 delete mode 100644 intl/bindtextdom.c
 delete mode 100644 intl/config.h.in
 delete mode 100644 intl/config.intl.in
 delete mode 100755 intl/configure
 delete mode 100644 intl/configure.ac
 delete mode 100644 intl/dcgettext.c
 delete mode 100644 intl/dcigettext.c
 delete mode 100644 intl/dcngettext.c
 delete mode 100644 intl/dgettext.c
 delete mode 100644 intl/dngettext.c
 delete mode 100644 intl/eval-plural.h
 delete mode 100644 intl/explodename.c
 delete mode 100644 intl/finddomain.c
 delete mode 100644 intl/gettext.c
 delete mode 100644 intl/gettextP.h
 delete mode 100644 intl/gmo.h
 delete mode 100644 intl/hash-string.h
 delete mode 100644 intl/intl-compat.c
 delete mode 100644 intl/l10nflist.c
 delete mode 100644 intl/libgnuintl.h
 delete mode 100644 intl/loadinfo.h
 delete mode 100644 intl/loadmsgcat.c
 delete mode 100644 intl/localcharset.c
 delete mode 100644 intl/localcharset.h
 delete mode 100644 intl/locale.alias
 delete mode 100644 intl/localealias.c
 delete mode 100644 intl/localename.c
 delete mode 100644 intl/log.c
 delete mode 100644 intl/ngettext.c
 delete mode 100644 intl/osdep.c
 delete mode 100644 intl/plural-config.h
 delete mode 100644 intl/plural-exp.c
 delete mode 100644 intl/plural-exp.h
 delete mode 100644 intl/plural.c
 delete mode 100644 intl/plural.y
 delete mode 100644 intl/relocatable.c
 delete mode 100644 intl/relocatable.h
 delete mode 100644 intl/textdomain.c

-- 
2.42.0



[PATCH v2 1/2] intl: remove, in favor of out-of-tree gettext

2023-10-06 Thread Arsen Arsenović
ChangeLog:

* intl: Remove directory.  Replaced with out-of-tree GNU
gettext.
---
Note that the commit message here doesn't pass the changelog verifier.
What should I reword it as?  mklog suggests:

ChangeLog:

* intl/ChangeLog: Removed.
* intl/Makefile.in: Removed.
* intl/README: Removed.
* intl/VERSION: Removed.
* intl/aclocal.m4: Removed.
* intl/bindtextdom.c: Removed.
* intl/config.h.in: Removed.
* intl/config.intl.in: Removed.
* intl/configure: Removed.
* intl/configure.ac: Removed.
* intl/dcgettext.c: Removed.
* intl/dcigettext.c: Removed.
* intl/dcngettext.c: Removed.
* intl/dgettext.c: Removed.
* intl/dngettext.c: Removed.
* intl/eval-plural.h: Removed.
* intl/explodename.c: Removed.
* intl/finddomain.c: Removed.
* intl/gettext.c: Removed.
* intl/gettextP.h: Removed.
* intl/gmo.h: Removed.
* intl/hash-string.h: Removed.
* intl/intl-compat.c: Removed.
* intl/l10nflist.c: Removed.
* intl/libgnuintl.h: Removed.
* intl/loadinfo.h: Removed.
* intl/loadmsgcat.c: Removed.
* intl/localcharset.c: Removed.
* intl/localcharset.h: Removed.
* intl/locale.alias: Removed.
* intl/localealias.c: Removed.
* intl/localename.c: Removed.
* intl/log.c: Removed.
* intl/ngettext.c: Removed.
* intl/osdep.c: Removed.
* intl/plural-config.h: Removed.
* intl/plural-exp.c: Removed.
* intl/plural-exp.h: Removed.
* intl/plural.c: Removed.
* intl/plural.y: Removed.
* intl/relocatable.c: Removed.
* intl/relocatable.h: Removed.
* intl/textdomain.c: Removed.

 intl/ChangeLog   |  306 --
 intl/Makefile.in |  264 --
 intl/README  |   21 -
 intl/VERSION |1 -
 intl/aclocal.m4  |   33 -
 intl/bindtextdom.c   |  374 --
 intl/config.h.in |  280 --
 intl/config.intl.in  |   12 -
 intl/configure   | 8288 --
 intl/configure.ac|  108 -
 intl/dcgettext.c |   59 -
 intl/dcigettext.c| 1238 ---
 intl/dcngettext.c|   60 -
 intl/dgettext.c  |   60 -
 intl/dngettext.c |   62 -
 intl/eval-plural.h   |  114 -
 intl/explodename.c   |  192 -
 intl/finddomain.c|  195 -
 intl/gettext.c   |   64 -
 intl/gettextP.h  |  224 --
 intl/gmo.h   |  148 -
 intl/hash-string.h   |   59 -
 intl/intl-compat.c   |  151 -
 intl/l10nflist.c |  453 ---
 intl/libgnuintl.h|  341 --
 intl/loadinfo.h  |  156 -
 intl/loadmsgcat.c| 1322 ---
 intl/localcharset.c  |  398 --
 intl/localcharset.h  |   42 -
 intl/locale.alias|   78 -
 intl/localealias.c   |  419 ---
 intl/localename.c|  772 
 intl/log.c   |  104 -
 intl/ngettext.c  |   68 -
 intl/osdep.c |   24 -
 intl/plural-config.h |1 -
 intl/plural-exp.c|  156 -
 intl/plural-exp.h|  132 -
 intl/plural.c| 1540 
 intl/plural.y|  434 ---
 intl/relocatable.c   |  439 ---
 intl/relocatable.h   |   67 -
 intl/textdomain.c|  142 -
 43 files changed, 19401 deletions(-)
 delete mode 100644 intl/ChangeLog
 delete mode 100644 intl/Makefile.in
 delete mode 100644 intl/README
 delete mode 100644 intl/VERSION
 delete mode 100644 intl/aclocal.m4
 delete mode 100644 intl/bindtextdom.c
 delete mode 100644 intl/config.h.in
 delete mode 100644 intl/config.intl.in
 delete mode 100755 intl/configure
 delete mode 100644 intl/configure.ac
 delete mode 100644 intl/dcgettext.c
 delete mode 100644 intl/dcigettext.c
 delete mode 100644 intl/dcngettext.c
 delete mode 100644 intl/dgettext.c
 delete mode 100644 intl/dngettext.c
 delete mode 100644 intl/eval-plural.h
 delete mode 100644 intl/explodename.c
 delete mode 100644 intl/finddomain.c
 delete mode 100644 intl/gettext.c
 delete mode 100644 intl/gettextP.h
 delete mode 100644 intl/gmo.h
 delete mode 100644 intl/hash-string.h
 delete mode 100644 intl/intl-compat.c
 delete mode 100644 intl/l10nflist.c
 delete mode 100644 intl/libgnuintl.h
 delete mode 100644 intl/loadinfo.h
 delete mode 100644 intl/loadmsgcat.c
 delete mode 100644 intl/localcharset.c
 delete mode 100644 intl/localcharset.h
 delete mode 100644 intl/locale.alias
 delete mode 100644 intl/localealias.c
 delete mode 100644 intl/localename.c
 delete mode 100644 intl/log.c
 delete mode 100644 intl/ngettext.c
 delete mode 100644 intl/osdep.c
 delete mode 100644 intl/plural-config.h
 delete mode 100644 intl/plural-exp.c
 delete mode 100644 intl/plural-exp.h
 delete mode 100644 intl/plural.c
 delete mode 100644 intl/plural.y
 delete mode 100644 intl/relocatable.c
 delete mode 100644 intl/relocatable.h
 delete mode 100644 intl/textdomain.c

patch body dropped - it is just removals
-- 
2.42.0



Re: [PATCH 0/2] Replace intl/ with out-of-tree GNU gettext

2023-09-29 Thread Arsen Arsenović

Bruno Haible  writes:

> Arsen Arsenović wrote:
>> -+The in-tree configuration requires GNU gettext v0.22.
>
> Can you change this to "... requires GNU gettext version 0.22 or newer.", 
> please?
> I wouldn't like to give the impression that a particular release (0.22) is the
> only one that works.
> Also, some people may understand 'v' as meaning "version", but some may not.

Certainly, good idea.  Thanks for the notes.

>> +Forces the gettext tree to be configured to build and use a new static
>> +libintl, overriding the system libintl.
>
> This sounds like it has no effects on the GCC tree, only on the gettext
> tree. Surely that's not the intention?

Hmm, well, it has no primary effect on the gettext tree, only the
secondary effect of 'if gettext is configured with this flag, then other
parts of the source tree use included over system gettext'.


Do you like the following?

@@ -486,7 +486,7 @@ found in a subdirectory of your GCC sources
 will be built together with GCC, unless present in the system (either in
 libc or as a stand-alone library).
 
-The in-tree configuration requires GNU gettext v0.22.
+The in-tree configuration requires GNU gettext version 0.22 or later.
 
 @end table
 
@@ -2229,7 +2229,8 @@ Specifies the type of library to search
 Only available if @file{gettext} is present in the source tree.
 
 Forces the gettext tree to be configured to build and use a new static
-libintl, overriding the system libintl.
+libintl, overriding the system libintl.  Results in GCC being built
+against the newly built libintl rather than the system libintl.
 
 @item --with-catgets
 If NLS is enabled, and if the host lacks @code{gettext} but has the

I'm open to better wording in the hunk 2 paragraph.

>>--with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and 
>> DIR/lib
>>--without-libiconv-prefix don't search for libiconv in includedir and 
>> libdir
>>--with-libiconv-type=TYPE type of library to search for 
>> (auto/static/shared)
>> +  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
>> +  --without-libintl-prefix don't search for libintl in includedir and 
>> libdir
>> +  --with-libintl-type=TYPE type of library to search for 
>> (auto/static/shared)
>
> It looks like an additional space in the middle of the last three lines would
> provide a better alignment for the 'configure --help' output.

Hmm, I thought that AS_HELP_STRING handles that..  These flags are
(AFAIK) from inside AM_GNU_GETTEXT, so I'm unsure on how to change this
formatting properly.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 0/2] Replace intl/ with out-of-tree GNU gettext

2023-09-25 Thread Arsen Arsenović

Xi Ruoyao  writes:

> On Mon, 2023-09-25 at 17:00 +0200, Arsen Arsenović wrote:
>> Afternoon,
>> 
>> This patch series replaces the old (early 2000s era, AFAICT) libintl
>> implementation in-tree, which relies on C constructs some compilers
>> (newer clang, hopefully GCC 14) refuse to compile by default with
>> out-of-tree gettext, in a manner similar to GMP et al, and adds gettext
>> to download_prerequisites.
>
> I think we need to update install.texi to mention the new dependency.

Ah, thanks.  I had forgotten to update it.  What do you think of the
following prose?

1:  2ac5c8240c0f ! 1:  2cc0029921fb *: add modern gettext
@@ Commit message
 * aclocal.m4: Regenerate.
 * Makefile.in (LIBDEPS): Remove (potential) ./ prefix from
 LIBINTL_DEP.
-* doc/install.texi: Document new (notable) flags added by the 
optional
-gettext tree and by AM_GNU_GETTEXT.
 
 libcpp/ChangeLog:
 
@@ gcc/configure: $as_echo "$as_me: executing $ac_file commands" >&6;}
  "collect-ld":F) chmod +x collect-ld ;;
  "nm":F) chmod +x nm ;;
 
- ## gcc/doc/install.texi ##
-@@ gcc/doc/install.texi: is shown below:
- @code{sys} and @code{time}.
- @end table
- 
-+@item GNU gettext
-+
-+Necessary to build GCC with internationalization support via
-+@option{--enable-nls}.  It can be downloaded from
-+@uref{https://gnu.org/s/gettext/}.  If a GNU gettext distribution is
-+found in a subdirectory of your GCC sources named @file{gettext}, it
-+will be built together with GCC, unless present in the system (either in
-+libc or as a stand-alone library).
-+
-+The in-tree configuration requires GNU gettext v0.22.
-+
- @end table
- 
- @heading Tools/packages necessary for modifying GCC
-@@ gcc/doc/install.texi: components of the binutils you intend to build 
alongside the compiler
- (@file{bfd}, @file{binutils}, @file{gas}, @file{gprof}, @file{ld},
- @file{opcodes}, @dots{}) to the directory containing the GCC sources.
- 
--Likewise the GMP, MPFR and MPC libraries can be automatically built
--together with GCC.  You may simply run the
-+Likewise the GMP, MPFR, MPC and Gettext libraries can be automatically
-+built together with GCC.  You may simply run the
- @command{contrib/download_prerequisites} script in the GCC source 
directory
- to set up everything.
--Otherwise unpack the GMP, MPFR and/or MPC source
-+Otherwise unpack the GMP, MPFR, MPC and/or Gettext source
- distributions in the directory containing the GCC sources and rename
--their directories to @file{gmp}, @file{mpfr} and @file{mpc},
--respectively (or use symbolic links with the same name).
-+their directories to @file{gmp}, @file{mpfr}, @file{mpc} and
-+@file{gettext}, respectively (or use symbolic links with the same name).
- 
- @html
- 
-@@ gcc/doc/install.texi: which lets GCC output diagnostics in languages 
other than American
- English.  Native Language Support is enabled by default if not doing a
- canadian cross build.  The @option{--disable-nls} option disables NLS@.
- 
-+@item --with-libintl-prefix=@var{dir}
-+@itemx --without-libintl-prefix
-+Searches for libintl in @file{@var{dir}/include} and
-+@file{@var{dir}/lib}, or disables manual searching for it, letting the
-+linker handle it.
-+
-+@item --with-libintl-type=@var{type}
-+Specifies the type of library to search for when looking for libintl.
-+@var{type} can be one of @code{auto}, @code{static} or @code{shared}.
-+
- @item --with-included-gettext
--If NLS is enabled, the @option{--with-included-gettext} option causes the 
build
--procedure to prefer its copy of GNU @command{gettext}.
-+Only available if @file{gettext} is present in the source tree.
-+
-+Forces the gettext tree to be configured to build and use a new static
-+libintl, overriding the system libintl.
- 
- @item --with-catgets
- If NLS is enabled, and if the host lacks @code{gettext} but has the
-
  ## libcpp/aclocal.m4 ##
 @@ libcpp/aclocal.m4: m4_include([../config/codeset.m4])
  m4_include([../config/depstand.m4])

Perhaps this is easier to read when not a range-diff..
https://git.sr.ht/~arsen/gcc/commit/2ac5c8240c0f1a670f100c8e38baf40b13cc50b2#gcc/doc/install.texi

> And IIUC if --disable-nls is used, we can still build GCC with neither
> system gettext nor in-tree gettext.  Or am I wrong?  (I'm asking because
> we'll need to adjust Linux From Scratch [1-3] for this change if it's
> applied.)

Yes, this doesn't change how --disable-nls works.

> [1]:https://www.linuxfromscratch.org/lfs/view/development/chapter05/gcc-pass1.html
> [2]:https://www.linuxfromscratch.org

[PATCH 0/2] Replace intl/ with out-of-tree GNU gettext

2023-09-25 Thread Arsen Arsenović
Afternoon,

This patch series replaces the old (early 2000s era, AFAICT) libintl
implementation in-tree, which relies on C constructs some compilers
(newer clang, hopefully GCC 14) refuse to compile by default with
out-of-tree gettext, in a manner similar to GMP et al, and adds gettext
to download_prerequisites.

Regstrapped on x86_64-pc-linux-gnu --with-included-gettext and all
languages enabled.  Tested for localization on x86_64-pc-linux-gnu,
x86_64-unknown-freebsd13.2, x86_64-darwin21, i686-darwin9 (thanks,
Iain!).

Example from FreeBSD:

  [arsen@fbsd132 ~/gcc-bld/_pfx/bin]$ LANG=sr_RS.UTF-8 ./gcc
  gcc: кобна грешка: нема улазних датотека
  компиловање прекинуто.
  [arsen@fbsd132 ~/gcc-bld/_pfx/bin]$ ldd ./gcc
  ./gcc:
libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x258b24264000)
libm.so.5 => /lib/libm.so.5 (0x258b2314b000)
libc.so.7 => /lib/libc.so.7 (0x258b25acc000)
[vdso] (0x7fffe5d0)

OK for trunk (if passing review on the binutils and GDB sides)?

Thanks in advance, have a lovely day.

Arsen Arsenović (2):
  intl: remove, in favor of out-of-tree gettext
  *: add modern gettext

 .gitignore |1 +
 Makefile.def   |   72 +-
 Makefile.in| 1612 +++
 config/gettext-sister.m4   |   35 +-
 config/gettext.m4  |  357 +-
 config/iconv.m4|  313 +-
 config/intlmacosx.m4   |   65 +
 configure  |   44 +-
 configure.ac   |   44 +-
 contrib/download_prerequisites |2 +
 contrib/prerequisites.md5  |1 +
 contrib/prerequisites.sha512   |1 +
 gcc/Makefile.in|8 +-
 gcc/aclocal.m4 |4 +
 gcc/configure  | 2001 +++-
 intl/ChangeLog |  306 --
 intl/Makefile.in   |  264 -
 intl/README|   21 -
 intl/VERSION   |1 -
 intl/aclocal.m4|   33 -
 intl/bindtextdom.c |  374 --
 intl/config.h.in   |  280 --
 intl/config.intl.in|   12 -
 intl/configure | 8288 
 intl/configure.ac  |  108 -
 intl/dcgettext.c   |   59 -
 intl/dcigettext.c  | 1238 -
 intl/dcngettext.c  |   60 -
 intl/dgettext.c|   60 -
 intl/dngettext.c   |   62 -
 intl/eval-plural.h |  114 -
 intl/explodename.c |  192 -
 intl/finddomain.c  |  195 -
 intl/gettext.c |   64 -
 intl/gettextP.h|  224 -
 intl/gmo.h |  148 -
 intl/hash-string.h |   59 -
 intl/intl-compat.c |  151 -
 intl/l10nflist.c   |  453 --
 intl/libgnuintl.h  |  341 --
 intl/loadinfo.h|  156 -
 intl/loadmsgcat.c  | 1322 -
 intl/localcharset.c|  398 --
 intl/localcharset.h|   42 -
 intl/locale.alias  |   78 -
 intl/localealias.c |  419 --
 intl/localename.c  |  772 ---
 intl/log.c |  104 -
 intl/ngettext.c|   68 -
 intl/osdep.c   |   24 -
 intl/plural-config.h   |1 -
 intl/plural-exp.c  |  156 -
 intl/plural-exp.h  |  132 -
 intl/plural.c  | 1540 --
 intl/plural.y  |  434 --
 intl/relocatable.c |  439 --
 intl/relocatable.h |   67 -
 intl/textdomain.c  |  142 -
 libcpp/aclocal.m4  |5 +
 libcpp/configure   | 2139 -
 libstdc++-v3/configure |  727 +--
 61 files changed, 5398 insertions(+), 21434 deletions(-)
 create mode 100644 config/intlmacosx.m4
 delete mode 100644 intl/ChangeLog
 delete mode 100644 intl/Makefile.in
 delete mode 100644 intl/README
 delete mode 100644 intl/VERSION
 delete mode 100644 intl/aclocal.m4
 delete mode 100644 intl/bindtextdom.c
 delete mode 100644 intl/config.h.in
 delete mode 100644 intl/config.intl.in
 delete mode 100755 intl/configure
 delete mode 100644 intl/configure.ac
 delete mode 100644 intl/dcgettext.c
 delete mode 100644 intl/dcigettext.c
 delete mode 100644 intl/dcngettext.c
 delete mode 100644 intl/dgettext.c
 delete mode 100644 intl/dngettext.c
 delete mode 100644 intl/eval-plural.h
 delete mode 100644 intl/explodename.c
 delete mode 100644 intl/finddomain.c
 delete mode 100644 intl/gettext.c
 delete mode 100644 intl/gettextP.h
 delete mode 100644 intl/gmo.h
 delete mode 100644 intl/hash-string.h
 delete mode 100644 intl/intl-compat.c
 delete mode 100644 intl/l10nflist.c
 delete mode 100644 intl/libgnuintl.h
 delete mode 100644 intl/loadinfo.h
 delete mode 100644 intl/loadmsgcat.c
 delete mode 100644 intl/localcharset.c
 delete mode 100644 intl/localcharset.h
 delete mode 100644 intl/locale.alias
 delete mode 100644 intl/localealias.c
 delete mo

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-15 Thread Arsen Arsenović via Gcc-patches

Qing Zhao  writes:

> Even though unsigned integer overflow is well defined, it might be
> unintentional, shall we warn user about this?

This would be better addressed by providing operators or functions that
do overflow checking in the language, so that they can be explicitly
used where overflow is unexpected.  One could easily imagine a scenario
where overflow is not expected in some region of code but is in the
larger application.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [Patch] contrib/gcc-changelog: Check whether revert-commit exists

2023-09-05 Thread Arsen Arsenović via Gcc-patches

Tobias Burnus  writes:

> Attached an old patch. See attached patch for the current one.
>
> Difference is one line: the warning that is shown in the example output
> below.

Python-wise, the changes seem fine.  Unsure if it does the right thing,
though, since I'm not familiar with the full script.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-16 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
>  wrote:
>>
>> P1642 includes the header cstdarg to the freestanding implementation.
>> This was probably left out by accident, this patch puts it in.
>> Since this is one of the headers that go in whole cloth, there should be no
>> further actions needed.
>
> Thanks for the patch. I agree that  should be freestanding,
> but I think  and  were also missed from the
> change. Arsen?

Indeed, we should include all three, and according to [compliance],
there's a couple more headers that we should provide (cwchar, cstring,
cerrno, and cmath, but these are probably significantly more involved,
so we can handle them separately).

As guessed, the omission was not intentional.

If you could, add those two to the patch as well, edit Makefile.am and
regenerate using automake 1.15.1, and see
https://gcc.gnu.org/contribute.html wrt. changelogs in commit messages.

Thank you!  Have a lovely day :-)

[compliance]: https://eel.is/c++draft/compliance

> Also, the patch should change include/Makefile.am as well (the .in
> file is autogenerated from that one).
>
>
>> This might be related to PR106953, but since that one touches the partial
>> headers I'm not sure

The headers mentioned in this PR are provided in freestanding,
partially, in 13 already, indeed.

>> /Paul M. Bendixen
>>
>> --
>> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
>> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-16 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> [..snip..]
> Thanks for adding the comments like "// C++ < 20".
>
> I think in  the comment on the #endif can be just __cpp_lib_any
> rather than defined(__cpp_lib_any). Similarly for
> __cpp_lib_atomic_float in . Oh, and __cpp_lib_atomic_ref. And
> in , and several others. I think I'd like those to be
> consistent, and usually we just name the macro in the #endif comment,
> sometimes abbreviated for clarity, without the explicit defined(...).

ACK.  Fixed all of those.

> For this error in  please add <> around "version" and remove
> the question mark:
> +# error "libstdc++ bug: no lock-free atomics but they were emitted in 
> version?"
>
> Similarly, please remove the question marks from the two #errors in
> :
> +#  error "libstdc++ bug: is_corresponding_member and
> is_layout_compatible are provided but their FTM is not set?"
> +#  error "libstdc++ bug: is_pointer_interconvertible available but FTM 
> unset?"
>
> In  you have:
> +# error "libstdc++ bug: string_contents not defined when it should be"
> That should be contains, not contents.
>
> OK for trunk with the #error changes. The #endif cleanup can be
> fixed in a follow-up.
> 
> It seems like there's some inconsistency (probably some preexisting)
> about whether you use:
> #if __cpp_lib_xxx
> or
> #ifdef __cpp_lib_xxx
> That can be tidied up later.
>
> Currently we define many of the macros in the "bits" headers, e.g. in
> bits/stl_iterator.h
>
> +#define __glibcxx_want_constexpr_iterator
> +#define __glibcxx_want_array_constexpr
> +#define __glibcxx_want_make_reverse_iterator
> +#define __glibcxx_want_move_iterator_concept
> +#include 
>
> We should consider only defining those in  itself. So that
> when other parts of the lib include bits/stl_iterator.h they don't
> define the macros. That would mean that
> __cpp_lib_make_reverse_iterator is not defined by  and
> , for example. Even though they do actually provide the
> features, the macro would only be defined by  and .
> This might encourage users to include the right headers, instead of
> relying on transitive includes.

> If we do that, our own internal checks for features would all need to use:
> #if __glibcxx_make_reverse_iterator
> because they wouldn't have the __cpp_lib_xxx macro, because they only
> include the internal bits header not .
>
> That's for another day though.

Yes, that sounds quite reasonable.  I like the idea that headers should
export narrower FTMs.

Pushed.  Thanks :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-14 Thread Arsen Arsenović via Gcc-patches

Arsen Arsenović  writes:

> This commit replaces the ad-hoc logic in  with an AutoGen
> database that (mostly) declaratively generates a version.h bit which
> combines all of the FTM logic across all headers together.
>
> This generated header defines macros of the form __glibcxx_foo,
> equivalent to their __cpp_lib_foo variants, according to rules specified
> in version.def and, optionally, if __glibcxx_want_foo or
> __glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
> the same definition.
>
> libstdc++-v3/ChangeLog:
>
>   * include/Makefile.am (bits_freestanding): Add version.h.
>   (allcreated): Add version.h.
>   (${bits_srcdir}/version.h): New rule.  Regenerates
>   version.h out of version.{def,tpl}.
>   * include/Makefile.in: Regenerate.
>   * include/bits/version.def: New file.  Declares a list of
>   all feature test macros, their values and their preconditions.
>   * include/bits/version.tpl: New file.  Turns version.def
>   into a sequence of #if blocks.
>   * include/bits/version.h: New file.  Generated from
>   version.def.
>   * include/std/version: Replace with a __glibcxx_want_all define
>   and bits/version.h include.
> ---
> This patchset is a rebase of
> https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-ar...@aarsen.me/
>
> ... passing the same two checks (difall / vercmp) I wrote for the first
> pass.  Testsuite runs are still pending.
>
> Changes in this revision:
> - Replace the ${bits_srcdir}/version.h rule with a update-version phony,
> - Add the new __cpp_lib_chrono value,
> - Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
> - Add comments to various replaced conditions which summarize their
>   condition,
> - Correct a few minor errors spotted in review
>
> OK for trunk (if those testsuite runs end up clean)?

Same tests as the first time around passed on x86_64-pc-linux-gnu (that
is, regression testing + a large libstdc++ harness).
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-13 Thread Arsen Arsenović via Gcc-patches
This commit replaces the ad-hoc logic in  with an AutoGen
database that (mostly) declaratively generates a version.h bit which
combines all of the FTM logic across all headers together.

This generated header defines macros of the form __glibcxx_foo,
equivalent to their __cpp_lib_foo variants, according to rules specified
in version.def and, optionally, if __glibcxx_want_foo or
__glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
the same definition.

libstdc++-v3/ChangeLog:

* include/Makefile.am (bits_freestanding): Add version.h.
(allcreated): Add version.h.
(${bits_srcdir}/version.h): New rule.  Regenerates
version.h out of version.{def,tpl}.
* include/Makefile.in: Regenerate.
* include/bits/version.def: New file.  Declares a list of
all feature test macros, their values and their preconditions.
* include/bits/version.tpl: New file.  Turns version.def
into a sequence of #if blocks.
* include/bits/version.h: New file.  Generated from
version.def.
* include/std/version: Replace with a __glibcxx_want_all define
and bits/version.h include.
---
This patchset is a rebase of
https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-ar...@aarsen.me/

... passing the same two checks (difall / vercmp) I wrote for the first
pass.  Testsuite runs are still pending.

Changes in this revision:
- Replace the ${bits_srcdir}/version.h rule with a update-version phony,
- Add the new __cpp_lib_chrono value,
- Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
- Add comments to various replaced conditions which summarize their
  condition,
- Correct a few minor errors spotted in review

OK for trunk (if those testsuite runs end up clean)?

 libstdc++-v3/include/Makefile.am  |   10 +-
 libstdc++-v3/include/Makefile.in  |   10 +-
 libstdc++-v3/include/bits/version.def | 1597 
 libstdc++-v3/include/bits/version.h   | 1942 +
 libstdc++-v3/include/bits/version.tpl |  210 +++
 libstdc++-v3/include/std/version  |  350 +
 6 files changed, 3770 insertions(+), 349 deletions(-)
 create mode 100644 libstdc++-v3/include/bits/version.def
 create mode 100644 libstdc++-v3/include/bits/version.h
 create mode 100644 libstdc++-v3/include/bits/version.tpl

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index a880e8ee227..9c71c75393a 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -154,6 +154,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1113,7 +1114,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 # Here are the rules for building the headers
 all-local: ${allstamped} ${allcreated}
@@ -1463,6 +1465,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+.PHONY: update-version
+update-version:
+   cd ${bits_srcdir} && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0ff875b280b..f5b04d3fe8a 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -509,6 +509,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1441,7 +1442,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 
 # Host includes for threads
@@ -1937,6 +1939,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+${bits_srcdir}/version.h: ${bits_srcdir}/version.def \
+   ${bits_srcdir}/version.tpl
+   cd $(@D) && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
new file mode 100644
index 000..e63715e17e7
--- /dev/null
+++ 

Re: [PATCHv2] Use toplevel configure for GMP and MPFR for gdb

2023-08-10 Thread Arsen Arsenović via Gcc-patches

Matthias Klose via Gcc-patches  writes:

> On 10.11.22 20:05, apinski--- via Binutils wrote:
>> From: Andrew Pinski 
>> This patch uses the toplevel configure parts for GMP/MPFR for
>> gdb. The only thing is that gdb now requires MPFR for building.
>> Before it was a recommended but not required library.
>> Also this allows building of GMP and MPFR with the toplevel
>> directory just like how it is done for GCC.
>> We now error out in the toplevel configure of the version
>> of GMP and MPFR that is wrong.
>> OK after GDB 13 branches? Build gdb 3 ways:
>> with GMP and MPFR in the toplevel (static library used at that point for 
>> both)
>> With only MPFR in the toplevel (GMP distro library used and MPFR built from 
>> source)
>> With neither GMP and MPFR in the toplevel (distro libraries used)
>
> this still seems to be broken for a gdb trunk build, using GMP and MPFR system
> libraries:
>
> linking gdb:
>
> [...]
> ../gnulib/import/libgnu.a   -Lyes/lib -lmpfr -lgmp -lsource-highlight
> -lboost_regex  -lxxhash  -ldebuginfod   -ldl
> -Wl,--dynamic-list=/<>/gdb/proc-service.list
> ./libtool: line 5209: cd: yes/lib: No such file or directory
> libtool: link: cannot determine absolute directory name of `yes/lib'
> make[3]: *** [Makefile:2174: gdb] Error 1
> make[3]: Leaving directory '/<>/build/default/gdb'
>
> full build log at
> https://launchpad.net/~doko/+archive/ubuntu/toolchain/+sourcepub/15065515/+listing-archive-extra
>
>
> the toplevel config.log has:
>
> configure:8183: checking for the correct version of gmp.h
> configure:8202: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8202: $? = 0
> configure:8220: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8220: $? = 0
> configure:8221: result: yes
> configure:8237: checking for the correct version of mpfr.h
> configure:8255: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8255: $? = 0
> configure:8272: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8272: $? = 0
> configure:8273: result: yes
> configure:8342: checking for the correct version of the gmp/mpfr libraries
> configure:8366: x86_64-linux-gnu-gcc -o conftest  -Iyes/include  -fPIC
> conftest.c  -Lyes/lib -lmpfr -lgmp >&5
> configure:8366: $? = 0
> configure:8367: result: yes
> configure:8615: checking for isl 0.15 or later
> configure:8628: x86_64-linux-gnu-gcc -o conftest   -Iyes/include  -fPIC   
> -lisl
> -Lyes/lib -lmpfr -lgmp conftest.c  -lisl -lgmp >&5
> configure:8628: $? = 0

Seems that you're passing simply --with-mpfr, however:

  AC_ARG_WITH(mpfr,
  [AS_HELP_STRING([--with-mpfr=PATH],
  [specify prefix directory for installed MPFR package.
   Equivalent to --with-mpfr-include=PATH/include
   plus --with-mpfr-lib=PATH/lib])])

... so it is interpreted to mean that the prefix MPFR is installed in is
yes/include (perhaps we should warn for the 'yes' case - that'd be less
confusing).  I think you should be able to get away without passing
--with-mpfr at all if your toolchain has mpfr available (and there's no
mpfr in the toplevel, to inhibit the toplevel trying to build its own
copy).

Hope that helps, have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 00/24] Sync shared build infrastructure with binutils-gdb

2023-08-08 Thread Arsen Arsenović via Gcc-patches

Joseph Myers  writes:

> On Tue, 8 Aug 2023, Arsen Arsenović via Gcc-patches wrote:
>
>> Yes.  Libtool was forked over a decade ago.  My next project is syncing
>> upstream and us back up.  Unsure about pkg.m4.
>
> Note as per previous discussions that libtool commit 
> 3334f7ed5851ef1e96b052f2984c4acdbf39e20c will need reverting in GCC when 
> updating libtool because of incompatible usage of --with-sysroot.

I wanted to, somehow, coalesce the two back together, so that both are
available.  Presumably, this means adding an option to libtool to accept
host-sysroot or such, but I haven't done too much looking into this.

Is my interpretation of the issue correct?  (i.e. GCC uses sysroot to
mean *target* sysroot rather than host sysroot)

> Reportedly libtool is based on upstream commit 
> 2c9c38d8a12eb0a2ce7fe9c3862523026c3d5622 (with *many* local changes, some 
> of which may not be present upstream).

Thanks, sharing that base will save me a good amount of time.

Have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 00/24] Sync shared build infrastructure with binutils-gdb

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Eric Gallager  writes:

> Hi, with the updates to libtool.m4 and pkg.m4, those files originally
> come from upstream libtool and pkg-config, correct? Won't patching
> GCC's local copies make re-syncing them with upstream
> libtool/pkg-config more difficult, or have these patches already been
> sent there, too? Also, when updating .m4 files, aren't you supposed to
> increment the serial number that they have near the top, too?

Yes.  Libtool was forked over a decade ago.  My next project is syncing
upstream and us back up.  Unsure about pkg.m4.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 24/24] toplevel: Makefile.def: add install-strip dependency on libsframe

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jeff Law  writes:

> OK.
>
> I know I skipped over a few.  I'll try to get those wrapped up shortly.

Thanks, I've pushed all of those (since I received all the reviews).

> While I strongly dislike git submodules, this may be one of those occasions
> where their use might be justified.  Something to ponder because these shared
> toplevel files are painful to keep sync'd.

I'm not sure how viable this is in the toplevel directory.  The inverse
is quite possible: the shared build system contains all the other
directories as modules, but that's undesirable for other reasons, I
presume.

I'll see if there's some solution.

> jeff


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Sat, 29 Apr 2023 at 11:24, Arsen Arsenović via Libstdc++ <
> libstd...@gcc.gnu.org> wrote:
>
>> libstdc++-v3/ChangeLog:
>>
>> * libsupc++/typeinfo: Switch to bits/version.h for
>> __cpp_lib_constexpr_typeinfo.
>>
>>
> Does this change have an impact on compilation speed?
> With this change we'll be re-including bits/version.h multiple times in
> most compilations, and unlike other headers the preprocessor can't optimize
> away the second and subsequent times its' included, because the header
> isn't idempotent.
> It will only affect the preprocessing phase, which is a fraction of the
> time taken by template instantiation and middle end optimizations, but I'd
> like to know it's not *too* expensive before committing to this approach.
>

Whoops, I forgot to provide these measurements.

  ~/gcc/build$ time for x in $(seq 1 100); do _pfx/bin/g++ -x c++ - \
   -S -o /dev/null <<< '#include '; done
  
  real  3m4.104s
  user  2m53.394s
  sys   0m10.132s

  ~/gcc/pristine-bld$ time for x in $(seq 1 100); do _pfx/bin/g++ \
   -x c++ - -S -o /dev/null \
   <<< '#include '; done
  
  real  2m56.430s
  user  2m46.898s
  sys   0m8.967s

The top is a build of gcc with (a rebase of) this patchset, and the
bottom is the merge base.  The configuration for both was:

  ../configure --enable-languages=c++ \
   --disable-libsanitizers \
   --prefix="$(pwd)/_pfx"

This should imply that the difference is minor compared to compilation
time.

Of course, for preprocessing, the difference is far more significant
(same testcase, but with -E): 0m17.248s vs 0m28.382s.

This seems okay to me.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Sat, 29 Apr 2023 at 11:24, Arsen Arsenović via Libstdc++ <
> libstd...@gcc.gnu.org> wrote:
>
>> libstdc++-v3/ChangeLog:
>>
>> * libsupc++/typeinfo: Switch to bits/version.h for
>> __cpp_lib_constexpr_typeinfo.
>>
>>
> Does this change have an impact on compilation speed?
> With this change we'll be re-including bits/version.h multiple times in
> most compilations, and unlike other headers the preprocessor can't optimize
> away the second and subsequent times its' included, because the header
> isn't idempotent.
> It will only affect the preprocessing phase, which is a fraction of the
> time taken by template instantiation and middle end optimizations, but I'd
> like to know it's not *too* expensive before committing to this approach.



>
>> @@ -234,9 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>return __atomic_test_and_set (&_M_i, int(__m));
>>  }
>>
>> -#if __cplusplus > 201703L
>> -#define __cpp_lib_atomic_flag_test 201907L
>> -
>> +#ifdef __cpp_lib_atomic_flag_test
>>  _GLIBCXX_ALWAYS_INLINE bool
>>  test(memory_order __m = memory_order_seq_cst) const noexcept
>>  {
>>
>
> This is more "structured" and maintainable than the current ad-hoc way we
> deal with FTMs, but this seems like a readability/usability regression in
> terms of being able to open the header and see "ah this feature is only
> available for C++20 and up". Instead you can see it's available for the
> specified FTM, but now you have to go and find where that's defined, and
> that's not even defined in C++, it's in the version.def file. It's also
> defined in bits/version.h, but that's a generated file and so is very
> verbose and long.
>
>
> diff --git a/libstdc++-v3/include/bits/move_only_function.h
>> b/libstdc++-v3/include/bits/move_only_function.h
>> index 71d52074978..81d7d9f7c0a 100644
>> --- a/libstdc++-v3/include/bits/move_only_function.h
>> +++ b/libstdc++-v3/include/bits/move_only_function.h
>> @@ -32,7 +32,10 @@
>>
>>  #pragma GCC system_header
>>
>> -#if __cplusplus > 202002L
>> +#define __glibcxx_want_move_only_function
>> +#include 
>> +
>> +#ifdef __cpp_lib_move_only_function
>>
>
> Here's another case where I think the __cplusplus > 202002L is more
> discoverable.
>
> Although maybe I'm biased, because I look at that and immediately see
> "C++23 and up". Maybe the average user finds that less clear. Maybe the
> average user doesn't need to look at this anyway, but I know *I* do it
> fairly often.
>
> I wonder if it would help if we kept a comment there with a (possibly
> imprecise) hint about the conditions under which the feature is defined. So
> in this case:
>
> // Only defined for C++23
> #ifdef __cpp_lib_move_only_function
>
> That retains the info that's currently there, and is even more readable
> than the __cplusplus check.
>
> There's a risk that those comments would get out of step with reality,
> which is one of the things this patch set aims to solve. But I think in
> practice that's unlikely. std::move_only_function isn't suddenly going to
> become available in C++20, or stop being available in C++23 and move to
> C++26.
>
> What do you think?

I think that's reasonable.  And, yes, I doubt these conditions change
much.  I'll go over the conditions and insert a hint.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 1/2] libstdc++: Implement more maintainable header

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:
> [...snip...]
> It looks like this will regenerate the bits/version.h file if it's older
> than the definitions or the autogen template, right?
>
> Generally we don't want to touch anything in the source tree as part of a
> normal build. It's OK to do that when configured with
> --enable-maintainer-mode (which nobody working on libstdc++ actually uses,
> because it causes problems IME) or via a dedicated target which is not
> built by default (e.g. doc/Makefile.am has the doc-html-docbook-regenerate
> target, which is isn't a prereq of any other targets so it's only run if
> you explicitly request it).
>
> The problem with modifying the source tree as part of a normal build is
> that it might be on read-only media, and so the build will fail if this
> target can't be updated. We would also want to add the version.h header to
> the contrib/gcc_update script that updates the timestamps of generated
> files, so that they are always newer than their prereqs.
>
> Maybe the best option here is to assume that version.h is always up to
> date, and add a custom target to regen it manually, which we can run after
> editing the .def or .tpl files. What do you think?

Ah, I wasn't aware of this concern.  I'll make it a phony target, yeah.

> My only other concern with this patch is that I don't speak lisp so the
> Guile code in version.tpl is opaque and unmaintainable for me. That is
> fixable though.

The algorithm the code implements is quite simple, it just verifies that
the three numeric fields associated with each FTM are in a non-ascending
order (which ensures that the most broad option comes last in the
#if/#elif chain).  It's a sanity check that's caught a couple of
transcription errors I made during the initial conversion.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 22/24] libtool.m4: augment symcode for Solaris 11

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

This reports common symbols like GNU nm, via a type code of 'C'.

ChangeLog:

* libtool.m4 (lt_cv_sys_global_symbol_pipe): Augment symcode for
Solaris 11.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 gcc/configure  | 2 +-
 libatomic/configure| 2 +-
 libbacktrace/configure | 2 +-
 libcc1/configure   | 2 +-
 libffi/configure   | 2 +-
 libgfortran/configure  | 2 +-
 libgm2/configure   | 2 +-
 libgomp/configure  | 2 +-
 libitm/configure   | 2 +-
 libobjc/configure  | 2 +-
 libphobos/configure| 2 +-
 libquadmath/configure  | 2 +-
 libsanitizer/configure | 2 +-
 libssp/configure   | 2 +-
 libstdc++-v3/configure | 2 +-
 libtool.m4 | 2 +-
 libvtv/configure   | 2 +-
 lto-plugin/configure   | 2 +-
 zlib/configure | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index e5e95e7c1c8..ea1ad6606a6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -15346,7 +15346,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libatomic/configure b/libatomic/configure
index 75096735c61..57f320753e1 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -6593,7 +6593,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libbacktrace/configure b/libbacktrace/configure
index f3ef3fc3f23..c3e7b884e36 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -7038,7 +7038,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libcc1/configure b/libcc1/configure
index edf03334f30..1a63a0e4e1a 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -6299,7 +6299,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libffi/configure b/libffi/configure
index a1ded4f617b..9eac9c907bf 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -6825,7 +6825,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgfortran/configure b/libgfortran/configure
index 7b408515498..cd176b04a14 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -8227,7 +8227,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgm2/configure b/libgm2/configure
index 2d54302129c..f576681098f 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -8129,7 +8129,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgomp/configure b/libgomp/configure
index 6d4b6e3850e..a12b30f1b0f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -6607,7 +6607,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libitm/configure b/libitm/configure
index 83ff24b73e8..02e8de7896b 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -7268,7 +7268,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libobjc/configure b/libobjc/configure
index fd590e628ab..752f6fdfebd 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -5995,7 +5995,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libphobos/configure b/libphobos/configure
index 814cacc1120..b7276d95010 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -7272,7 +7272,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git 

[PATCH 19/24] Deprecate a.out support for NetBSD targets.

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: John Ericson 

As discussed previously, a.out support is now quite deprecated, and in
some cases removed, in both Binutils itself and NetBSD, so this legacy
default makes little sense. `netbsdelf*` and `netbsdaout*` still work
allowing the user to be explicit about there choice. Additionally, the
configure script warns about the change as Nick Clifton requested.

One possible concern was the status of NetBSD on NS32K, where only a.out
was supported. But per [1] NetBSD has removed support, and if it were to
come back, it would be with ELF. The binutils implementation is
therefore marked obsolete, per the instructions in the last message.

With that patch and this one applied, I have confirmed the following:

--target=i686-unknown-netbsd
--target=i686-unknown-netbsdelf
  builds completely

--target=i686-unknown-netbsdaout
  properly fails because target is deprecated.

--target=vax-unknown-netbsdaout builds completely except for gas, where
the target is deprecated.

[1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html

config/ChangeLog:

* picflag.m4: Simplify SHmedia NetBSD match by presuming ELF.

gcc/ChangeLog:

* configure: Regenerate.

libada/ChangeLog:

* configure: Regenerate.

libgcc/ChangeLog:

* configure: Regenerate.

libiberty/ChangeLog:

* configure: Regenerate.
---
 config/picflag.m4   | 4 +---
 gcc/configure   | 8 +++-
 libada/configure| 4 +---
 libgcc/configure| 4 +---
 libiberty/configure | 4 +---
 5 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/config/picflag.m4 b/config/picflag.m4
index 0aefcf619bf..3f3ac744c96 100644
--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -63,9 +63,7 @@ case "${$2}" in
 sh-*-linux* | sh[[2346lbe]]*-*-linux*)
$1=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
$1=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/gcc/configure b/gcc/configure
index cd9919e858d..e5e95e7c1c8 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -5480,9 +5480,7 @@ case "${target}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG_FOR_TARGET=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG_FOR_TARGET=-fpic
;;
 # Default to -fPIC unless specified otherwise.
@@ -19888,7 +19886,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19891 "configure"
+#line 19889 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19994,7 +19992,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19997 "configure"
+#line 19995 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libada/configure b/libada/configure
index 9c8b133d817..ac4dad3ad3b 100755
--- a/libada/configure
+++ b/libada/configure
@@ -3231,9 +3231,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/libgcc/configure b/libgcc/configure
index 1e727367ba3..cf149209652 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -2422,9 +2422,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/libiberty/configure b/libiberty/configure
index bdc860f1623..dd896270dc6 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -5368,9 +5368,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
-- 
2.41.0



[PATCH 14/24] libtool.m4: fix nm BSD flag detection

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

Libtool needs to get BSD-format (or MS-format) output out of the system
nm, so that it can scan generated object files for symbol names for
-export-symbols-regex support.  Some nms need specific flags to turn on
BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
Unfortunately the code to do this has a pair of interlocking flaws:

 - it runs the test by doing an nm of /dev/null.  Some platforms
   reasonably refuse to do an nm on a device file, but before now this
   has only been worked around by assuming that the error message has a
   specific textual form emitted by Tru64 nm, and that getting this
   error means this is Tru64 nm and that nm -B would work to produce
   BSD-format output, even though the test never actually got anything
   but an error message out of nm -B.  This is fixable by nm'ing *nm
   itself* (since we necessarily have a path to it).

 - the test is entirely skipped if NM is set in the environment, on the
   grounds that the user has overridden the test: but the user cannot
   reasonably be expected to know that libtool wants not only nm but
   also flags forcing BSD-format output.  Worse yet, one such "user" is
   the top-level Cygnus configure script, which neither tests for
   nor specifies any BSD-format flags.  So platforms needing BSD-format
   flags always fail to set them when run in a Cygnus tree, breaking
   -export-symbols-regex on such platforms.  Libtool also needs to
   augment $LD on some platforms, but this is done unconditionally,
   augmenting whatever the user specified: the nm check should do the
   same.

   One wrinkle: if the user has overridden $NM, a path might have been
   provided: so we use the user-specified path if there was one, and
   otherwise do the path search as usual.  (If the nm specified doesn't
   work, this might lead to a few extra pointless path searches -- but
   the test is going to fail anyway, so that's not a problem.)

(Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
*that* is a symlink to /usr/bin/nm.)

ChangeLog:

* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
errors from nms that refuse to work on non-regular files.  Remove
other workarounds for this problem.  Strip out blank lines from the
nm output.

fixincludes/ChangeLog:

* configure: Regenerate.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 fixincludes/configure  |   3 +-
 gcc/configure  |  89 ++--
 libatomic/configure|  89 ++--
 libbacktrace/configure |  89 ++--
 libcc1/configure   |  89 ++--
 libffi/configure   |  89 ++--
 libgfortran/configure  |  89 ++--
 libgm2/configure   |  89 ++--
 libgomp/configure  |  89 ++--
 libitm/configure   |  89 ++--
 libobjc/configure  |  89 ++--
 libphobos/configure|  89 ++--
 libquadmath/configure  |  89 ++--
 libsanitizer/configure |  89 ++--
 libssp/configure   |  89 ++--
 libstdc++-v3/configure | 101 +
 libtool.m4 |  88 +--
 libvtv/configure   |  89 ++--
 lto-plugin/configure   |  89 ++--
 zlib/configure |  89 ++--
 20 files changed, 863 insertions(+), 842 deletions(-)

diff --git a/fixincludes/configure b/fixincludes/configure
index f1748ebef74..b9770489adc 100755
--- 

[PATCH 24/24] toplevel: Makefile.def: add install-strip dependency on libsframe

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Indu Bhagat 

As noted in PR libsframe/30014 - FTBFS: install-strip fails because
bfdlib relinks and fails to find libsframe, the install time
dependencies of libbfd need to be updated.

ChangeLog:

* Makefile.def: Reflect that libsframe needs to installed before
libbfd.  Reorder a bit to better track libsframe dependencies.
* Makefile.in: Regenerate.
---
 Makefile.def | 5 -
 Makefile.in  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 0c6784b6da1..870150183b9 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -492,7 +492,6 @@ dependencies = { module=install-binutils; 
on=install-opcodes; };
 dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
 
 // Likewise for ld, libctf, and bfd.
-dependencies = { module=install-bfd; on=install-libsframe; };
 dependencies = { module=install-libctf; on=install-bfd; };
 dependencies = { module=install-ld; on=install-bfd; };
 dependencies = { module=install-ld; on=install-libctf; };
@@ -500,6 +499,10 @@ dependencies = { module=install-strip-libctf; 
on=install-strip-bfd; };
 dependencies = { module=install-strip-ld; on=install-strip-bfd; };
 dependencies = { module=install-strip-ld; on=install-strip-libctf; };
 
+// libbfd depends on libsframe
+dependencies = { module=install-bfd; on=install-libsframe; };
+dependencies = { module=install-strip-bfd; on=install-strip-libsframe; };
+
 // libopcodes depends on libbfd
 dependencies = { module=configure-opcodes; on=configure-bfd; hard=true; };
 dependencies = { module=install-opcodes; on=install-bfd; };
diff --git a/Makefile.in b/Makefile.in
index 35a5d8c575d..c97130a2338 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66496,13 +66496,14 @@ all-stageautoprofile-binutils: 
maybe-all-stageautoprofile-libsframe
 all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe
 install-binutils: maybe-install-opcodes
 install-strip-binutils: maybe-install-strip-opcodes
-install-bfd: maybe-install-libsframe
 install-libctf: maybe-install-bfd
 install-ld: maybe-install-bfd
 install-ld: maybe-install-libctf
 install-strip-libctf: maybe-install-strip-bfd
 install-strip-ld: maybe-install-strip-bfd
 install-strip-ld: maybe-install-strip-libctf
+install-bfd: maybe-install-libsframe
+install-strip-bfd: maybe-install-strip-libsframe
 configure-opcodes: configure-bfd
 configure-stage1-opcodes: configure-stage1-bfd
 configure-stage2-opcodes: configure-stage2-bfd
-- 
2.41.0



[PATCH 23/24] bfd: linker: merge .sframe sections

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Indu Bhagat 

The linker merges all the input .sframe sections.  When merging, the
linker verifies that all the input .sframe sections have the same
abi/arch.

The linker uses libsframe library to perform key actions on the
.sframe sections - decode, read, and create output data.  This
implies buildsystem changes to make and install libsframe before
libbfd.

The linker places the output .sframe section in a new segment of its
own: PT_GNU_SFRAME.  A new segment is not added, however, if the
generated .sframe section is empty.

When a section is discarded from the final link, the corresponding
entries in the .sframe section for those functions are also deleted.

The linker sorts the SFrame FDEs on start address by default and sets
the SFRAME_F_FDE_SORTED flag in the .sframe section.

This patch also adds support for generation of SFrame unwind
information for the .plt* sections on x86_64.  SFrame unwind info is
generated for IBT enabled PLT, lazy/non-lazy PLT.

The existing linker option --no-ld-generated-unwind-info has been
adapted to include the control of whether .sframe unwind information
will be generated for the linker generated sections like PLT.

Changes to the linker script have been made as necessary.

ChangeLog:

* Makefile.def: Add install dependency on libsframe for libbfd.
* Makefile.in: Regenerated.
---
 Makefile.def |  4 
 Makefile.in  | 11 +++
 2 files changed, 15 insertions(+)

diff --git a/Makefile.def b/Makefile.def
index 86d25f43762..0c6784b6da1 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -459,11 +459,14 @@ dependencies = { module=all-gdbsupport; on=all-gnulib; };
 dependencies = { module=all-gdbsupport; on=all-intl; };
 
 // Host modules specific to binutils.
+// build libsframe before bfd for encoder/decoder support for linking
+// SFrame sections
 dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
 dependencies = { module=configure-bfd; on=configure-intl; };
 dependencies = { module=all-bfd; on=all-libiberty; };
 dependencies = { module=all-bfd; on=all-intl; };
 dependencies = { module=all-bfd; on=all-zlib; };
+dependencies = { module=all-bfd; on=all-libsframe; };
 dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; 
};
 dependencies = { module=all-opcodes; on=all-libiberty; };
 
@@ -489,6 +492,7 @@ dependencies = { module=install-binutils; 
on=install-opcodes; };
 dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
 
 // Likewise for ld, libctf, and bfd.
+dependencies = { module=install-bfd; on=install-libsframe; };
 dependencies = { module=install-libctf; on=install-bfd; };
 dependencies = { module=install-ld; on=install-bfd; };
 dependencies = { module=install-ld; on=install-libctf; };
diff --git a/Makefile.in b/Makefile.in
index 214a2a15544..35a5d8c575d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66354,6 +66354,16 @@ all-stagetrain-bfd: maybe-all-stagetrain-zlib
 all-stagefeedback-bfd: maybe-all-stagefeedback-zlib
 all-stageautoprofile-bfd: maybe-all-stageautoprofile-zlib
 all-stageautofeedback-bfd: maybe-all-stageautofeedback-zlib
+all-bfd: maybe-all-libsframe
+all-stage1-bfd: maybe-all-stage1-libsframe
+all-stage2-bfd: maybe-all-stage2-libsframe
+all-stage3-bfd: maybe-all-stage3-libsframe
+all-stage4-bfd: maybe-all-stage4-libsframe
+all-stageprofile-bfd: maybe-all-stageprofile-libsframe
+all-stagetrain-bfd: maybe-all-stagetrain-libsframe
+all-stagefeedback-bfd: maybe-all-stagefeedback-libsframe
+all-stageautoprofile-bfd: maybe-all-stageautoprofile-libsframe
+all-stageautofeedback-bfd: maybe-all-stageautofeedback-libsframe
 configure-opcodes: configure-libiberty
 configure-stage1-opcodes: configure-stage1-libiberty
 configure-stage2-opcodes: configure-stage2-libiberty
@@ -66486,6 +66496,7 @@ all-stageautoprofile-binutils: 
maybe-all-stageautoprofile-libsframe
 all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe
 install-binutils: maybe-install-opcodes
 install-strip-binutils: maybe-install-strip-opcodes
+install-bfd: maybe-install-libsframe
 install-libctf: maybe-install-bfd
 install-ld: maybe-install-bfd
 install-ld: maybe-install-libctf
-- 
2.41.0



[PATCH 16/24] Add support for the haiku operating system

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alexander von Gluck IV 

These are the os support patches we have been grooming and maintaining
for quite a few years over on git.haiku-os.org.  All of these
architectures are working and most have been stable for quite some time.

ChangeLog:

* configure: Regenerate.
* configure.ac: Add Haiku to list of ELF OSes
* libtool.m4: Update sys_lib_dlsearch_path_spec on Haiku.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 configure  | 2 +-
 configure.ac   | 2 +-
 gcc/configure  | 4 ++--
 libatomic/configure| 2 +-
 libbacktrace/configure | 2 +-
 libcc1/configure   | 4 ++--
 libffi/configure   | 4 ++--
 libgfortran/configure  | 4 ++--
 libgm2/configure   | 4 ++--
 libgomp/configure  | 4 ++--
 libitm/configure   | 4 ++--
 libobjc/configure  | 2 +-
 libphobos/configure| 2 +-
 libquadmath/configure  | 2 +-
 libsanitizer/configure | 4 ++--
 libssp/configure   | 2 +-
 libstdc++-v3/configure | 4 ++--
 libtool.m4 | 2 +-
 libvtv/configure   | 4 ++--
 lto-plugin/configure   | 2 +-
 zlib/configure | 2 +-
 21 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 907ebe71777..28f0913bdd4 100755
--- a/configure
+++ b/configure
@@ -3077,7 +3077,7 @@ case "${ENABLE_GOLD}" in
   *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
   | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
   | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-  | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+  | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
 case "${target}" in
   *-*-linux*aout* | *-*-linux*oldld*)
 ;;
diff --git a/configure.ac b/configure.ac
index 6a2e585a39a..5d25dc864c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,7 +349,7 @@ case "${ENABLE_GOLD}" in
   *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
   | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
   | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-  | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+  | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
 case "${target}" in
   *-*-linux*aout* | *-*-linux*oldld*)
 ;;
diff --git a/gcc/configure b/gcc/configure
index c58a99f5d40..e97433d8743 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -19068,7 +19068,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -22743,7 +22743,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/libatomic/configure b/libatomic/configure
index 648f0dd7e52..75096735c61 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -10582,7 +10582,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 73611a3b994..f3ef3fc3f23 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -10759,7 +10759,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  

[PATCH 13/24] configure: reinstate 32b PA-RISC HP-UX target in toplevel

2023-08-07 Thread Arsen Arsenović via Gcc-patches
The Binutils still support this target.

ChangeLog:

* configure.ac: Reinstate 32b PA-RISC HP-UX targets
* configure: Regenerate.
---
 configure| 10 ++
 configure.ac | 10 ++
 2 files changed, 20 insertions(+)

diff --git a/configure b/configure
index b6b7487f834..907ebe71777 100755
--- a/configure
+++ b/configure
@@ -3572,6 +3572,11 @@ case "${target}" in
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
+  hppa*-hp-hpux11*)
+;;
+  hppa*-*-hpux*)
+noconfigdirs="$noconfigdirs target-libffi"
+;;
   ia64*-*-*vms*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
@@ -3878,9 +3883,14 @@ case "${target}" in
   h8500-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
+  hppa1.1-*-osf* | hppa1.1-*-bsd* )
+;;
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs gdb"
 ;;
+  hppa*-*-hpux11*)
+noconfigdirs="$noconfigdirs gdb ld"
+;;
   hppa*64*-*-linux*)
 ;;
   hppa*-*-linux*)
diff --git a/configure.ac b/configure.ac
index 39e5649f360..6a2e585a39a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,6 +802,11 @@ case "${target}" in
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
+  hppa*-hp-hpux11*)
+;;
+  hppa*-*-hpux*)
+noconfigdirs="$noconfigdirs target-libffi"
+;;
   ia64*-*-*vms*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
@@ -1105,9 +1110,14 @@ case "${target}" in
   h8500-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
+  hppa1.1-*-osf* | hppa1.1-*-bsd* )
+;;
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs gdb"
 ;;
+  hppa*-*-hpux11*)
+noconfigdirs="$noconfigdirs gdb ld"
+;;
   hppa*64*-*-linux*)
 ;;
   hppa*-*-linux*)
-- 
2.41.0



[PATCH 15/24] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

My previous nm patch handled all cases but one -- if the user set NM in
the environment to a path which contained an option, libtool's nm
detection tries to run nm against a copy of nm with the options in it:
e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
This is unlikely to be desirable: in this case we should run
"/usr/bin/nm --blargle /usr/bin/nm".

Furthermore, as part of this nm has to detect when the passed-in $NM
contains a path, and in that case avoid doing a path search itself.
This too was thrown off if an option contained something that looked
like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
"nm -B../prev-gcc nm" which rarely works well (and indeed it looks
to see whether that nm exists, finds it doesn't, and wrongly concludes
that nm -p or whatever does not work).

Fix all of these by clipping all options (defined as everything
including and after the first " -") before deciding whether nm
contains a path (but not using the clipped value for anything else),
and then removing all options from the path-modified nm before
looking to see whether that nm existed.

NM=my-nm now does a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM=/usr/bin/my-nm now avoids a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM="my-nm -p../wombat" now does a path search and runs e.g.
  /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm

NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
  ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm

This seems to be all combinations, including those used by GCC bootstrap
(which, before this commit, fails to bootstrap when configured
--with-build-config=bootstrap-lto, because the lto plugin is now using
--export-symbols-regex, which requires libtool to find a working nm,
while also using -B../prev-gcc to point at the lto plugin associated
with the GCC just built.)

Regenerate all affected configure scripts.

ChangeLog:

* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
options, including options containing paths.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 gcc/configure  | 20 +---
 libatomic/configure| 20 +---
 libbacktrace/configure | 20 +---
 libcc1/configure   | 20 +---
 libffi/configure   | 20 +---
 libgfortran/configure  | 20 +---
 libgm2/configure   | 20 +---
 libgomp/configure  | 20 +---
 libitm/configure   | 20 +---
 libobjc/configure  | 20 +---
 libphobos/configure| 20 +---
 libquadmath/configure  | 20 +---
 libsanitizer/configure | 20 +---
 libssp/configure   | 20 +---
 libstdc++-v3/configure | 32 +++-
 libtool.m4 | 16 +++-
 libvtv/configure   | 20 +---
 lto-plugin/configure   | 20 +---
 zlib/configure | 20 +---
 19 files changed, 251 insertions(+), 137 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 81b93c1b599..c58a99f5d40 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -14144,25 +14144,31 @@ else
  lt_nm_to_check="$lt_nm_to_check nm"
fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
  IFS="$lt_save_ifs"
  test -z "$ac_dir" && ac_dir=.
- case "$lt_tmp_nm" in
+ # Strip out any user-provided options from the nm to test twice,
+ # the first time to test to see if nm (rather than its options) has
+ # an explicit path, the second time to yield a file which can be
+ # nm'ed itself.
+ tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+ case 

[PATCH 10/24] gprofng: a new GNU profiler

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Vladimir Mezentsev 

ChangeLog:

* Makefile.def: Add gprofng module.
* configure.ac: Add --enable-gprofng option.
* Makefile.in: Regenerate.
* configure: Regenerate.

include/ChangeLog:

* collectorAPI.h: New file.
* libcollector.h: New file.
* libfcollector.h: New file.
---
 Makefile.def|  11 +
 Makefile.in | 497 
 configure   |  18 ++
 configure.ac|  14 ++
 include/collectorAPI.h  |  73 ++
 include/libcollector.h  |  89 +++
 include/libfcollector.h |  42 
 7 files changed, 744 insertions(+)
 create mode 100644 include/collectorAPI.h
 create mode 100644 include/libcollector.h
 create mode 100644 include/libfcollector.h

diff --git a/Makefile.def b/Makefile.def
index 9b4a8a2bf7a..86d25f43762 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -73,6 +73,7 @@ host_modules= { module= isl; lib_path=.libs; bootstrap=true;
no_install= true; };
 host_modules= { module= gold; bootstrap=true; };
 host_modules= { module= gprof; };
+host_modules= { module= gprofng; };
 // intl acts on 'host_shared' directly, and does not support --with-pic.
 host_modules= { module= intl; bootstrap=true; };
 host_modules= { module= tcl;
@@ -511,6 +512,16 @@ dependencies = { module=all-gprof; on=all-bfd; };
 dependencies = { module=all-gprof; on=all-opcodes; };
 dependencies = { module=all-gprof; on=all-intl; };
 dependencies = { module=all-gprof; on=all-gas; };
+
+dependencies = { module=configure-gprofng; on=configure-intl; };
+dependencies = { module=all-gprofng; on=all-libiberty; };
+dependencies = { module=all-gprofng; on=all-bfd; };
+dependencies = { module=all-gprofng; on=all-opcodes; };
+dependencies = { module=all-gprofng; on=all-intl; };
+dependencies = { module=all-gprofng; on=all-gas; };
+dependencies = { module=install-gprofng; on=install-opcodes; };
+dependencies = { module=install-gprofng; on=install-bfd; };
+
 dependencies = { module=configure-ld; on=configure-intl; };
 dependencies = { module=all-ld; on=all-libiberty; };
 dependencies = { module=all-ld; on=all-bfd; };
diff --git a/Makefile.in b/Makefile.in
index 6539fb201dc..f177ce176fb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1089,6 +1089,7 @@ configure-host:  \
 maybe-configure-isl \
 maybe-configure-gold \
 maybe-configure-gprof \
+maybe-configure-gprofng \
 maybe-configure-intl \
 maybe-configure-tcl \
 maybe-configure-itcl \
@@ -1242,6 +1243,7 @@ all-host: maybe-all-isl
 all-host: maybe-all-gold
 @endif gold-no-bootstrap
 all-host: maybe-all-gprof
+all-host: maybe-all-gprofng
 @if intl-no-bootstrap
 all-host: maybe-all-intl
 @endif intl-no-bootstrap
@@ -1381,6 +1383,7 @@ info-host: maybe-info-mpc
 info-host: maybe-info-isl
 info-host: maybe-info-gold
 info-host: maybe-info-gprof
+info-host: maybe-info-gprofng
 info-host: maybe-info-intl
 info-host: maybe-info-tcl
 info-host: maybe-info-itcl
@@ -1471,6 +1474,7 @@ dvi-host: maybe-dvi-mpc
 dvi-host: maybe-dvi-isl
 dvi-host: maybe-dvi-gold
 dvi-host: maybe-dvi-gprof
+dvi-host: maybe-dvi-gprofng
 dvi-host: maybe-dvi-intl
 dvi-host: maybe-dvi-tcl
 dvi-host: maybe-dvi-itcl
@@ -1561,6 +1565,7 @@ pdf-host: maybe-pdf-mpc
 pdf-host: maybe-pdf-isl
 pdf-host: maybe-pdf-gold
 pdf-host: maybe-pdf-gprof
+pdf-host: maybe-pdf-gprofng
 pdf-host: maybe-pdf-intl
 pdf-host: maybe-pdf-tcl
 pdf-host: maybe-pdf-itcl
@@ -1651,6 +1656,7 @@ html-host: maybe-html-mpc
 html-host: maybe-html-isl
 html-host: maybe-html-gold
 html-host: maybe-html-gprof
+html-host: maybe-html-gprofng
 html-host: maybe-html-intl
 html-host: maybe-html-tcl
 html-host: maybe-html-itcl
@@ -1741,6 +1747,7 @@ TAGS-host: maybe-TAGS-mpc
 TAGS-host: maybe-TAGS-isl
 TAGS-host: maybe-TAGS-gold
 TAGS-host: maybe-TAGS-gprof
+TAGS-host: maybe-TAGS-gprofng
 TAGS-host: maybe-TAGS-intl
 TAGS-host: maybe-TAGS-tcl
 TAGS-host: maybe-TAGS-itcl
@@ -1831,6 +1838,7 @@ install-info-host: maybe-install-info-mpc
 install-info-host: maybe-install-info-isl
 install-info-host: maybe-install-info-gold
 install-info-host: maybe-install-info-gprof
+install-info-host: maybe-install-info-gprofng
 install-info-host: maybe-install-info-intl
 install-info-host: maybe-install-info-tcl
 install-info-host: maybe-install-info-itcl
@@ -1921,6 +1929,7 @@ install-dvi-host: maybe-install-dvi-mpc
 install-dvi-host: maybe-install-dvi-isl
 install-dvi-host: maybe-install-dvi-gold
 install-dvi-host: maybe-install-dvi-gprof
+install-dvi-host: maybe-install-dvi-gprofng
 install-dvi-host: maybe-install-dvi-intl
 install-dvi-host: maybe-install-dvi-tcl
 install-dvi-host: maybe-install-dvi-itcl
@@ -2011,6 +2020,7 @@ install-pdf-host: maybe-install-pdf-mpc
 install-pdf-host: maybe-install-pdf-isl
 install-pdf-host: maybe-install-pdf-gold
 install-pdf-host: maybe-install-pdf-gprof
+install-pdf-host: maybe-install-pdf-gprofng
 install-pdf-host: maybe-install-pdf-intl
 install-pdf-host: maybe-install-pdf-tcl
 

[PATCH 17/24] egrep in binutils

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Apparently some distros have a nagging egrep that helpfully tells you
egrep is deprecated and to use "grep -E".  The nag message causes a ld
testsuite failure.  What's more the advice isn't that good.  The "-E"
flag may not be available with older versions of grep.

This patch fixes bare invocation of egrep within binutils, replacing
it with the autoconf $EGREP or with grep.

config/ChangeLog:

* lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and
invoke $EGREP.
(AC_LIB_PROG_LD): Likewise.

gcc/ChangeLog:

* configure: Regenerate.

intl/ChangeLog:

* configure: Regenerate.

libcpp/ChangeLog:

* configure: Regenerate.

libgcc/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.
---
 config/lib-ld.m4   | 8 +---
 gcc/configure  | 4 ++--
 intl/configure | 4 ++--
 libcpp/configure   | 4 ++--
 libgcc/configure   | 2 +-
 libstdc++-v3/configure | 4 ++--
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/config/lib-ld.m4 b/config/lib-ld.m4
index 11d0ce77342..73cf9571b57 100644
--- a/config/lib-ld.m4
+++ b/config/lib-ld.m4
@@ -12,9 +12,10 @@ dnl with libtool.m4.
 
 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
 AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -29,6 +30,7 @@ AC_DEFUN([AC_LIB_PROG_LD],
 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_EGREP])dnl
 # Prepare PATH_SEPARATOR.
 # The user is always right.
 if test "${PATH_SEPARATOR+set}" != set; then
@@ -88,7 +90,7 @@ AC_CACHE_VAL(acl_cv_path_LD,
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
diff --git a/gcc/configure b/gcc/configure
index e97433d8743..cd9919e858d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11299,7 +11299,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
@@ -11327,7 +11327,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
diff --git a/intl/configure b/intl/configure
index 79bb5831a47..42b2a26b5bf 100755
--- a/intl/configure
+++ b/intl/configure
@@ -5094,7 +5094,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
@@ -5122,7 +5122,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
diff --git a/libcpp/configure b/libcpp/configure
index 1389ddab544..ed98f40a1c1 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -6811,7 +6811,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break

[PATCH 20/24] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

It is quite normal to have headers without library on multilib OSes.
Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS
works.

config/ChangeLog:

* pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
$pkg_cv_[]$1[]_LIBS works.
---
 config/pkg.m4 | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/config/pkg.m4 b/config/pkg.m4
index 13a88901786..45587e97c8b 100644
--- a/config/pkg.m4
+++ b/config/pkg.m4
@@ -147,6 +147,12 @@ AC_MSG_CHECKING([for $2])
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
+dnl Check whether $pkg_cv_[]$1[]_LIBS works.
+pkg_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
+LDFLAGS=$pkg_save_LDFLAGS
+
 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables 
$1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
-- 
2.41.0



[PATCH 21/24] PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

There is no need to check $pkg_cv_[]$1[]_LIBS works if package check
failed.

config/ChangeLog:

* pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
$pkg_failed = no.
---
 config/pkg.m4 | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/config/pkg.m4 b/config/pkg.m4
index 45587e97c8b..7ebf517cd6a 100644
--- a/config/pkg.m4
+++ b/config/pkg.m4
@@ -148,10 +148,12 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
 dnl Check whether $pkg_cv_[]$1[]_LIBS works.
-pkg_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
-AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
-LDFLAGS=$pkg_save_LDFLAGS
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+  AC_TRY_LINK([],[], [], [pkg_failed=yes])
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
 
 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables 
$1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
-- 
2.41.0



[PATCH 04/24] Sync with binutils: GCC: Pass --plugin to AR and RANLIB

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

Sync with binutils for building binutils with LTO:

50ad1254d50 GCC: Pass --plugin to AR and RANLIB

Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
build.

ChangeLog:

* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
* configure.ac: Include config/gcc-plugin.m4.
AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
RANLIB if possible.
* Makefile.in: Regenerated.
* configure: Likewise.

config/ChangeLog:

* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.

libiberty/ChangeLog:

* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
(configure_deps): Depend on ../config/gcc-plugin.m4.
* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
RANLIB_PLUGIN_OPTION.
* aclocal.m4: Regenerated.
* configure: Likewise.

zlib/ChangeLog:

* configure: Regenerated.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.
---
 Makefile.in|  5 +++--
 Makefile.tpl   |  5 +++--
 config/gcc-plugin.m4   | 28 
 configure  | 39 +++
 configure.ac   | 15 +++
 gcc/configure  | 27 +--
 libatomic/configure| 27 +--
 libbacktrace/configure | 27 +--
 libcc1/configure   | 27 +--
 libffi/configure   | 27 +--
 libgfortran/configure  | 27 +--
 libgm2/configure   | 27 +--
 libgomp/configure  | 27 +--
 libiberty/Makefile.in  |  5 +++--
 libiberty/aclocal.m4   |  1 +
 libiberty/configure| 37 +
 libiberty/configure.ac | 12 
 libitm/configure   | 27 +--
 libobjc/configure  | 27 +--
 libphobos/configure| 27 +--
 libquadmath/configure  | 27 +--
 libsanitizer/configure | 27 +--
 libssp/configure   | 27 +--
 libstdc++-v3/configure | 39 +++
 libtool.m4 | 25 -
 libvtv/configure   | 27 +--
 lto-plugin/configure   | 27 +--
 zlib/configure | 27 +--
 28 files changed, 621 insertions(+), 49 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 144bccd2603..6539fb201dc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -417,7 +417,7 @@ MAKEINFOFLAGS = --split-size=500
 # -
 
 AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
 AR_FLAGS = rc
 CC = @CC@
 CXX = @CXX@
@@ -428,7 +428,7 @@ LIPO = @LIPO@
 NM = @NM@
 OBJDUMP = @OBJDUMP@
 OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
 READELF = @READELF@
 STRIP = @STRIP@
 WINDRES = @WINDRES@
@@ -66748,6 +66748,7 @@ AUTOCONF = autoconf
 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+   $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/Makefile.tpl b/Makefile.tpl
index 4fdca604eb0..6586e907964 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -420,7 +420,7 @@ MAKEINFOFLAGS = --split-size=500
 # -
 
 AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
 AR_FLAGS = rc
 CC = @CC@
 CXX = @CXX@
@@ -431,7 +431,7 @@ LIPO = @LIPO@
 NM = @NM@
 OBJDUMP = @OBJDUMP@
 OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
 READELF = 

[PATCH 18/24] PR27116, Spelling errors found by Debian style checker

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

config/ChangeLog:

* override.m4: Correct comment grammar.
---
 config/override.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/override.m4 b/config/override.m4
index d3e815bb1b4..5a1bffe6018 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -32,7 +32,7 @@ m4_ifndef([_GCC_AUTOCONF_VERSION],
   [m4_define([_GCC_AUTOCONF_VERSION], [2.69])])
 
 dnl Test for the exact version when AC_INIT is expanded.
-dnl This allows to update the tree in steps (for testing)
+dnl This allows one to update the tree in steps (for testing)
 dnl by putting
 dnl   m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
 dnl in configure.ac before AC_INIT,
-- 
2.41.0



[PATCH 12/24] Pass PKG_CONFIG_PATH down from top-level Makefile

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Simon Marchi 

[Sending to binutils, gdb-patches and gcc-patches, since it touches the
top-level Makefile/configure]

I have my debuginfod library installed in a non-standard location
(/opt/debuginfod), which requires me to set
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
configure:

$ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
--with-debuginfod
$ make

or

$ ./configure --with-debuginfod 
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
$ make

Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
configure.  When running make (which runs gdb's and binutils'
configure), PKG_CONFIG_PATH is not set, which results in their configure
script not finding the library:

checking for libdebuginfod >= 0.179... no
configure: error: "--with-debuginfod was given, but libdebuginfod is 
missing or unusable."

Change the top-level configure/Makefile system to capture the value
passed when configuring the top-level and pass it down to
subdirectories (similar to CFLAGS, LDFLAGS, etc).

I don't know much about the top-level build system, so I really don't
know if I did this correctly.  The changes are:

 - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
   @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
   in config files (i.e. Makefile)
 - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
   to @PKG_CONFIG_PATH@
 - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
   variables set when running the sub-configures

I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
I don't think it's needed.  AFAIU, this defines the flags to pass down
when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
be passed down during configure.  After that, it's captured in
gdb/config.status, so even if a "make" causes a re-configure later
(because gdb/configure has changed, for example), the PKG_CONFIG_PATH
value will be remembered.

Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf

ChangeLog:

* configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
* configure: Re-generate.
* Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
(PKG_CONFIG_PATH): New.
* Makefile.in: Re-generate.
---
 Makefile.in  | 3 +++
 Makefile.tpl | 3 +++
 configure| 2 ++
 configure.ac | 1 +
 4 files changed, 9 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index f177ce176fb..214a2a15544 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -221,6 +221,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -447,6 +448,8 @@ GOCFLAGS = $(CFLAGS)
 GDCFLAGS = @GDCFLAGS@
 GM2FLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/Makefile.tpl b/Makefile.tpl
index 6586e907964..36fa20950d4 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -224,6 +224,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -450,6 +451,8 @@ GOCFLAGS = $(CFLAGS)
 GDCFLAGS = @GDCFLAGS@
 GM2FLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/configure b/configure
index faa1aedaa04..b6b7487f834 100755
--- a/configure
+++ b/configure
@@ -622,6 +622,7 @@ CXX_FOR_TARGET
 CC_FOR_TARGET
 RANLIB_PLUGIN_OPTION
 AR_PLUGIN_OPTION
+PKG_CONFIG_PATH
 GDCFLAGS
 READELF
 OTOOL
@@ -13017,6 +13018,7 @@ fi
 
 GDCFLAGS=${GDCFLAGS-${CFLAGS}}
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
 $as_echo_n "checking for -plugin option... " >&6; }
 
diff --git a/configure.ac b/configure.ac
index a0dff0ecac8..39e5649f360 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3708,6 +3708,7 @@ AC_SUBST(CXXFLAGS)
 AC_SUBST(GDC)
 AC_SUBST(GDCFLAGS)
 GDCFLAGS=${GDCFLAGS-${CFLAGS}}
+AC_SUBST(PKG_CONFIG_PATH)
 
 GCC_PLUGIN_OPTION(PLUGIN_OPTION)
 AR_PLUGIN_OPTION=
-- 
2.41.0



[PATCH 05/24] GCC: Check if AR works with --plugin and rc

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

AR from older binutils doesn't work with --plugin and rc:

[hjl@gnu-cfl-2 bin]$ touch foo.c
[hjl@gnu-cfl-2 bin]$ ar --plugin 
/usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
[hjl@gnu-cfl-2 bin]$ ./ar --plugin 
/usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
./ar: no operation specified
[hjl@gnu-cfl-2 bin]$ ./ar --version
GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
[hjl@gnu-cfl-2 bin]$

Check if AR works with --plugin and rc before passing --plugin to AR and
RANLIB.

ChangeLog:

* configure: Regenerated.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
--plugin and rc before enabling --plugin.

config/ChangeLog:

* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
--plugin and rc before enabling --plugin.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libiberty/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 config/gcc-plugin.m4   |  12 +
 configure  | 103 +
 gcc/configure  |  14 --
 libatomic/configure|  14 --
 libbacktrace/configure |  14 --
 libcc1/configure   |  14 --
 libffi/configure   |  14 --
 libgfortran/configure  |  14 --
 libgm2/configure   |  14 --
 libgomp/configure  |  14 --
 libiberty/configure| 103 +
 libitm/configure   |  14 --
 libobjc/configure  |  14 --
 libphobos/configure|  14 --
 libquadmath/configure  |  14 --
 libsanitizer/configure |  14 --
 libssp/configure   |  14 --
 libstdc++-v3/configure |  26 +++
 libtool.m4 |   9 +++-
 libvtv/configure   |  14 --
 lto-plugin/configure   |  14 --
 zlib/configure |  14 --
 22 files changed, 430 insertions(+), 61 deletions(-)

diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index d782d52858e..c731a6fab38 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -150,6 +150,18 @@ for plugin in $plugin_names; do
 break
   fi
 done
+dnl Check if ${AR} $plugin_option rc works.
+AC_CHECK_TOOL(AR, ar)
+if test "${AR}" = "" ; then
+  AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
+fi
+touch conftest.c
+${AR} $plugin_option rc conftest.a conftest.c
+if test "$?" != 0; then
+  AC_MSG_WARN([Failed: $AR $plugin_option rc])
+  plugin_option=
+fi
+rm -f conftest.*
 if test -n "$plugin_option"; then
   $1="$plugin_option"
   AC_MSG_RESULT($plugin_option)
diff --git a/configure b/configure
index 4aa1ca21a38..3fe4a1804cf 100755
--- a/configure
+++ b/configure
@@ -12966,6 +12966,109 @@ for plugin in $plugin_names; do
 break
   fi
 done
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program 
name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ac_cv_prog_AR="${ac_tool_prefix}ar"
+$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" 
>&5
+break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5

[PATCH 07/24] binutils, gdb: support zstd compressed debug sections

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Fangrui Song 

PR29397 PR29563: Add new configure option --with-zstd which defaults to
auto.  If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support
zstd compressed debug sections for most tools.

* bfd: for addr2line, objdump --dwarf, gdb, etc
* gas: support --compress-debug-sections=zstd
* ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd
* objcopy: support ELFCOMPRESS_ZSTD input for
  --decompress-debug-sections and --compress-debug-sections=zstd
* gdb: support ELFCOMPRESS_ZSTD input.  The bfd change references zstd
  symbols, so gdb has to link against -lzstd in this patch.

If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error.  We
can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this
is too heavyweight, so don't do it for now.

```
% ld/ld-new a.o
ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not 
built with zstd support
...

% ld/ld-new a.o --compress-debug-sections=zstd
ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support

% binutils/objcopy --compress-debug-sections=zstd a.o b.o
binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with 
zstd support

% binutils/objcopy b.o --decompress-debug-sections
binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but 
BFD is not built with zstd support
...
```

config/ChangeLog:

* zstd.m4: New file.

ChangeLog:
* configure: Regenerate.
* configure.ac: Add --with-zstd.
---
 config/zstd.m4 | 23 +++
 configure  | 10 ++
 configure.ac   |  3 +++
 3 files changed, 36 insertions(+)
 create mode 100644 config/zstd.m4

diff --git a/config/zstd.m4 b/config/zstd.m4
new file mode 100644
index 000..6da4db68c58
--- /dev/null
+++ b/config/zstd.m4
@@ -0,0 +1,23 @@
+dnl Copyright (C) 2022 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl Enable features using the zstd library.
+AC_DEFUN([AC_ZSTD], [
+AC_ARG_WITH(zstd,
+  [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections 
(default=auto)])],
+  [], [with_zstd=auto])
+
+AS_IF([test "$with_zstd" != no],
+  [PKG_CHECK_MODULES(ZSTD, [libzstd], [
+AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
+  ], [
+if test "$with_zstd" = yes; then
+  AC_MSG_ERROR([--with-zstd was given, but pkgconfig/libzstd.pc is not 
found])
+fi
+  ])
+  ])
+])
diff --git a/configure b/configure
index 04369383079..a5f6282bb0e 100755
--- a/configure
+++ b/configure
@@ -800,6 +800,7 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 with_system_zlib
+with_zstd
 enable_as_accelerator_for
 enable_offload_targets
 enable_offload_defaulted
@@ -1589,6 +1590,8 @@ Optional Packages:
   --without-PACKAGE   do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build 
system
   --with-system-zlib  use installed libz
+  --with-zstd Support zstd compressed debug sections
+  (default=auto)
   --with-mpc=PATH specify prefix directory for installed MPC package.
   Equivalent to --with-mpc-include=PATH/include plus
   --with-mpc-lib=PATH/lib
@@ -2962,6 +2965,13 @@ if test x$with_system_readline = xyes ; then
   noconfigdirs="$noconfigdirs readline"
 fi
 
+
+# Check whether --with-zstd was given.
+if test "${with_zstd+set}" = set; then :
+  withval=$with_zstd;
+fi
+
+
 # some tools are so dependent upon X11 that if we're not building with X,
 # it's not even worth trying to configure, much less build, that tool.
 
diff --git a/configure.ac b/configure.ac
index 3632216fd1c..e820940c81e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,6 +254,9 @@ if test x$with_system_readline = xyes ; then
   noconfigdirs="$noconfigdirs readline"
 fi
 
+AC_ARG_WITH(zstd,
+[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections 
(default=auto)])])
+
 # some tools are so dependent upon X11 that if we're not building with X, 
 # it's not even worth trying to configure, much less build, that tool.
 
-- 
2.41.0



[PATCH 08/24] configure: require libzstd >= 1.4.0

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Christophe Lyon 

gas uses ZSTD_compressStream2 which is only available with libzstd >=
1.4.0, leading to build errors when an older version is installed.

This patch updates the check libzstd presence to check its version is
>= 1.4.0. However, since gas seems to be the only component requiring
such a recent version this may imply that we disable ZSTD support for
all components although some would still benefit from an older
version.

I ran 'autoreconf -f' in all directories containing a configure.ac
file, using vanilla autoconf-2.69 and automake-1.15.1. I noticed
several errors from autoheader in readline, as well as warnings in
intl, but they are unrelated to this patch.

This should fix some of the buildbots.

OK for trunk?

Thanks,

Christophe

config/ChangeLog:

* zstd.m4: Add minimum version requirement of 1.4.0.
---
 config/zstd.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/zstd.m4 b/config/zstd.m4
index 6da4db68c58..eb34c0f36d7 100644
--- a/config/zstd.m4
+++ b/config/zstd.m4
@@ -12,7 +12,7 @@ AC_ARG_WITH(zstd,
   [], [with_zstd=auto])
 
 AS_IF([test "$with_zstd" != no],
-  [PKG_CHECK_MODULES(ZSTD, [libzstd], [
+  [PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.4.0], [
 AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
   ], [
 if test "$with_zstd" = yes; then
-- 
2.41.0



[PATCH 02/24] PR29961, plugin-api.h: "Could not detect architecture endianess"

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Found when attempting to build binutils on sparc sunos-5.8 where
sys/byteorder.h defines _BIG_ENDIAN but not any of the BYTE_ORDER
variants.  This patch adds the extra tests to cope with the old
machine, and tidies the header a little.

include/ChangeLog:

* plugin-api.h: When handling non-gcc or gcc < 4.6.0 include
necessary header files before testing macros.  Make more use
of #elif.  Test _LITTLE_ENDIAN and _BIG_ENDIAN in final tests.
---
 include/plugin-api.h | 49 ++--
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/include/plugin-api.h b/include/plugin-api.h
index 395d5bcc598..f3cf2d8101b 100644
--- a/include/plugin-api.h
+++ b/include/plugin-api.h
@@ -37,7 +37,7 @@
 #error cannot find uint64_t type
 #endif
 
-/* Detect endianess based on __BYTE_ORDER__ macro.  */
+/* Detect endianess based on gcc's (>=4.6.0) __BYTE_ORDER__ macro.  */
 #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
 defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_PDP_ENDIAN__)
 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
@@ -47,46 +47,47 @@
 #elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
 #define PLUGIN_PDP_ENDIAN 1
 #endif
+
 #else
-/* Older GCC releases (<4.6.0) can make detection from glibc macros.  */
+/* Include header files to define endian macros.  */
 #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) || defined(__ANDROID__)
 #include 
-#ifdef __BYTE_ORDER
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define PLUGIN_LITTLE_ENDIAN 1
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define PLUGIN_BIG_ENDIAN 1
-#endif
-#endif
-#endif
-/* Include all necessary header files based on target.  */
-#if defined(__SVR4) && defined(__sun)
+
+#elif defined(__SVR4) && defined(__sun)
 #include 
-#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || \
-defined(__DragonFly__) || defined(__minix)
+
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || \
+  defined(__DragonFly__) || defined(__minix)
 #include 
-#endif
-#if defined(__OpenBSD__)
+
+#elif defined(__OpenBSD__)
 #include 
 #endif
+
+/* Detect endianess based on __BYTE_ORDER.  */
+#ifdef __BYTE_ORDER
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define PLUGIN_LITTLE_ENDIAN 1
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define PLUGIN_BIG_ENDIAN 1
+#endif
+
 /* Detect endianess based on _BYTE_ORDER.  */
-#ifdef _BYTE_ORDER
+#elif defined _BYTE_ORDER
 #if _BYTE_ORDER == _LITTLE_ENDIAN
 #define PLUGIN_LITTLE_ENDIAN 1
 #elif _BYTE_ORDER == _BIG_ENDIAN
 #define PLUGIN_BIG_ENDIAN 1
 #endif
-#endif
+
 /* Detect based on _WIN32.  */
-#if defined(_WIN32)
+#elif defined _WIN32
 #define PLUGIN_LITTLE_ENDIAN 1
-#endif
+
 /* Detect based on __BIG_ENDIAN__ and __LITTLE_ENDIAN__ */
-#ifdef __LITTLE_ENDIAN__
+#elif defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
 #define PLUGIN_LITTLE_ENDIAN 1
-#endif
-#ifdef __BIG_ENDIAN__
+#elif defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
 #define PLUGIN_BIG_ENDIAN 1
 #endif
 #endif
-- 
2.41.0



[PATCH 06/24] toplevel: Recover tilegx/tilepro targets

2023-08-07 Thread Arsen Arsenović via Gcc-patches
These are still supported in Binutils.

ChangeLog:

* configure: Regenerate.
* configure.ac: Recover tilegx/tilepro targets.
---
 configure| 5 -
 configure.ac | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 3fe4a1804cf..04369383079 100755
--- a/configure
+++ b/configure
@@ -3072,7 +3072,7 @@ case "${ENABLE_GOLD}" in
   # Check for target supported by gold.
   case "${target}" in
 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
-| aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
+| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
  configdirs="$configdirs gold"
  if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold
@@ -3977,6 +3977,9 @@ case "${target}" in
   tic6x-*-*)
 noconfigdirs="$noconfigdirs sim"
 ;;
+  tilepro*-*-* | tilegx*-*-*)
+noconfigdirs="$noconfigdirs sim"
+;;
   v810-*-*)
 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes 
target-libgloss"
 ;;
diff --git a/configure.ac b/configure.ac
index a11b1006427..3632216fd1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -360,7 +360,7 @@ case "${ENABLE_GOLD}" in
   # Check for target supported by gold.
   case "${target}" in
 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
-| aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
+| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
  configdirs="$configdirs gold"
  if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold
@@ -1227,6 +1227,9 @@ case "${target}" in
   tic6x-*-*)
 noconfigdirs="$noconfigdirs sim"
 ;;
+  tilepro*-*-* | tilegx*-*-*)
+noconfigdirs="$noconfigdirs sim"
+;;
   v810-*-*)
 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes 
target-libgloss"
 ;;
-- 
2.41.0



[PATCH 11/24] Disable year 2038 support on 32-bit hosts by default

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Luis Machado 

With a recent import of gnulib, code has been pulled that tests and enables
64-bit time_t by default on 32-bit hosts that support it.

Although gdb can use the gnulib support, bfd doesn't use gnulib and currently
doesn't do these checks.

As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll
have a mismatch between gdb's notion of time_t and bfd's notion of time_t.

This will lead to mismatches in the struct stat size, leading to memory
corruption and crashes.

This patch disables the year 2038 check for now, which makes things work
reliably again.

I'd consider this a temporary fix until we have proper bfd checks for the year
2038, if it makes sense.  64-bit hosts seems to be more common these days, so
I'm not sure how important it is to have this support enabled and how soon
we want to enable it.

Thoughts?

ChangeLog:

* configure.ac: Disable year2038 by default on 32-bit hosts.
* configure: Regenerate.
---
 configure| 22 ++
 configure.ac | 18 ++
 2 files changed, 40 insertions(+)

diff --git a/configure b/configure
index 35c0c75ee12..faa1aedaa04 100755
--- a/configure
+++ b/configure
@@ -809,6 +809,7 @@ enable_ld
 enable_gprofng
 enable_compressed_debug_sections
 enable_default_compressed_debug_sections_algorithm
+enable_year2038
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
@@ -1552,6 +1553,7 @@ Optional Features:
   --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
   Default compression algorithm for
   --enable-compressed-debug-sections.
+  --enable-year2038   enable support for timestamps past the year 2038
   --disable-libquadmath   do not build libquadmath directory
   --disable-libquadmath-support
   disable libquadmath support for Fortran
@@ -3194,6 +3196,20 @@ case "${host}" in
 ;;
 esac
 
+# Default to --disable-year2038 until we can handle differences between
+# projects that use gnulib (which understands year 2038) and projects that
+# do not (like BFD).
+# Check whether --enable-year2038 was given.
+if test "${enable_year2038+set}" = set; then :
+  enableval=$enable_year2038; ENABLE_YEAR2038=$enableval
+else
+  ENABLE_YEAR2038=no
+fi
+
+enable_year2038=
+if test "${ENABLE_YEAR2038}" = "no" ; then
+  enable_year2038=no
+fi
 
 # Check whether --enable-libquadmath was given.
 if test "${enable_libquadmath+set}" = set; then :
@@ -10215,9 +10231,15 @@ if test "$silent" = yes; then
   baseargs="$baseargs --silent"
   tbaseargs="$tbaseargs --silent"
 fi
+
 baseargs="$baseargs --disable-option-checking"
 tbaseargs="$tbaseargs --disable-option-checking"
 
+if test "$enable_year2038" = no; then
+  baseargs="$baseargs --disable-year2038"
+  tbaseargs="$tbaseargs --disable-year2038"
+fi
+
 # Record and document user additions to sub configure arguments.
 
 
diff --git a/configure.ac b/configure.ac
index 71b923d316f..a0dff0ecac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -459,6 +459,18 @@ case "${host}" in
 ;;
 esac
 
+# Default to --disable-year2038 until we can handle differences between
+# projects that use gnulib (which understands year 2038) and projects that
+# do not (like BFD).
+AC_ARG_ENABLE(year2038,
+AS_HELP_STRING([--enable-year2038],
+  [enable support for timestamps past the year 2038]),
+ENABLE_YEAR2038=$enableval,
+ENABLE_YEAR2038=no)
+enable_year2038=
+if test "${ENABLE_YEAR2038}" = "no" ; then
+  enable_year2038=no
+fi
 
 AC_ARG_ENABLE(libquadmath,
 AS_HELP_STRING([--disable-libquadmath],
@@ -3339,9 +3351,15 @@ if test "$silent" = yes; then
   baseargs="$baseargs --silent"
   tbaseargs="$tbaseargs --silent"
 fi
+
 baseargs="$baseargs --disable-option-checking"
 tbaseargs="$tbaseargs --disable-option-checking"
 
+if test "$enable_year2038" = no; then
+  baseargs="$baseargs --disable-year2038"
+  tbaseargs="$tbaseargs --disable-year2038"
+fi
+
 # Record and document user additions to sub configure arguments.
 AC_ARG_VAR([build_configargs],
   [additional configure arguments for build directories])
-- 
2.41.0



[PATCH 03/24] gcc-4.5 build fixes

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Trying to build binutils with an older gcc currently fails.  Working
around these gcc bugs is not onerous so let's fix them.

include/ChangeLog:

* xtensa-dynconfig.h (xtensa_isa_internal): Delete unnecessary
forward declaration.
---
 include/xtensa-dynconfig.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/xtensa-dynconfig.h b/include/xtensa-dynconfig.h
index 48877ebb6b6..45d54dcd0e0 100644
--- a/include/xtensa-dynconfig.h
+++ b/include/xtensa-dynconfig.h
@@ -121,8 +121,6 @@ struct xtensa_config_v4
   int xchal_unaligned_store_hw;
 };
 
-typedef struct xtensa_isa_internal_struct xtensa_isa_internal;
-
 extern const void *xtensa_load_config (const char *name,
   const void *no_plugin_def,
   const void *no_name_def);
-- 
2.41.0



  1   2   3   >