Make libsigchain a stub library.
Also fix a missing call in sigchain_test.cc
Bug: 142944043
Test: sigchain_test.cc
Change-Id: Ifc35cf087276c91cb61e2f77d5213283235808f2
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index f5be3b4..2db3264 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -54,6 +54,7 @@
"libnativebridge",
"libnativehelper",
"libnativeloader",
+ "libsigchain",
// libadbconnection is internal and loaded with dlopen(), but it cannot use
// "required" because of cyclic dependency (b/124505714).
"libadbconnection",
diff --git a/build/sdk/Android.bp b/build/sdk/Android.bp
index 66c2ef2..553c2ba 100644
--- a/build/sdk/Android.bp
+++ b/build/sdk/Android.bp
@@ -69,13 +69,11 @@
"libnativebridge",
"libnativehelper",
"libnativeloader",
+ "libsigchain",
],
native_libs: [
"libdexfile_support",
-
- // TODO(b/142944043): Convert to APEX stubs and export as a shared lib, once linker support is in place.
- "libsigchain",
],
native_static_libs: [
diff --git a/dalvikvm/Android.bp b/dalvikvm/Android.bp
index 6993384..f1912d0 100644
--- a/dalvikvm/Android.bp
+++ b/dalvikvm/Android.bp
@@ -36,8 +36,8 @@
],
shared_libs: [
"libnativehelper",
+ "libsigchain",
],
- whole_static_libs: ["libsigchain"],
target: {
android: {
shared_libs: [
diff --git a/sigchainlib/Android.bp b/sigchainlib/Android.bp
index 5783e9a..5baba87 100644
--- a/sigchainlib/Android.bp
+++ b/sigchainlib/Android.bp
@@ -28,19 +28,20 @@
name: "libsigchain",
defaults: ["art_defaults"],
visibility: [
- // TODO(b/142944043, b/133140750): Clean this up.
"//frameworks/base/cmds/app_process",
],
+ // Make libsigchain symbols global, so that an app library which
+ // is loaded in a classloader linker namespace looks for
+ // libsigchain symbols before libc.
+ // -z,global marks the binary with the DF_1_GLOBAL flag which puts the symbols
+ // in the global group. It does not affect their visibilities like the version
+ // script does.
+ ldflags: ["-Wl,-z,global"],
host_supported: true,
target: {
linux: {
- shared: {
- srcs: ["sigchain_fake.cc"],
- },
- static: {
- srcs: ["sigchain.cc"],
- },
+ srcs: ["sigchain.cc"],
},
darwin: {
@@ -56,10 +57,11 @@
apex_available: [
"com.android.art",
"com.android.art.debug",
- // TODO(b/142944043) Clean this up. This is due to the dependency from
- // app_process
- "//apex_available:platform",
],
+ stubs: {
+ symbol_file: "libsigchain.map.txt",
+ versions: ["1"],
+ },
}
// Create a fake version of libsigchain which expose the necessary symbols
diff --git a/sigchainlib/libsigchain.map.txt b/sigchainlib/libsigchain.map.txt
new file mode 100644
index 0000000..148c4ed
--- /dev/null
+++ b/sigchainlib/libsigchain.map.txt
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LIBSIGCHAIN_1 {
+ global:
+ EnsureFrontOfChain;
+ AddSpecialSignalHandlerFn;
+ RemoveSpecialSignalHandlerFn;
+ SkipAddSignalHandler;
+ local:
+ *;
+};