From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 43166385740F for ; Tue, 9 Aug 2022 15:09:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 43166385740F Received: by mail-ot1-x335.google.com with SMTP id q6-20020a05683033c600b0061d2f64df5dso8647009ott.13 for ; Tue, 09 Aug 2022 08:09:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=gfsPDZMrwTue4o73h5bMJkFuhrIP+uyvb2L7SAvwdHs=; b=Iswr//vHL2LQK13rpvzI2Hw2VqqbzK292rNXrBIhwjLqT7Jg653p7i6cpVH0YrIDqG ka07CsbludbHlN1O5f7NGCfl4Os7eAtm0ItuiaSF08mbXKOx172FySoZkB0zY85qwekH cIOTnTlopTWchYf3AxG9D7Qy13hngZi+ZQnXf/V50cJYGXB38yzY1hSWhyNeFbccJDmB 36yWR33ZRX1hm2UuYqZuBhBVacxKl8TwarHK901nYVbKHeFNOeSTUlqS5nveCRIM5sVr hnZL/9bYzwyli1ZpVfOfmVYIP/ghyFo6qI2zozLuInKl+pMMYC0MdCKxJecA+G8ip4Pk osLQ== X-Gm-Message-State: ACgBeo2jIRhzwePhRBexdRlZfFBNoId3xR8WcqGOHiKkGNSVwhS3bn7R 4ZfmiS3mGRmUTt42NvUD9ibxS/HwG3lnjplkRV29QvhJ01BZYw== X-Google-Smtp-Source: AA6agR5BLjM8F3XIxUnFoU6o0rk3k0szPio4JcEc2oHUKzZN5uCXFM7r2i29rBKY+fwQVbPHZBv6mqGfYKbRsMqMDx4= X-Received: by 2002:a9d:7a8d:0:b0:636:eb5c:df96 with SMTP id l13-20020a9d7a8d000000b00636eb5cdf96mr3282117otn.173.1660057778316; Tue, 09 Aug 2022 08:09:38 -0700 (PDT) MIME-Version: 1.0 From: YumeYao Date: Tue, 9 Aug 2022 23:09:26 +0800 Message-ID: Subject: libstdc++ ABI update rule? (baseline_symbols.txt) To: libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2022 15:09:40 -0000 Hi All, I'm trying to do some experimental optimization to libstdc++, which involves heavy use of __builtin_constant_p(), this, however, eventually impacts how gcc calculate inlining or not, hence I got error when testing libstdc++ about ABI changes. Specifically, I met most of such issues when optimizing basic_string. Then I tried fix the ABI changes by templatizing the functions, adding __attribute__((always_inline)) and even gnu_inline(sometimes adding only always_inline breaks the optimization, I noticed this issue very long ago...) to the failed parts, which in turn makes other existing functions in libstdc++ got uninlined and present in libstdc++.so as ABI changes of added symbols/functions. What really confuses me is the following fact: without any attribute notation and only by templatizing functions, I managed to get a version working on some old gcc version without any abi change. But it then failed when I migrated it to a newer version. I have some basic knowledge about extern template and inlining and symbols, etc. and I tried to find the answers from gcc source, but obviously there's something beyond the source. I know inline decision is calculated by pseudo "cost", therefore not only the change in library could make an ABI change, but also the logic change in gcc inline calculator could make such change, even more, how the user uses the code can also make a difference on inline decision because the times or frequency of using a library function can also impact the inline decision. So I want to ask: 1. how the ABI of libstdc++ is maintained in gcc, just update baseline_symbols.txt unconditionally when preparing for a release? 2. How does gcc decide to put which symbol to libstdc++.so? I can see files named xxxx-inst(antiation).cc but obviously some symbols not belonging to it get instantiated and put in libstdc++.so Thanks in advance, yumeyao