Merge "Convert the rest of compiler-rt to Android.bp" am: 2544513dee
am: b90796a2e7
* commit 'b90796a2e73cc608810b5cfd0cd9f362483d3713':
Convert the rest of compiler-rt to Android.bp
Change-Id: Id7441dba24823acc58ee277ca36bedcc8be1eb28
diff --git a/Android.bp b/Android.bp
index 87fe44c..0cfdca9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -412,6 +412,12 @@
android_arm64: {
enabled: true,
},
+ android_mips: {
+ enabled: true,
+ },
+ android_mips64: {
+ enabled: true,
+ },
android_x86: {
enabled: true,
},
@@ -421,10 +427,4 @@
},
}
-subdirs=[
- "lib/asan",
- //"lib/interception",
- "lib/sanitizer_common",
- //"lib/tsan",
- "lib/ubsan",
-]
+subdirs=["lib/*"]
diff --git a/Android.soong.mk b/Android.soong.mk
deleted file mode 100644
index 808b5c7..0000000
--- a/Android.soong.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-#
-
-# This makefile is used when Soong is enabled, and we've skipped the local
-# Android.mk file.
-
-LOCAL_PATH := $(call my-dir)
-
-# Build asan, lsan, etc.
-include $(call all-makefiles-under,$(LOCAL_PATH)/lib)
diff --git a/lib/asan/Android.bp b/lib/asan/Android.bp
index 66aefac..3e20843 100644
--- a/lib/asan/Android.bp
+++ b/lib/asan/Android.bp
@@ -40,49 +40,6 @@
"asan_suppressions.cc",
"asan_thread.cc",
"asan_win.cc",
- "../interception/interception_linux.cc",
- "../lsan/lsan_common.cc",
- "../lsan/lsan_common_linux.cc",
- "../sanitizer_common/sanitizer_allocator.cc",
- "../sanitizer_common/sanitizer_common.cc",
- "../sanitizer_common/sanitizer_common_libcdep.cc",
- "../sanitizer_common/sanitizer_coverage_libcdep.cc",
- "../sanitizer_common/sanitizer_coverage_mapping_libcdep.cc",
- "../sanitizer_common/sanitizer_deadlock_detector1.cc",
- "../sanitizer_common/sanitizer_deadlock_detector2.cc",
- "../sanitizer_common/sanitizer_flags.cc",
- "../sanitizer_common/sanitizer_flag_parser.cc",
- "../sanitizer_common/sanitizer_libc.cc",
- "../sanitizer_common/sanitizer_libignore.cc",
- "../sanitizer_common/sanitizer_linux.cc",
- "../sanitizer_common/sanitizer_linux_libcdep.cc",
- "../sanitizer_common/sanitizer_mac.cc",
- "../sanitizer_common/sanitizer_persistent_allocator.cc",
- "../sanitizer_common/sanitizer_platform_limits_linux.cc",
- "../sanitizer_common/sanitizer_platform_limits_posix.cc",
- "../sanitizer_common/sanitizer_posix.cc",
- "../sanitizer_common/sanitizer_posix_libcdep.cc",
- "../sanitizer_common/sanitizer_printf.cc",
- "../sanitizer_common/sanitizer_procmaps_common.cc",
- "../sanitizer_common/sanitizer_procmaps_freebsd.cc",
- "../sanitizer_common/sanitizer_procmaps_linux.cc",
- "../sanitizer_common/sanitizer_procmaps_mac.cc",
- "../sanitizer_common/sanitizer_stackdepot.cc",
- "../sanitizer_common/sanitizer_stacktrace.cc",
- "../sanitizer_common/sanitizer_stacktrace_libcdep.cc",
- "../sanitizer_common/sanitizer_stacktrace_printer.cc",
- "../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc",
- "../sanitizer_common/sanitizer_suppressions.cc",
- "../sanitizer_common/sanitizer_symbolizer.cc",
- "../sanitizer_common/sanitizer_symbolizer_libbacktrace.cc",
- "../sanitizer_common/sanitizer_symbolizer_libcdep.cc",
- "../sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc",
- "../sanitizer_common/sanitizer_symbolizer_process_libcdep.cc",
- "../sanitizer_common/sanitizer_symbolizer_win.cc",
- "../sanitizer_common/sanitizer_thread_registry.cc",
- "../sanitizer_common/sanitizer_tls_get_addr.cc",
- "../sanitizer_common/sanitizer_unwind_posix_libcdep.cc",
- "../sanitizer_common/sanitizer_win.cc",
]
asan_rtl_cxx_files = ["asan_new_delete.cc"]
@@ -105,7 +62,7 @@
cc_library_static {
name: "libasan",
- //host_supported: true,
+ host_supported: true,
defaults: ["asan_arch_defaults"],
include_dirs: [
"external/compiler-rt/lib",
@@ -119,6 +76,11 @@
host: {
srcs: asan_rtl_files,
whole_static_libs: ["libubsan"],
+ static_libs: [
+ "libinterception",
+ "liblsan",
+ "libsan",
+ ],
},
},
@@ -153,50 +115,6 @@
},
}
-cc_defaults {
- name: "libclang_rt_defaults",
-
- // TODO:
- // This library must go on /system partition, even in SANITIZE_TARGET mode (when all libraries are
- // installed on /data). That's because /data may not be available until vold does some magic and
- // vold itself depends on this library.
-
- arch: {
- arm: {
- instruction_set: "arm",
- },
- },
- target: {
- darwin: {
- enabled: false,
- },
- },
- include_dirs: [
- "external/compiler-rt/lib",
- "external/compiler-rt/include",
- ],
- cflags: asan_rtl_cflags,
- srcs: asan_rtl_files + asan_rtl_cxx_files,
- static_libs: ["libubsan"],
- clang: true,
- sanitize: {
- never: true,
- },
- sdk_version: "19",
- stl: "none",
-}
-
-/*cc_library_shared {
- name: "libclang_rt.asan-arm-android",
- defaults: ["libclang_rt_defaults"],
- enabled: false,
- arch: {
- arm: {
- enabled: true,
- },
- },
-}*/
-
cc_binary {
name: "asanwrapper",
defaults: ["asan_arch_defaults"],
@@ -251,7 +169,7 @@
cc_test {
name: "asan_test",
- //host_supported: true,
+ host_supported: true,
defaults: ["asan_arch_defaults"],
tags: ["tests"],
diff --git a/lib/interception/Android.bp b/lib/interception/Android.bp
new file mode 100644
index 0000000..7441aa1
--- /dev/null
+++ b/lib/interception/Android.bp
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2015 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.
+//
+//
+
+cc_library_static {
+ name: "libinterception",
+ host_supported: true,
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cppflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-std=c++11",
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ ],
+ srcs: [
+ "interception_linux.cc",
+ "interception_mac.cc",
+ "interception_type_test.cc",
+ "interception_win.cc",
+ ],
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+}
diff --git a/lib/lsan/Android.bp b/lib/lsan/Android.bp
new file mode 100644
index 0000000..97f55c3
--- /dev/null
+++ b/lib/lsan/Android.bp
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2016 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.
+//
+//
+
+cc_library_static {
+ name: "liblsan",
+ host_supported: true,
+ defaults: ["asan_arch_defaults"],
+ include_dirs: [
+ "external/compiler-rt/lib",
+ "external/compiler-rt/include",
+ ],
+ cflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-Wno-covered-switch-default",
+ "-Wno-non-virtual-dtor",
+ "-Wno-sign-compare",
+ "-Wno-unused-parameter",
+ "-std=c++11",
+ "-fno-rtti",
+ "-fno-builtin",
+ ],
+ srcs: [
+ "lsan_common.cc",
+ "lsan_common_linux.cc",
+ ],
+
+ clang: true,
+ sdk_version: "19",
+ stl: "none",
+
+ sanitize: {
+ never: true,
+ },
+}
diff --git a/lib/profile/Android.bp b/lib/profile/Android.bp
new file mode 100644
index 0000000..a0059e5
--- /dev/null
+++ b/lib/profile/Android.bp
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2016 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.
+//
+//
+
+//=====================================================================
+// Static Library: libprofile_rt
+//=====================================================================
+
+cc_library_static {
+ name: "libprofile_rt",
+ host_supported: true,
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+ clang: true,
+ srcs: [
+ "GCDAProfiling.c",
+ "InstrProfiling.c",
+ "InstrProfilingBuffer.c",
+ "InstrProfilingFile.c",
+ "InstrProfilingPlatformDarwin.c",
+ "InstrProfilingPlatformOther.c",
+ "InstrProfilingRuntime.cc",
+ "InstrProfilingUtil.c",
+ ],
+
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+ stl: "none",
+ sdk_version: "21",
+}
diff --git a/lib/sanitizer_common/Android.bp b/lib/sanitizer_common/Android.bp
index 0348d67..fd6b189 100644
--- a/lib/sanitizer_common/Android.bp
+++ b/lib/sanitizer_common/Android.bp
@@ -18,8 +18,9 @@
//###############################################################################
// Host modules
-cc_library_host_static {
+cc_library_static {
name: "libsan",
+ host_supported: true,
include_dirs: ["external/compiler-rt/lib"],
cppflags: [
@@ -28,6 +29,7 @@
"-std=c++11",
"-Wall",
"-Werror",
+ "-Wno-non-virtual-dtor",
"-Wno-unused-parameter",
],
srcs: [
diff --git a/lib/tsan/Android.bp b/lib/tsan/Android.bp
new file mode 100644
index 0000000..2d93818
--- /dev/null
+++ b/lib/tsan/Android.bp
@@ -0,0 +1,168 @@
+//
+// Copyright (C) 2015 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.
+//
+//
+
+tsan_rtl_cppflags = [
+ "-std=c++11",
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ "-Wno-non-virtual-dtor",
+ "-fno-rtti",
+ "-fno-builtin",
+]
+
+cc_library_host_static {
+ name: "libtsan",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cppflags: tsan_rtl_cppflags,
+ srcs: [
+ "rtl/tsan_clock.cc",
+ "rtl/tsan_flags.cc",
+ "rtl/tsan_fd.cc",
+ "rtl/tsan_ignoreset.cc",
+ "rtl/tsan_interceptors.cc",
+ "rtl/tsan_interface_ann.cc",
+ "rtl/tsan_interface_atomic.cc",
+ "rtl/tsan_interface.cc",
+ "rtl/tsan_interface_java.cc",
+ "rtl/tsan_md5.cc",
+ "rtl/tsan_mman.cc",
+ "rtl/tsan_mutex.cc",
+ "rtl/tsan_mutexset.cc",
+ "rtl/tsan_report.cc",
+ "rtl/tsan_rtl.cc",
+ "rtl/tsan_rtl_mutex.cc",
+ "rtl/tsan_rtl_report.cc",
+ "rtl/tsan_rtl_thread.cc",
+ "rtl/tsan_stack_trace.cc",
+ "rtl/tsan_stat.cc",
+ "rtl/tsan_suppressions.cc",
+ "rtl/tsan_symbolize.cc",
+ "rtl/tsan_sync.cc",
+ "rtl/tsan_platform_linux.cc",
+ "rtl/tsan_platform_posix.cc",
+ "rtl/tsan_rtl_amd64.S",
+ ],
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "64",
+ whole_static_libs: [
+ "libinterception",
+ "libsan",
+ "libubsan",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_library_host_static {
+ name: "libtsan_cxx",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cppflags: tsan_rtl_cppflags,
+ srcs: ["rtl/tsan_new_delete.cc"],
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "64",
+ whole_static_libs: ["libubsan_cxx"],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_test_host {
+ name: "libtsan_unit_test",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ local_include_dirs: ["rtl"],
+ cppflags: tsan_rtl_cppflags,
+ srcs: [
+ "tests/unit/tsan_clock_test.cc",
+ "tests/unit/tsan_dense_alloc_test.cc",
+ "tests/unit/tsan_flags_test.cc",
+ "tests/unit/tsan_mman_test.cc",
+ "tests/unit/tsan_mutex_test.cc",
+ "tests/unit/tsan_mutexset_test.cc",
+ "tests/unit/tsan_shadow_test.cc",
+ "tests/unit/tsan_stack_test.cc",
+ "tests/unit/tsan_sync_test.cc",
+ "tests/unit/tsan_unit_test_main.cc",
+ "tests/unit/tsan_vector_test.cc",
+ ],
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "64",
+ static_libs: [
+ "libtsan",
+ "libubsan",
+ ],
+ host_ldlibs: [
+ "-lrt",
+ "-ldl",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_test_host {
+ name: "libtsan_rtl_test",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ local_include_dirs: ["rtl"],
+ cppflags: tsan_rtl_cppflags,
+ srcs: [
+ "tests/rtl/tsan_bench.cc",
+ "tests/rtl/tsan_mop.cc",
+ "tests/rtl/tsan_mutex.cc",
+ "tests/rtl/tsan_posix.cc",
+ "tests/rtl/tsan_string.cc",
+ "tests/rtl/tsan_test_util_posix.cc",
+ "tests/rtl/tsan_test.cc",
+ "tests/rtl/tsan_thread.cc",
+ ],
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "64",
+ static_libs: [
+ "libtsan",
+ "libubsan",
+ ],
+ host_ldlibs: [
+ "-lrt",
+ "-ldl",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}