On Fri, 25 Jan 2019 at 01:34, Jeffrey Walton <noloader@xxxxxxxxx> 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 > missing. > > 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 > https://github.com/weidai11/cryptopp/blob/master/rsa.cpp. > > 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 somewhere. 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?)