This is the mail archive of the
mailing list for the GCC project.
Re: How to ensure C++ classes don't go missing with -flto?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jeffrey Walton <noloader at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 25 Jan 2019 13:26:58 +0000
- Subject: Re: How to ensure C++ classes don't go missing with -flto?
- References: <CAH8yC8keR9Hw7xrpqrSO=VHPZJUZSuHJSvAa_GcsPiuFHdzYxQ@mail.gmail.com>
On Fri, 25 Jan 2019 at 01:34, Jeffrey Walton <firstname.lastname@example.org> wrote:
> This question on Stack Overflow caught my eye:
> https://stackoverflow.com/q/54345531/608639 . In the question a
> program compiles and links fine without -flto. With -flto symbols go
> One of the classes that go missing is RSAFunction, which performs
> exponentiation with a public key. The source code is available at
> https://github.com/weidai11/cryptopp/blob/master/rsa.h and
> There does not seem to be anything special about rsa.h and rsa.cpp
> from my view of the issue. The header declares the classes, and then
> the source file implements the classes.
> How does one ensure a class does not go missing when using -flto?
You don't do anything. Classes don't "go missing" unless there's a bug
The symptoms look like libcryptopp was compiled with -fno-rtti, but
maybe there's a GCC bug.
There's no way to analyse it further (there's no mention of which
version of GCC is used and how libcryptopp was compiled).
> (Is this like implicit template instantiations? Is there a way to
> declare it so that it does not go missing?)