Make tls related header files platform accessible.
There are places in frameworks and art code that directly included
private bionic header files. Move these files to the new platform
include files.
This change also moves the __get_tls.h header file to tls.h and includes
the tls defines header so that there is a single header that platform
code can use to get __get_tls and the defines.
Also, simplify the visibility rules for platform includes.
Bug: 141560639
Test: Builds and bionic unit tests pass.
Change-Id: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
Merged-In: I9e5e9c33fe8a85260f69823468bc9d340ab7a1f9
(cherry picked from commit 44631c919aee96043f119aff6d39eb1584710d3c)
diff --git a/libc/Android.bp b/libc/Android.bp
index 4abb32f..7ab088b 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1713,32 +1713,19 @@
cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
}
-// Makes bionic_tls.h available for art to use in its implementation of Thread::Current().
-cc_library_headers {
- name: "bionic_libc_private_headers",
- visibility: [
- "//art:__subpackages__",
- ],
- host_supported: true,
- export_include_dirs: [
- "private",
- ],
- sdk_version: "current",
-}
-
// Headers that only other parts of the platform can include.
cc_library_headers {
name: "bionic_libc_platform_headers",
visibility: [
- "//bionic/libc/malloc_debug:__subpackages__",
- "//bionic/libc/malloc_hooks:__subpackages__",
- "//frameworks/av/media/libmedia:__subpackages__",
- "//frameworks/av/media/utils:__subpackages__",
- "//frameworks/base/core/jni:__subpackages__",
- "//frameworks/base/services/core/jni:__subpackages__",
+ "//art:__subpackages__",
+ "//bionic/libc:__subpackages__",
+ "//frameworks:__subpackages__",
"//external/perfetto:__subpackages__",
+ "//external/scudo:__subpackages__",
],
host_supported: true,
+ recovery_available: true,
+ native_bridge_supported: true,
export_include_dirs: [
"platform",
],
diff --git a/libc/arch-arm/bionic/vfork.S b/libc/arch-arm/bionic/vfork.S
index 0b17d64..6855db7 100644
--- a/libc/arch-arm/bionic/vfork.S
+++ b/libc/arch-arm/bionic/vfork.S
@@ -26,8 +26,8 @@
* SUCH DAMAGE.
*/
+#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
-#include <private/bionic_asm_tls.h>
ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index 6c01572..c307bc3 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -26,8 +26,8 @@
* SUCH DAMAGE.
*/
+#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
-#include <private/bionic_asm_tls.h>
#include <asm/signal.h>
#include <linux/sched.h>
diff --git a/libc/arch-x86/bionic/vfork.S b/libc/arch-x86/bionic/vfork.S
index 24ede3d..663169c 100644
--- a/libc/arch-x86/bionic/vfork.S
+++ b/libc/arch-x86/bionic/vfork.S
@@ -26,8 +26,8 @@
* SUCH DAMAGE.
*/
+#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
-#include <private/bionic_asm_tls.h>
// This custom code preserves the return address across the system call.
diff --git a/libc/arch-x86_64/bionic/vfork.S b/libc/arch-x86_64/bionic/vfork.S
index e32b517..86c5db2 100644
--- a/libc/arch-x86_64/bionic/vfork.S
+++ b/libc/arch-x86_64/bionic/vfork.S
@@ -26,8 +26,8 @@
* SUCH DAMAGE.
*/
+#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
-#include <private/bionic_asm_tls.h>
// This custom code preserves the return address across the system call.
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 2c3299f..c816830 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -72,7 +72,7 @@
// TODO: does anything still need this?
void** __get_tls() {
-#include "private/__get_tls.h"
+#include "platform/bionic/tls.h"
return __get_tls();
}
diff --git a/libc/private/__get_tls.h b/libc/platform/bionic/tls.h
similarity index 94%
rename from libc/private/__get_tls.h
rename to libc/platform/bionic/tls.h
index 04c5fdb..ca39020 100644
--- a/libc/private/__get_tls.h
+++ b/libc/platform/bionic/tls.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __BIONIC_PRIVATE_GET_TLS_H_
-#define __BIONIC_PRIVATE_GET_TLS_H_
+#pragma once
#if defined(__aarch64__)
# define __get_tls() ({ void** __val; __asm__("mrs %0, tpidr_el0" : "=r"(__val)); __val; })
@@ -50,4 +49,4 @@
#error unsupported architecture
#endif
-#endif /* __BIONIC_PRIVATE_GET_TLS_H_ */
+#include "tls_defines.h"
diff --git a/libc/private/bionic_asm_tls.h b/libc/platform/bionic/tls_defines.h
similarity index 100%
rename from libc/private/bionic_asm_tls.h
rename to libc/platform/bionic/tls_defines.h
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 90914c3..9a80140 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -34,9 +34,9 @@
#include <sys/cdefs.h>
#include <sys/param.h>
-#include "bionic_asm_tls.h"
+#include <platform/bionic/tls.h>
+
#include "bionic_macros.h"
-#include "__get_tls.h"
#include "grp_pwd.h"
/** WARNING WARNING WARNING