Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MinGW] [libunwind] undefined __gxx_personality_seh0 when build libunwind with LTO+Exceptions #122435

Open
Andarwinux opened this issue Jan 10, 2025 · 0 comments
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)

Comments

@Andarwinux
Copy link
Contributor

See #121819 for background context

This may become a problem in the future, but for now it won't actually happen unless libunwind does switch to using -fexceptions to compile the whole library

To build a libunwind that reproduces this problem, we need to hack the build system:

-DLIBUNWIND_ENABLE_SHARED=OFF
-DCXX_SUPPORTS_FNO_EXCEPTIONS_FLAG=OFF
-DCMAKE_C_FLAGS=“-flto=thin”
-DCMAKE_CXX_FLAGS=“-flto=thin”

Then use -flto=thin to compile any source and link them with libunwind.a:

x86_64-w64-mingw32-clang -flto=thin test.c --static

lld-link: error: undefined symbol: __gxx_personality_seh0
>>> referenced by llvm-project/libunwind/src/libunwind.cpp
>>>               libunwind.a(libunwind.cpp.obj)

report.zip (lld reproduce)

@EugeneZelenko EugeneZelenko added LTO Link time optimization (regular/full LTO or ThinLTO) and removed new issue labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

No branches or pull requests

3 participants