问题
I'm compiling my C++ code using clang++ that comes with ndk21. I've set both compiler flags -fno-unwind-tables and -fno-asynchronous-unwind-tables but the number of entries in the unwind table do not reduce. I also checked by setting the opposite -funwind-tables and -fasynchronous-unwind-tables but it doesn't increase either. setting -fno-exceptions does reduce the number of entries slightly which makes me think I'm passing the flags correctly. Does anyone have any idea why this could be the case?
My test program is very simple just 5 functions, all appending strings to strings. Is it that the minimum number of entries in the unwind table? I'm trying to reduce the binary size.
回答1:
Typically the reason is that you're depending on some other libraries that do have unwind tables. The C++ stdlib is definitely built with them, so if you're using libc++_static.a they'll be added to your library. Since that code is already compiled, your compiler flags won't have any effect on it :)
I should also note that there are other reasons that you might want unwind tables even if you're not using exceptions. Crash handlers that you use might depend on them, for example.
来源:https://stackoverflow.com/questions/62320330/fno-unwind-tables-and-fno-asynchronous-unwind-tables-does-not-work-ndk-clang