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 44631c919a)
This commit is contained in:
Christopher Ferris 2019-09-25 17:50:36 -07:00
parent 57a64a7172
commit c5d3a4348a
12 changed files with 18 additions and 32 deletions

View file

@ -1713,32 +1713,19 @@ genrule {
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",
],

View file

@ -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)

View file

@ -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>

View file

@ -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.

View file

@ -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.

View file

@ -72,7 +72,7 @@ int __open() {
// TODO: does anything still need this?
void** __get_tls() {
#include "private/__get_tls.h"
#include "platform/bionic/tls.h"
return __get_tls();
}

View file

@ -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"

View file

@ -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

View file

@ -26,8 +26,8 @@
* SUCH DAMAGE.
*/
#include <platform/bionic/tls_defines.h>
#include <private/bionic_asm.h>
#include <private/bionic_asm_tls.h>
.globl __tls_get_addr

View file

@ -28,7 +28,7 @@
#include <gtest/gtest.h>
#include "private/__get_tls.h"
#include "platform/bionic/tls.h"
#if defined(__arm__)
extern "C" void* __aeabi_read_tp();

View file

@ -33,7 +33,7 @@
#include <thread>
#include "gtest_globals.h"
#include "private/__get_tls.h"
#include "platform/bionic/tls.h"
#include "utils.h"
#if defined(__BIONIC__)