16

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?

Doug Richardson
  • 10,483
  • 6
  • 51
  • 77

4 Answers4

15

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.

Community
  • 1
  • 1
OrangeDog
  • 36,653
  • 12
  • 122
  • 207
8

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
Eugene Shapovalov
  • 666
  • 1
  • 6
  • 4
3

You can try silencing the warning with -Wl,-no_compact_unwind for the Other Linker Flags setting. I think it's harmless.

Derek Thurn
  • 14,953
  • 9
  • 42
  • 64
  • I think you're right. It's probably saying there's some sort of performance impact, but there's nothing (that anyone has mentioned yet) I can do about it aside from disabling the log like you suggest. – Doug Richardson Mar 20 '14 at 21:05
  • 7
    IMHO one should be aware that turning of the warning does not really solve underlying problem. My guess is that someone has decided that this warning is important. Only one part the original question is answered, that is how to solve it. However it should be interesting to know what the warning really means. – Johan Karlsson Mar 02 '15 at 14:10
  • 1
    Please don't do that. The suggestion in this answer will turn off compact unwinding entirely rather than disabling the warning (including in the cases where it can be expressed in the compact unwind format). – Jeremy Huddleston Sequoia May 31 '15 at 17:58
  • That option can cause exception handling to fail entirely in some situations (i.e. will skip the catch and terminate the process instead). – OrangeDog Mar 28 '19 at 12:19
0

I bumped into this issue as well when trying to run on the iOS simulator while my code was running correctly on the device. In my case, it was not a warning but a linker error.

Luckily, i remembered that I added two flags for luajit to run correctly following the instructions of this page under the section Embedding LuaJIT:

-pagezero_size 10000 -image_base 100000000

My guess is that the image_base address is simply out of bounds on the host CPU.

Anyway, removing these settings made it work in my configuration.

So go to your project's settings and look for any hard wired values of this kind if not the same.

Hope this helps,

M

michaK
  • 111
  • 1
  • 6