aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Borisov <dedsa2002@gmail.com>2017-08-31 16:41:25 +0300
committerMister Oyster <oysterized@gmail.com>2017-12-25 15:13:55 +0100
commitf3873c1805b9d317887e3aabe064c10e13bd106e (patch)
tree51e72f17f4d79c8a5d57ab6af733ec79c64c449c
parentbb00e47528381b308f65c97419f986b3d9f96610 (diff)
libshim: add atomic calls shim (remove atomic symbols patch)
01-21 03:47:04.275 509 509 F libc : CANNOT LINK EXECUTABLE "/system/bin/mm-qcamera-daemon": cannot locate symbol "android_atomic_acquire_load" referenced by "/system/vendor/lib/libmmcamera2_stats_algorithm.so"... On mediatek platforms, it's easier to link against libcutils directly (too many blobs dep) Change-Id: Ia875a5385931d5e79bfc1a99c3d8996ac66de0df Signed-off-by: Mister Oyster <oysterized@gmail.com>
-rw-r--r--README.md1
-rw-r--r--libshims/Android.mk9
-rw-r--r--libshims/atomic.cpp21
-rw-r--r--patches/system/core/0001-mtk-O-reintroduce-atomic-symbols-in-libcutils-for-ol.patch60
-rw-r--r--product/libshims.mk5
5 files changed, 36 insertions, 60 deletions
diff --git a/README.md b/README.md
index d9d8120..5c3f2e4 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ The only configuration libshim needs is the following flags :
`#LIBSHIM_GUI_SYMBOLS := true`
`#LIBSHIM_OMX_SYMBOLS := true`
`#LIBSHIM_AGPS_SYMBOLS := true`
+`#LIBSHIM_ATOMIC_SYMBOLS := true`
(copy/paste in `BoardConfig.mk` & uncomment the flags you need)
# Optional :
diff --git a/libshims/Android.mk b/libshims/Android.mk
index 51e4c4b..3b99ea0 100644
--- a/libshims/Android.mk
+++ b/libshims/Android.mk
@@ -20,6 +20,15 @@ LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_SHARED_LIBRARY)
+## libshim_atomic
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := atomic.cpp
+LOCAL_MODULE := libshim_atomic
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_CFLAGS := -O3 -Wno-unused-variable -Wno-unused-parameter
+LOCAL_PROPRIETARY_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
## libshim_omx
include $(CLEAR_VARS)
diff --git a/libshims/atomic.cpp b/libshims/atomic.cpp
new file mode 100644
index 0000000..3a159e2
--- /dev/null
+++ b/libshims/atomic.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 The LineageOS 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.
+ */
+
+#include <string>
+#define ANDROID_ATOMIC_INLINE
+extern "C" {
+#include <cutils/atomic.h>
+}
diff --git a/patches/system/core/0001-mtk-O-reintroduce-atomic-symbols-in-libcutils-for-ol.patch b/patches/system/core/0001-mtk-O-reintroduce-atomic-symbols-in-libcutils-for-ol.patch
deleted file mode 100644
index df86e12..0000000
--- a/patches/system/core/0001-mtk-O-reintroduce-atomic-symbols-in-libcutils-for-ol.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 041026c3d8ab43a088e9907b1ec33f8e0bf7d685 Mon Sep 17 00:00:00 2001
-From: Mister Oyster <oysterized@gmail.com>
-Date: Wed, 28 Jun 2017 19:41:05 +0200
-Subject: [PATCH] mtk: O: reintroduce atomic symbols in libcutils for old Mtk
- audio hals & Mali blobs
-
-Change-Id: I4b7cf5e5a772f9c281ae4bf3d3fdfd2d3b41d4c1
----
- libcutils/Android.bp | 1 +
- libcutils/atomic.c | 26 ++++++++++++++++++++++++++
- 2 files changed, 27 insertions(+)
- create mode 100644 libcutils/atomic.c
-
-diff --git a/libcutils/Android.bp b/libcutils/Android.bp
-index 513736d..6ebff26 100644
---- a/libcutils/Android.bp
-+++ b/libcutils/Android.bp
-@@ -53,6 +53,7 @@ cc_library {
- vendor_available: true,
- host_supported: true,
- srcs: [
-+ "atomic.c",
- "config_utils.c",
- "fs_config.c",
- "canned_fs_config.c",
-diff --git a/libcutils/atomic.c b/libcutils/atomic.c
-new file mode 100644
-index 0000000..d34aa00
---- /dev/null
-+++ b/libcutils/atomic.c
-@@ -0,0 +1,26 @@
-+/*
-+ * Copyright (C) 2007 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.
-+ */
-+
-+/*
-+ * Generate non-inlined versions of android_atomic functions.
-+ * Nobody should be using these, but some binary blobs currently (late 2014)
-+ * are.
-+ * If you read this in 2015 or later, please try to delete this file.
-+ */
-+
-+#define ANDROID_ATOMIC_INLINE
-+
-+#include <cutils/atomic.h>
---
-2.11.0
-
diff --git a/product/libshims.mk b/product/libshims.mk
index 8f8df3a..674b04b 100644
--- a/product/libshims.mk
+++ b/product/libshims.mk
@@ -23,3 +23,8 @@ ifeq ($(LIBSHIM_AGPS_SYMBOLS),true)
PRODUCT_PACKAGES += libshim_agps
LINKER_FORCED_SHIM_LIBS := $(LINKER_FORCED_SHIM_LIBS):/vendor/bin/mtk_agpsd|libshim_agps.so
endif
+ifeq ($(LIBSHIM_ATOMIC_SYMBOLS),true)
+PRODUCT_PACKAGES += libshim_atomic
+LINKER_FORCED_SHIM_LIBS := $(LINKER_FORCED_SHIM_LIBS):/system/lib/libcutils.so|libshim_atomic.so:/system/lib64/libcutils.so|libshim_atomic.so
+endif
+