From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH] [libstdc++] introduce --disable-compat-libstdcxx-abi
Date: Tue, 16 Apr 2024 07:55:11 +0100 [thread overview]
Message-ID: <CAH6eHdQx3whgsiOLy8XRyx8_G7GqiYocObf2_FmWt9Y-Tm4Pvg@mail.gmail.com> (raw)
In-Reply-To: <or5xwidlmm.fsf@lxoliva.fsfla.org>
On Tue, 16 Apr 2024 at 04:37, Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> A number of libstdc++ tests that implicitly instantiate
> __to_chars_i<unsigned int128_t> and also link floating_to_chars.o in
> fail on vxworks kernel mode. The platform doesn't support undefweak
> symbols (the kernel module loader fails to load modules containing
> them), and because creating such modules doesn't involve final
> linking, only -r linking. The vague-linkage weak defs with abi-v2
> mangling that get discarded from floating_to_chars.o because the same
> comdat section is present in the main executable. But since the
> alternate mangling is not defined in the main executable, the weak
> definition decays to a weak undefined symbol in the partially-linked
> kernel module, and then the kernel module loader barfs.
>
> Since our vxworks toolchains have little use for the compat ABI
> symbols, I thought we could work around this problem by getting rid of
> them. Absent a configure option to control that, I added one.
>
> Regstrapped on x86_64-linux-gnu. Also tested with gcc-13 on arm-,
> aarch64-, x86- and x86_64-vxworks7r2. Ok to install?
>
> PS: for an alternate path to avoid this problem, see also
> https://sourceware.org/pipermail/binutils/2024-April/133602.html
> https://sourceware.org/pipermail/binutils/2024-April/133410.html
>
>
> for libstdc++-v3/ChangeLog
>
> * acinclude.m4 (GLIBCXX_EXPORT_FLAGS): Split -Wabi=2...
> (GLIBCXX_ENABLE_WABI): ... here. Control it with newly added
> --disable-compat-libstdcxx-abi.
> * configure: Rebuilt.
> * doc/html/manual/configure.html: Document it.
> ---
> libstdc++-v3/acinclude.m4 | 26 ++++++++++++++
> libstdc++-v3/configure | 49 ++++++++++++++++++++++-----
> libstdc++-v3/doc/html/manual/configure.html | 2 +
> 3 files changed, 67 insertions(+), 10 deletions(-)
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index 51a08bcc8b1d0..4ef5d5e98c2be 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -707,10 +707,34 @@ AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
> # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
> AC_SUBST(OPTIMIZE_CXXFLAGS)
>
> - WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2"
> + WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual"
> AC_SUBST(WARN_FLAGS)
> +
> + GLIBCXX_ENABLE_WABI
> ])
>
> +dnl
> +dnl Enable -Wabi=2 if not overridden by --disable-compat-libstdcxx-abi.
> +dnl
> +AC_DEFUN([GLIBCXX_ENABLE_WABI], [
> + # Default.
> + WARN_FLAGS_WABI=\ -Wabi=2
> + AC_MSG_CHECKING([for --disable-compat-libstdcxx-abi])
> + AC_ARG_ENABLE([compat-libstdcxx-abi],
We have the GLIBCXX_ENABLE macro to simplify creating new --enable options.
> + AC_HELP_STRING([--disable-compat-libstdcxx-abi],
> + [Disable backward-compatibility ABI symbols)]),
There's a stray ')' here.
> + [case "$enableval" in
> + yes) AC_MSG_RESULT(enabled$WARN_FLAGS_WABI) ;;
> + no) WARN_FLAGS_WABI=
> + AC_MSG_RESULT(disabled) ;;
> + *) AC_MSG_RESULT(unsupported)
> + AC_MSG_ERROR([Unsupported argument to enable/disable compat libstdc++ abi]);;
> + esac], [
> + AC_MSG_RESULT(defaulting to enabled$WARN_FLAGS_WABI)
> + ])
> +
> + WARN_FLAGS="$WARN_FLAGS$WARN_FLAGS_WABI"
> +])
>
> dnl
> dnl All installation directory information is determined here.
[...]
> diff --git a/libstdc++-v3/doc/html/manual/configure.html b/libstdc++-v3/doc/html/manual/configure.html
> index 346b5d345cd1b..8636b2360d9f0 100644
> --- a/libstdc++-v3/doc/html/manual/configure.html
> +++ b/libstdc++-v3/doc/html/manual/configure.html
> @@ -108,6 +108,8 @@
> then the [time.clock] implementation will use a system call to access
> the realtime and monotonic clocks, which is significantly slower than
> the C library's <code class="function">clock_gettime</code> function.
> + </p></dd><dt><span class="term"><code class="code">--disable-compat-libstdcxx-abi</code></span></dt><dd><p>Disables
> + backward-compatibility ABI symbols.
> </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-debug</code></span></dt><dd><p>Build separate debug libraries in addition to what is normally built.
> By default, the debug libraries are compiled with
> <code class="code"> CXXFLAGS='-g3 -O0 -fno-inline'</code>
This should be in doc/xml/manual/configure.xml too, which is used to
generate the HTML using docbook. Otherwise this change will be lost
next time the docs are regenerated.
The description here in the docs (and the name of the configure
option) seem much too vague. Libstdc++ has dozens, probably hundreds,
of "backward-compatibility ABI symbols", and this only affects touches
a tiny handful of them. Just the aliases created automatically by the
compiler for mangling changes, right? From the name of the configure
option and the doc entry, I'd expect it to also affect e.g.
src/c++11/compatibility-*.cc and maybe to have some interaction with
--disable-libstdcxx-dual-abi.
The change seems fine in principle, but needs a better name and documentation.
next prev parent reply other threads:[~2024-04-16 6:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 3:36 Alexandre Oliva
2024-04-16 6:55 ` Jonathan Wakely [this message]
2024-04-18 14:45 ` Alexandre Oliva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH6eHdQx3whgsiOLy8XRyx8_G7GqiYocObf2_FmWt9Y-Tm4Pvg@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=oliva@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).