Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld warning: too many personality routines for compact unwind to encode

The linker for an iOS simulator target I have is reporting the following warning:

ld: warning: too many personality routines for compact unwind to encode

No line number is given, nor anything else that is actionable. Googling turned up some Apple open source code, but I'm not groking it.

What does it mean and what can I do to address it?

like image 666
Doug Richardson Avatar asked Jan 15 '14 23:01

Doug Richardson


2 Answers

I found some information in the C++ ABI for Itanium docs that sheds some light on what this means.

The personality routine is the function in the C++ (or other language) runtime library which serves as an interface between the system unwind library and language-specific exception handling semantics.

Extrapolating, this warning indicates that you've got too many kinds of exception handling in the same binary, and at least one of them may fail. Indeed this is exactly what is observed in this question.

Sadly, there's no clear way to fix this, only workarounds. You can suppress the warning, remove code, rewrite code in a different language, disable a language's exception handing and possibly others.

like image 118
OrangeDog Avatar answered Sep 24 '22 12:09

OrangeDog


If you have a crash on exception with this warning, i.e. ::terminate() call on every throw, the workaround is to use old dwarf exception-handling tables. Add following flags to Build Settings/Linking/Other Linker Flags:

-Wl,-keep_dwarf_unwind -Wl,-no_compact_unwind
like image 41
Eugene Shapovalov Avatar answered Sep 23 '22 12:09

Eugene Shapovalov