public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: YumeYao <yumeyao@gmail.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: libstdc++ ABI update rule? (baseline_symbols.txt)
Date: Wed, 10 Aug 2022 15:55:57 +0200	[thread overview]
Message-ID: <CAH6eHdSVmoh-An=g=KVy+uc823AspYhNk+pVJhMAAe62-GW4_g@mail.gmail.com> (raw)
In-Reply-To: <CALBhkEfssCRNReN0jfpB+jpEVRwjBhrM9cmxay-c-YE+cYq=Fw@mail.gmail.com>

On Tue, 9 Aug 2022, 17:10 YumeYao via Libstdc++, <libstdc++@gcc.gnu.org>
wrote:

> 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.
>


What errors do you get?



> Specifically, I met most of such issues when optimizing basic_string.
>
> Then I tried fix the ABI changes by templatizing the functions,


That certainly isn't going to work, that's explicitly introducing an ABI
change which seems a strange way to try to fix ABI breakage.


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.



I don't understand how.



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


See
https://gcc.gnu.org/onlinedocs/libstdc++/manual/appendix_porting.html#build_hacking.configure.version

  reply	other threads:[~2022-08-10 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 15:09 YumeYao
2022-08-10 13:55 ` Jonathan Wakely [this message]
2022-08-12 20:44   ` YumeYao

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='CAH6eHdSVmoh-An=g=KVy+uc823AspYhNk+pVJhMAAe62-GW4_g@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=yumeyao@gmail.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).