-fno-unwind-tables and -fno-asynchronous-unwind-tables does not work NDK clang++

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-23 14:09:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!