Skip to content

Commit

Permalink
Merge pull request #3 from Thaodan/hybris-sony-aosp-10
Browse files Browse the repository at this point in the history
hybris-patches: rebase on top of android-10.0.0_r1
  • Loading branch information
sledges authored Dec 1, 2020
2 parents 4a3ba9a + 6b33481 commit 990b967
Show file tree
Hide file tree
Showing 62 changed files with 1,471 additions and 5,526 deletions.
116 changes: 116 additions & 0 deletions art/0001-hybris-Silence-some-build-errors-to-let-the-systemim.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
From af58fcbb7a0c501a5cd06ae6c5eaed17204b065c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <[email protected]>
Date: Fri, 3 Jul 2020 22:15:49 +0200
Subject: [PATCH] (hybris) Silence some build errors to let the systemimage
build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previous changes to bionic and the build system removed things that
art depends on. Either remove the parts that create errors or replace
them and insert dummy data to allow the building of the systemimage.

Signed-off-by: Björn Bidar <[email protected]>
Change-Id: Ide41188b6263a22c371ec28786bbc1ef1ee62df7
---
build/Android.gtest.mk | 20 ++++++++++----------
runtime/thread-current-inl.h | 2 +-
runtime/thread.cc | 4 ++--
runtime/thread_list.cc | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 03aae07587..20e38df7b2 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -73,28 +73,28 @@ $(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gte

# Create rules for MainStripped, a copy of Main with the classes.dex stripped
# for the oat file assistant tests.
-ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
-ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
+ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
+ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))

# Create rules for MainUncompressed, a copy of Main with the classes.dex uncompressed
# for the dex2oat tests.
-ART_TEST_HOST_GTEST_MainUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Uncompressed$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
-ART_TEST_TARGET_GTEST_MainUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Uncompressed$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
+ART_TEST_HOST_GTEST_MainUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
+ART_TEST_TARGET_GTEST_MainUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))

# Create rules for UncompressedEmpty, a classes.dex that is empty and uncompressed
# for the dex2oat tests.
-ART_TEST_HOST_GTEST_EmptyUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))EmptyUncompressed$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
-ART_TEST_TARGET_GTEST_EmptyUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))EmptyUncompressed$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
+ART_TEST_HOST_GTEST_EmptyUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
+ART_TEST_TARGET_GTEST_EmptyUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))

# Create rules for UncompressedEmptyAligned, a classes.dex that is empty, uncompressed,
# and 4 byte aligned for the dex2oat tests.
-ART_TEST_HOST_GTEST_EmptyUncompressedAligned_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))EmptyUncompressedAligned$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
-ART_TEST_TARGET_GTEST_EmptyUncompressedAligned_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))EmptyUncompressedAligned$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
+ART_TEST_HOST_GTEST_EmptyUncompressedAligned_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
+ART_TEST_TARGET_GTEST_EmptyUncompressedAligned_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))

# Create rules for MultiDexUncompressed, a copy of MultiDex with the classes.dex uncompressed
# for the OatFile tests.
-ART_TEST_HOST_GTEST_MultiDexUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_MultiDex_DEX))Uncompressed$(suffix $(ART_TEST_HOST_GTEST_MultiDex_DEX))
-ART_TEST_TARGET_GTEST_MultiDexUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_MultiDex_DEX))Uncompressed$(suffix $(ART_TEST_TARGET_GTEST_MultiDex_DEX))
+ART_TEST_HOST_GTEST_MultiDexUncompressed_DEX := $(basename $(ART_TEST_HOST_GTEST_MultiDex_DEX))$(suffix $(ART_TEST_HOST_GTEST_MultiDex_DEX))
+ART_TEST_TARGET_GTEST_MultiDexUncompressed_DEX := $(basename $(ART_TEST_TARGET_GTEST_MultiDex_DEX))(suffix $(ART_TEST_TARGET_GTEST_MultiDex_DEX))

ifdef ART_TEST_HOST_GTEST_Main_DEX
$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
diff --git a/runtime/thread-current-inl.h b/runtime/thread-current-inl.h
index 9241b1f875..904a62ccff 100644
--- a/runtime/thread-current-inl.h
+++ b/runtime/thread-current-inl.h
@@ -34,7 +34,7 @@ inline Thread* Thread::Current() {
return nullptr;
} else {
#ifdef ART_TARGET_ANDROID
- void* thread = __get_tls()[TLS_SLOT_ART_THREAD_SELF];
+ void* thread = __get_tls()[99];
#else
void* thread = pthread_getspecific(Thread::pthread_key_self_);
#endif
diff --git a/runtime/thread.cc b/runtime/thread.cc
index be0e30ad11..dd3d07d920 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -933,7 +933,7 @@ bool Thread::Init(ThreadList* thread_list, JavaVMExt* java_vm, JNIEnvExt* jni_en
}

#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = this;
+ __get_tls()[99] = this;
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self");
#endif
@@ -2199,7 +2199,7 @@ void Thread::ThreadExitCallback(void* arg) {
"going to use a pthread_key_create destructor?): " << *self;
CHECK(is_started_);
#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = self;
+ __get_tls()[99] = self;
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, self), "reattach self");
#endif
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index ed6b2c91e5..06e6f6585b 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1482,7 +1482,7 @@ void ThreadList::Unregister(Thread* self) {
// Clear the TLS data, so that the underlying native thread is recognizably detached.
// (It may wish to reattach later.)
#ifdef ART_TARGET_ANDROID
- __get_tls()[TLS_SLOT_ART_THREAD_SELF] = nullptr;
+ __get_tls()[99] = nullptr;
#else
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, nullptr), "detach self");
#endif
--
2.27.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 37ff1a6589ca177efdeff77ca046f52074f0bc43 Mon Sep 17 00:00:00 2001
From d638f78bbaf290a38680261876fa456bff349fdc Mon Sep 17 00:00:00 2001
From: Franz-Josef Haider <[email protected]>
Date: Thu, 1 Feb 2018 00:57:52 +0000
Subject: [PATCH 1/6] (hybris) Fix __get_tls and related functions (>=Android
Expand All @@ -7,17 +7,15 @@ Subject: [PATCH 1/6] (hybris) Fix __get_tls and related functions (>=Android
Change-Id: If75e4ae739ec6c482a68b1b69c2130535add2279
Signed-off-by: Simonas Leleiva <[email protected]>
---
libc/bionic/ndk_cruft.cpp | 18 ++++++++-----
libc/libc.arm.map | 1 +
libc/libc.arm64.map | 1 +
libc/libc.x86.map | 1 +
libc/private/__get_tls.h | 30 ++++++++--------------
libc/private/__get_tls_internal.h | 54 +++++++++++++++++++++++++++++++++++++++
6 files changed, 80 insertions(+), 25 deletions(-)
libc/bionic/ndk_cruft.cpp | 18 +++++++----
libc/libc.map.txt | 1 +
libc/private/__get_tls.h | 31 +++++++-----------
libc/private/__get_tls_internal.h | 54 +++++++++++++++++++++++++++++++
4 files changed, 79 insertions(+), 25 deletions(-)
create mode 100644 libc/private/__get_tls_internal.h

diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index dbacf18..7fe91ed 100644
index 2c3299f7b..637e3dfa1 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -49,6 +49,18 @@
Expand Down Expand Up @@ -52,47 +50,23 @@ index dbacf18..7fe91ed 100644
// This non-standard function was in our <string.h> for some reason.
void memswap(void* m1, void* m2, size_t n) {
char* p = reinterpret_cast<char*>(m1);
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index b0f96a9..d896aa6 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -1519,6 +1519,7 @@ LIBC_PRIVATE {
__gedf2; # arm
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 88192239a..1bf0e307d 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1593,6 +1593,7 @@ LIBC_PRIVATE {
__gesf2; # arm
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
+ __get_tls_hooks; # hybris
+ __get_tls_hooks; # # arm x86 mips hybris
__getdents64; # arm x86 mips
__gnu_ldivmod_helper; # arm
__gnu_uldivmod_helper; # arm
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 6b0e415..631db17 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -1342,6 +1342,7 @@ LIBC_P { # introduced=P

LIBC_PRIVATE {
global:
+ __get_tls_hooks; # hybris
android_getaddrinfofornet;
android_getaddrinfofornetcontext;
android_gethostbyaddrfornet;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 2855f9e..13e95a2 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -1411,6 +1411,7 @@ LIBC_PRIVATE {
__futex_wake; # arm x86 mips
__get_thread; # arm x86 mips
__get_tls; # arm x86 mips
+ __get_tls_hooks; # hybris
__getdents64; # arm x86 mips
__open; # arm x86 mips
__page_shift; # arm x86 mips
diff --git a/libc/private/__get_tls.h b/libc/private/__get_tls.h
index 04c5fdb..9f37b01 100644
index 04c5fdbbf..6a4b5728e 100644
--- a/libc/private/__get_tls.h
+++ b/libc/private/__get_tls.h
@@ -29,25 +29,17 @@
@@ -29,25 +29,18 @@
#ifndef __BIONIC_PRIVATE_GET_TLS_H_
#define __BIONIC_PRIVATE_GET_TLS_H_

Expand Down Expand Up @@ -127,11 +101,12 @@ index 04c5fdb..9f37b01 100644
+#include "__get_tls_internal.h"
+
+//#define __get_tls __get_tls_hooks
+

#endif /* __BIONIC_PRIVATE_GET_TLS_H_ */
diff --git a/libc/private/__get_tls_internal.h b/libc/private/__get_tls_internal.h
new file mode 100644
index 0000000..4a8fa5f
index 000000000..4a8fa5fc2
--- /dev/null
+++ b/libc/private/__get_tls_internal.h
@@ -0,0 +1,54 @@
Expand Down Expand Up @@ -190,5 +165,5 @@ index 0000000..4a8fa5f
+#endif /* __BIONIC_PRIVATE_GET_TLS_INTERNAL_H_ */
+
--
2.7.4
2.27.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d6b0d88fd16ed59bc56d0d1fa41b054686fc1f81 Mon Sep 17 00:00:00 2001
From 3c74a5052ea7eb73290fe34de4a8a05a2e0c9f11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= <[email protected]>
Date: Sun, 17 Dec 2017 00:16:16 +0200
Subject: [PATCH 2/6] (hybris) Add support for get and list of properties.
Expand All @@ -9,7 +9,7 @@ Change-Id: I089a2a146c06d8ad0c234f0a9a4b5aa07beaeed5
1 file changed, 2 insertions(+)

diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index 67beb9a..d547585 100644
index 744a45b71..2f32bc28f 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -44,6 +44,8 @@ __BEGIN_DECLS
Expand All @@ -22,5 +22,5 @@ index 67beb9a..d547585 100644

#define PROP_SUCCESS 0
--
2.7.4
2.27.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5b22181f0316b519b1712b1f291d2f83bccba640 Mon Sep 17 00:00:00 2001
From 90df3815d26d79b32d6a9cb05f6ded82054744e0 Mon Sep 17 00:00:00 2001
From: Ricardo Salveti de Araujo <[email protected]>
Date: Thu, 9 Jan 2014 00:57:01 -0200
Subject: [PATCH 3/6] (hybris) bionic_tls.h: shifting TLS slots to avoid
Expand All @@ -10,38 +10,32 @@ Signed-off-by: Ricardo Salveti de Araujo <[email protected]>
Conflicts:
libc/private/bionic_tls.h
---
libc/private/bionic_tls.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
libc/private/bionic_asm_tls.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index de086f2..af4d4d0 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -56,12 +56,12 @@ __BEGIN_DECLS
enum {
TLS_SLOT_SELF = 0, // The kernel requires this specific slot for x86.
TLS_SLOT_THREAD_ID,
- TLS_SLOT_ERRNO,
+ TLS_SLOT_ERRNO = 5,
diff --git a/libc/private/bionic_asm_tls.h b/libc/private/bionic_asm_tls.h
index 92f707aad..40e6a5394 100644
--- a/libc/private/bionic_asm_tls.h
+++ b/libc/private/bionic_asm_tls.h
@@ -84,12 +84,12 @@
#define TLS_SLOT_BIONIC_TLS -1
#define TLS_SLOT_DTV 0
#define TLS_SLOT_THREAD_ID 1
-#define TLS_SLOT_APP 2 // was historically used for errno
-#define TLS_SLOT_OPENGL 3
-#define TLS_SLOT_OPENGL_API 4
-#define TLS_SLOT_STACK_GUARD 5
-#define TLS_SLOT_SANITIZER 6 // was historically used for dlerror
-#define TLS_SLOT_ART_THREAD_SELF 7
+#define TLS_SLOT_APP // was historically used for errno
+#define TLS_SLOT_OPENGL 2
+#define TLS_SLOT_OPENGL_API 5
+#define TLS_SLOT_STACK_GUARD 6
+#define TLS_SLOT_SANITIZER 7 // was historically used for dlerror
+#define TLS_SLOT_ART_THREAD_SELF

// These two aren't used by bionic itself, but allow the graphics code to
// access TLS directly rather than using the pthread API.
- TLS_SLOT_OPENGL_API = 3,
- TLS_SLOT_OPENGL = 4,
+ TLS_SLOT_OPENGL_API = 6,
+ TLS_SLOT_OPENGL = 7,

// This slot is only used to pass information from the dynamic linker to
// libc.so when the C library is loaded in to memory. The C runtime init
@@ -69,7 +69,7 @@ enum {
// we reuse an existing location that isn't needed during libc startup.
TLS_SLOT_BIONIC_PREINIT = TLS_SLOT_OPENGL_API,

- TLS_SLOT_STACK_GUARD = 5, // GCC requires this specific slot for x86.
+ TLS_SLOT_STACK_GUARD = 8, // GCC requires this specific slot for x86.
TLS_SLOT_DLERROR,

// Fast storage for Thread::Current() in ART.
// The maximum slot is fixed by the minimum TLS alignment in Bionic executables.
#define MAX_TLS_SLOT 7
--
2.7.4
2.27.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 78c3feee4abb30c1ddcb43c9d0dadd9b53872f54 Mon Sep 17 00:00:00 2001
From c2db77fdc026934f0c8198eab45608146dfb28dc Mon Sep 17 00:00:00 2001
From: Simonas Leleiva <[email protected]>
Date: Wed, 18 Apr 2018 18:37:09 +0200
Subject: [PATCH 4/6] (hybris) disable tls usage in locale.cpp, to avoid
Expand All @@ -11,7 +11,7 @@ Signed-off-by: Simonas Leleiva <[email protected]>
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libc/bionic/locale.cpp b/libc/bionic/locale.cpp
index 08c9401..52af6da 100644
index 8358fb0ab..8def0e164 100644
--- a/libc/bionic/locale.cpp
+++ b/libc/bionic/locale.cpp
@@ -37,11 +37,11 @@
Expand All @@ -31,5 +31,5 @@ index 08c9401..52af6da 100644
#if USE_TLS_SLOT
#include "bionic/pthread_internal.h"
--
2.7.4
2.27.0

Loading

0 comments on commit 990b967

Please sign in to comment.