Open
Description
the following
#include <stdexcept>
struct Foo : std::runtime_error {
Foo() : runtime_error("") {}
};
Foo foo{};
when built into an object file with
clang++ -flto=thin -fwhole-program-vtables -ffat-lto-objects -fPIC -fvisibility=hidden -c foo.cpp -o foo.o
and then linked into a shared library with
clang++ -flto=thin -shared foo.o -o foo.so
will fail with
ld.lld: error: undefined hidden symbol: vtable for Foo
Removing either the -fwhole-program-vtables
or -ffat-lto-objects
when compiling the object file works fine.
Note that this isn't related to this specific underlying type, I only discovered it with std::runtime_error
first. Reproduces on libstdc++ and libc++ (when linking dynamically)
Metadata
Metadata
Assignees
Type
Projects
Status
Needs Triage