From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 534433858D32; Tue, 16 Apr 2024 06:55:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 534433858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 534433858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::533 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713250527; cv=none; b=cXcs9XiC890TZfmOXBfUVTBuIFWnnMi/gVY5WuOfWl63ZsDOEtyg3NH4kccrngjAgLG0LrbChe47AwonQjKfXFNoocbKkdsBZ634fJbVpdc9p/jt1Q0rZ3A+Dpx0r1/YFg/B/6ov16RCSdqYzYnz5EVotzVI6kEJEixLpFWXgGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713250527; c=relaxed/simple; bh=zYiUxKFsdI5STF53lPb9ezJgnSh96/HKlIfKbHZlrIY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=hu4TzsKzVXGOcsltzkrTFcwqjH05tD/gZEiQkLAibCNFIQd2HC9HxvQpMQVnXUWgAMiMIXyzbvrsjzYa7fxIcKHxo7t8H+uBGRAPXECB2dGRe6pKzeH7MCSDfTC1X4z8A9b3uPppKJ9K0TiU7pBK9fvM4830IbJDFke10J0tTzc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57009454c83so3253311a12.2; Mon, 15 Apr 2024 23:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713250523; x=1713855323; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=i09wQ+7LFbvgai9b7zqVVGkwudnBRBsTm0YIEoXn3tw=; b=Wp0Ghzvbvsjdheubnu/LHOv010Faq5yPfYWjE5rxk/ZhbY69giIsNueb6xPWopdNuZ 8oxnMreoXVDODLaya56bPFVu9DaCJkZzdsde7IGv2jQR+gBg9KCrklmrB6IORu8shyS/ 1iBqPeCVtYKOThC1evtcJOLpVfVx0ctz7TelbVv2z5PIq3tSyaraB3L1r6ZDyetO48TI upMMHmnxl4jkqiUuydhxpB5S+019D7DRt/UGWE1EHcso+mk/y4woslWKXX11qX/fXZnS psEjqqhweCNv6SI/7asNH5L2jUeywIRqtw/8i3YkPzSdqeTpwjVjSkHQeDU1DhCAw/RF wq1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713250523; x=1713855323; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=i09wQ+7LFbvgai9b7zqVVGkwudnBRBsTm0YIEoXn3tw=; b=JSuT1DQ+1SV3Di9CNnRzwn1+Yn4ZihtdrOc2c5O8xAiaMJxVgBpehyiEPNsOqtV3FL 39rFIAL38WWQw45JVvBX0a/ToI7smgdq5vuEXCD4JFWaK531jH8LcHvFTbBBu5HODem4 m7FHmQMWImv9tj3Ss9aTO1OfWSmHqnhXCVdFnNjksDk09+CEoVW52C0VuDXB1tRwZ3Y/ f/anzM5a0dj9+gsMtlnNvddvvKcZvIHXnZZ0ahP77l/9ih14QFfY8EE0AIray2zJi8Or 4Dxr4KdSoSw8bcL7K6eQfBpkhfiXTuqPLWRIuZcQtPeLj0AA7b6Pa/OocOOEF9vaOKaQ r3hw== X-Forwarded-Encrypted: i=1; AJvYcCUbxDl5uf1778xF3yPwVEb/7+bJUnhK33FAfRX+O61KWH62f+x/tPx/7Y2ifQHIkRGg8h5bTMHTS9DvomxBd+c7AgCQZ8Y= X-Gm-Message-State: AOJu0YwhTh76PIWJTg1AvKXaabRTcb/uhbiC1A/wB8DO/t+HY0O96Nlt 8u5bacW/Lv6oa+++bIzOtr5FJLcT25Nkh/JsIzH+qolC9bZT+qdDmh9O4Vdk0pCeSPOt5mlg6MF eZQ4BsosM2HMLwZL22GGjW6q9c1PZbmeq X-Google-Smtp-Source: AGHT+IFXl6khRYby++r95cpKmshekV2f5hC7vnkMOyZDHw3D0kDk3XKxrkuZ6/48juHPyoOpYTrrlcjbJG9xGSuKhPY= X-Received: by 2002:a17:907:6d17:b0:a55:3e15:baab with SMTP id sa23-20020a1709076d1700b00a553e15baabmr896259ejc.38.1713250522728; Mon, 15 Apr 2024 23:55:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Tue, 16 Apr 2024 07:55:11 +0100 Message-ID: Subject: Re: [PATCH] [libstdc++] introduce --disable-compat-libstdcxx-abi To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 16 Apr 2024 at 04:37, Alexandre Oliva wrote: > > > A number of libstdc++ tests that implicitly instantiate > __to_chars_i 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 clock_gettime function. > +

--disable-compat-libstdcxx-abi

Disables > + backward-compatibility ABI symbols. >

--enable-libstdcxx-debug

Build separate debug libraries in addition to what is normally built. > By default, the debug libraries are compiled with > CXXFLAGS='-g3 -O0 -fno-inline' 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.