Issue 139440
Summary -fwhole-program-vtables breaks in combination with -ffat-lto-objects
Labels new issue
Assignees
Reporter Jannik2099
    the following

```cpp
#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)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to