From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id BACE23848404 for ; Mon, 14 Jun 2021 05:44:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BACE23848404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mforney.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=mforney.org Received: by mail-pj1-x102a.google.com with SMTP id z3-20020a17090a3983b029016bc232e40bso9451060pjb.4 for ; Sun, 13 Jun 2021 22:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ub/QlGSZ+k/ADlEKFAC03EGlOZ6PDPeFTW7QQH06mKI=; b=I0zTwMTi8sLggUmHP2PbcldbUA/QX9HZ+V+fGnWKf+NqBksK7IKG1cB+xRXNU+jU2+ qC6Kwsos1nZgFizYzX6jhHV6x7WbeE09rP7VNpWbhORJuJwRvx++igB1Z9lpecF6fdIN LeStFNbiA21bT3x7JpmuzFQyYWIEq4cdhdBwk0uOmNjEASz8MLX6IgeZn72J2NztRKkX Ly1TN9XMoHqTwKAgYnABKKvkLIy2mlzwn1CtwAsrergV7Pas/OgfLPWCdN39k3a50r6+ sKgMLrRyxtDEoW/olgGAWfKNn4iFsSJnkQbNkDB8lr52Fo/OdR8Kn+uLKF2/MlBfZt3V M9rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ub/QlGSZ+k/ADlEKFAC03EGlOZ6PDPeFTW7QQH06mKI=; b=QJ7y77cAqxLJyb+8O1iGIIGPmgZv9XflfTsQpBb5qX4YdoxcTvUUoOkpSmfpk6MSoy KiDKvIBKeFW7y6cEx2KYWyeh4D1H+cFGPQ/aTCxZ2URrpBct2k2x8uupMXhMKEx7xsFw NUW4t7Ex6SX2oZglkXfPhtC0jz3jeoOyhRV9hfIGbADeU72gKxbNwAvJNakap7S/gHiH 4+4H+2S0rvQP/AjqNYiYQODEJBP8Xcx/ShO+T79tgib2KEbR9M5Kf91RIbp6IpPexRTF XZb3GsVDWp9Wgox8sgk7m4AXnSs+rygJtOd3wnwDtg+4iF1WI4IKUUf2Z4wJiE3mDE78 7Xig== X-Gm-Message-State: AOAM532frVn5fHD8HG6/qwuBYzOzeVaWerJU+tZCvf2F5b5tF0OHfHqv K2fahUDkZEF2EWv0AHgwoLc8bhr7NGPFL5ud X-Google-Smtp-Source: ABdhPJxzU2cd7ucVRNe1ZOHXnoEpGDdydEJxoJWKnsuQzed0EaU5GAJM5roGeuLYMMzZRuMGMTRGEw== X-Received: by 2002:a17:902:d3ca:b029:104:ebfd:a554 with SMTP id w10-20020a170902d3cab0290104ebfda554mr15036901plb.13.1623649471330; Sun, 13 Jun 2021 22:44:31 -0700 (PDT) Received: from localhost ([2601:647:5180:4570:16dd:a9ff:fee7:6b79]) by smtp.gmail.com with ESMTPSA id s20sm16462814pjn.23.2021.06.13.22.44.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Jun 2021 22:44:30 -0700 (PDT) From: Michael Forney To: binutils@sourceware.org Subject: [PATCH] config: Backport "Rely less on internal symbols" (serial 68) to gettext.m4 Date: Sun, 13 Jun 2021 22:42:10 -0700 Message-Id: <20210614054210.23184-1-mforney@mforney.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 05:44:34 -0000 GNU gettext introduced this change[0] in version 0.19.8 to fix gettext detection with musl libc, since it does not define these internal symbols. This allows binutils to build with musl gettext rather than falling back to the bundled version. [0] https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commit;h=b67399b4 2021-06-13 Michael Forney config/ChangeLog: * gettext.m4 (AM_GNU_GETTEXT): Skip checks for the internal symbols _nl_msg_cat_cntr, _nl_domain_bindings, and _nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined. Backport of gettext serial 68 patch. intl/ChangeLog: * configure: Regenerate. --- This is the same patch that was recently applied to gcc, and fixes the same issue in binutils. https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=3a01d8eec23091dc24c2fb14a621ea92a262ff50 https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ed14a956aef878150e40130c99f9c1fbf2b548b1 config/gettext.m4 | 52 +++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/config/gettext.m4 b/config/gettext.m4 index 45fa6b4ab76..5b42bb16523 100644 --- a/config/gettext.m4 +++ b/config/gettext.m4 @@ -128,6 +128,13 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, [AC_TRY_LINK([#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) @@ -135,10 +142,9 @@ AC_DEFUN([AM_GNU_GETTEXT], changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], +], []), [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no)]) @@ -160,6 +166,17 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_TRY_LINK([#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0)) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) @@ -167,20 +184,26 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], +], []), [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) dnl Now see whether libintl exists and depends on libiconv. if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0)) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif ]ifelse([$2], [need-formatstring-macros], [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) @@ -188,14 +211,9 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], +], []), [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], +return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION], [LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" gt_cv_func_gnugettext_libintl=yes -- 2.31.1