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

Message ID 20230925153247.908901-1-arsen@aarsen.me
Headers
Series Replace intl/ with out-of-tree GNU gettext |

Message

Arsen Arsenović Sept. 25, 2023, 3:13 p.m. UTC
  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.

During that work I also noticed that the .pot files fail to regenerate
with new xgettext, leading to the discovery of a regression, but also a
slight simplification that can be made in the .pot file generation:
https://savannah.gnu.org/bugs/?64490#comment4

Brunos recommendation is included.  Thanks!

I've omitted a patch that simply drops the intl/ directory from this
patchset, as it was held for moderation on the GCC ML, and I suspect the
same would happen here.  It can be seen at:
https://git.sr.ht/~arsen/binutils-gdb/commit/300747ed91e6652e4e20b876c19b3c86c75ac57f

Note that this patch series results in some new symbols in
libinproctrace.so:

  ~/binutils-bld/gdbserver$ nm -g libinproctrace.so | grep libintl
  0000000000015090 T libintl_dcgettext
  0000000000015080 T libintl_gettext
  0000000000019a90 T libintl_set_relocation_prefix

This happens because the library gets linked against libintl.a (because
it is required by ax.cc, gdbserver/ax.cc:925:(.text+0x2f8): undefined
reference to `libintl_gettext'), and so, the default visibility symbols
from libintl.a 'leak' through.  I am decently sure this was also the
case with the in-tree intl implementation, though.

Perhaps it'd be good to add a version script to this library, to be more
selective about symbols.

Tested on x86_64-pc-linux-gnu --with-included-gettext,
x86_64-portbld-freebsd13.1, x86_64-darwin21, i686-darwin9 and
aarch64-darwin21 (thanks, Iain).

Example from FreeBSD:

  [arsen@fbsd132 ~/binutils-bld/_pfx/bin]$ LANG=sr_RS.UTF-8 ./ld --version
  ГНУ лд (GNU Binutils) 2.41.50.20230924
  Copyright (C) 2023 Free Software Foundation, Inc.
  Овај програм је слободан софтвер; можете да га расподељујете под одредбама
  Гнуове опште јавне лиценце издања 3 или (према вашем мишљењу) било ког
  новијег издања. Овај програм нема никакву гаранцију.
  [arsen@fbsd132 ~/binutils-bld/_pfx/bin]$ LANG=fr_FR.UTF-8 ./as --version
  Assembleur GNU (GNU Binutils) 2.41.50.20230924
  Copyright © 2023 Free Software Foundation, Inc.
  Ce logiciel est libre; vous pouvez le redistribuer selon les termes de la
  version 3 de la licence GNU General Public License ou suivante.
  Ce programme n'est couvert par AUCUNE garantie.
  Cet assembleur a été configuré pour la cible « x86_64-unknown-freebsd13.2 ».
  [arsen@fbsd132 ~/binutils-bld/_pfx/bin]$ LANG=fr_FR.UTF-8 ./gprof --version
  GNU gprof (GNU Binutils) 2.41.50.20230924
  Basé sur BSD gprof, copyright 1983 Regents de l'Université de Californie.
  Ce logiciel est libre. AUCUNE garantie ne lui est apportée.

A similar patch was also sent to the GCC developers for evaluation.  We
should coordinate to merge them around the same time, so that the same
code is merged.

Thanks in advance, have a lovely day.

Arsen Arsenović (2):
  *: add modern gettext support
  *: suppress xgettext 0.22 charset name error

 .gitignore               |    1 +
 Makefile.def             |   72 +-
 Makefile.in              | 1612 +++++++++++-----------
 bfd/aclocal.m4           |   10 +-
 bfd/configure            | 1980 ++++++++++++++++++++++++++-
 bfd/configure.ac         |    2 +-
 bfd/po/Make-in           |    8 +-
 binutils/aclocal.m4      |    2 +
 binutils/configure       | 2546 ++++++++++++++++++++++++++---------
 binutils/po/Make-in      |    5 +-
 config/gettext-sister.m4 |   35 +-
 config/gettext.m4        |  357 +++--
 config/iconv.m4          |  313 +++--
 config/intlmacosx.m4     |   65 +
 configure                |   44 +-
 configure.ac             |   44 +-
 gas/aclocal.m4           |    6 +
 gas/configure            | 1980 ++++++++++++++++++++++++++-
 gas/po/Make-in           |    5 +-
 gdb/acinclude.m4         |    3 +-
 gdb/aclocal.m4           |    5 +
 gdb/configure            | 2739 ++++++++++++++++++++++++++++----------
 gdb/configure.ac         |    3 +-
 gdbserver/Makefile.in    |    3 +-
 gdbserver/aclocal.m4     |    6 +
 gdbserver/configure      | 1817 ++++++++++++++++++++++++-
 gdbsupport/Makefile.am   |    1 +
 gdbsupport/aclocal.m4    |    6 +
 gdbsupport/configure     | 2109 ++++++++++++++++++++++++++---
 gold/aclocal.m4          |    8 +-
 gold/configure           | 1977 ++++++++++++++++++++++++++-
 gold/po/Make-in          |    5 +-
 gprof/aclocal.m4         |    6 +
 gprof/configure          | 1980 ++++++++++++++++++++++++++-
 gprof/po/Make-in         |    5 +-
 ld/aclocal.m4            |    6 +
 ld/configure             | 1980 ++++++++++++++++++++++++++-
 ld/po/Make-in            |    8 +-
 libctf/Makefile.am       |    2 +
 libctf/aclocal.m4        |    9 +
 libctf/configure         | 1952 ++++++++++++++++++++++++++-
 libctf/configure.ac      |    2 +-
 opcodes/aclocal.m4       |    6 +
 opcodes/configure        | 1980 ++++++++++++++++++++++++++-
 opcodes/configure.ac     |    2 +-
 opcodes/po/Make-in       |    5 +-
 46 files changed, 22750 insertions(+), 2962 deletions(-)
 create mode 100644 config/intlmacosx.m4
  

Comments

Kevin Buettner Sept. 25, 2023, 7:11 p.m. UTC | #1
On Mon, 25 Sep 2023 17:13:39 +0200
Arsen Arsenović via Gdb-patches <gdb-patches@sourceware.org> wrote:

> Arsen Arsenović (2):
>   *: add modern gettext support
>   *: suppress xgettext 0.22 charset name error

I haven't seen part 1, "add modern gettext support", in either email that
I receive from the list(s) or in the public archives.

Kevin
  
Arsen Arsenović Sept. 25, 2023, 7:43 p.m. UTC | #2
Kevin Buettner <kevinb@redhat.com> writes:

> On Mon, 25 Sep 2023 17:13:39 +0200
> Arsen Arsenović via Gdb-patches <gdb-patches@sourceware.org> wrote:
>
>> Arsen Arsenović (2):
>>   *: add modern gettext support
>>   *: suppress xgettext 0.22 charset name error
>
> I haven't seen part 1, "add modern gettext support", in either email that
> I receive from the list(s) or in the public archives.

Yes, it was held for moderation due to size.  It should be visible here:
https://inbox.sourceware.org/gdb-patches/20230925153247.908901-2-arsen@aarsen.me/

I'll send a v2 when the conversation under [PATCH 2/2] settles, and trim
that patch a bit (remove regenerated files) so that it fits under the
size limit.

Apologies for the inconvenience.

Have a lovely night!