[PATCH] D63904: [Android] Use ELF TLS for Android API level 29+

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 16:12:35 PDT 2019


hctim created this revision.
hctim added a reviewer: rprichard.
Herald added subscribers: llvm-commits, dexonsmith, kristof.beyls, javed.absar, srhines.
Herald added a project: LLVM.
hctim added a subscriber: danalbert.

Use ELF TLS by default instead of emulated TLS for Android build targets when the API level is > 29.

Android Q features full TLS support. See release notes here <https://developer.android.com/preview/features#elf-tls> and implementation details here <https://android.googlesource.com/platform/bionic/+/master/docs/elf-tls.md#Workaround_Use-Variant-2-on-arm32_arm64>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63904

Files:
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===================================================================
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -727,7 +727,9 @@
 
   /// Tests whether the target uses emulated TLS as default.
   bool hasDefaultEmulatedTLS() const {
-    return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment();
+    // Android NDK version 29 introduced ELF TLS.
+    return (isAndroid() && isAndroidVersionLT(29)) || isOSOpenBSD() ||
+           isWindowsCygwinEnvironment();
   }
 
   /// @}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63904.206953.patch
Type: text/x-patch
Size: 556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190627/6509f2a4/attachment.bin>


More information about the llvm-commits mailing list