-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NDK 18 hide symbols #829
Comments
arm64 is special because it defaults to the gold linker, while the other three targets default to bfd. On all four targets, the linker is correctly leaving the symbol out of With the arm32 release build, on the other hand, the symbol is output as global in both int somevar1 __attribute__((visibility("hidden"))) = 1;
int somevar2 __attribute__((visibility("hidden"))) = 2;
int get() {
return somevar1 + somevar2;
}
Turning off the pass works around the issue (as would -Os or -O2):
(All of my symbols are marked GLOBAL rather than LOCAL because I'm dumping symbols from an object file rather than a shared object.) Edit: use |
I filed a bug against LLVM: https://bugs.llvm.org/show_bug.cgi?id=39413 |
Thanks @rprichard . I tested with NDK 17 and it worked correctly. |
Thanks @rprichard, your answer worked for me on NDK r20b. |
clang-r383902 in our prebuilts doesn't have this problem any more, not a regression from r20, and has a workaround. Triaging to r22. |
I create a simple project with android studio 3.2.1 (with latest ndk) including c++ support. Add the following code to
native-lib.cpp
:Run
readelf -s libnative-lib.so | grep FLAGS
for all ABIs and Debug/Release variants, I got the following output:Debug:
Release:
Symbols were not hidden in
Release + armeabi-v7a
. But if I replacehelloworld()
withthen same output got as Debug mode. I'm also confused with the Visibility of
arm64-v8a
beingDEFAULT
rather thanHIDDEN
.The text was updated successfully, but these errors were encountered: