Skip to content

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

@Andarwinux

Description

@Andarwinux

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    LTOLink time optimization (regular/full LTO or ThinLTO)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions