-
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
clang __thread caused linker error #8
Comments
@chih-hung, at first glance I would guess this is something in clang? Any known issues that were fixed very recently? r11 has clang version 3.8.243773 |
Yes, the final patches for emutls are only in a clang that I updated yesterday for AOSP (still labeled 3.8.256229, but from build ID 2658975 instead). |
Ahh damn. I shouldn't have called out
Is it actually still the same revision, or did we miss updating the config for the build? I'm wondering about impact of pulling in the new build. If it's small I'll do it for r11b, if not I'll just fix the changelog and we'll do this for r12. |
It's a merge + a handful of cherry-picks for emutls, long double, and "krait". We don't update the "merge" CL ID when we do these cherry-picks, as it would be pretty misleading. I need a better strategy though for labeling these as 256229A, etc., instead. That said, r11 only has r243773, so you are missing quite a lot of changes because of the actual merge. |
Talked to @stephenhines, there was another patch that was needed to get this fully enabled that we didn't get in the NDK (wasn't available to us until a week or two ago, at which point I didn't want to rev the compiler again). I'll fix the changelog, and get the feature out in r12. |
(closing because this is fixed in master) |
Old version of the Android NDK have linker issues with thread local support android/ndk#8 and isn't actually fixed until r12b https://developer.android.com/ndk/downloads/revision_history.html. ABSL's config.h is being updated to catch this case and having gRPC rely on that will make sure it also gets the fix (rather than repeating a somewhat lengthy macro). Since gRPC already has a dependency on ABSL, I figured this wouldn't be an issue.
Expand logic for when __thread is supported to work around android/ndk#8
Some buggy versions of Android NDK don't support thread_local properly (see android/ndk#8). So use pthreads here.
ndk r11
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION := clang
Trying to build shared library from single line file:
x.cpp:
__thread const char *x = "";
Got:
Everything is OK, when I replace the line with:
__thread const char *x = nullptr;
The text was updated successfully, but these errors were encountered: