aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:21:58 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-28 20:21:58 +0000
commitddb941c6571570ab48df693face41d1d3aca03cf (patch)
tree3709c9aa7f5ca32616cc0797fdddb3057ddc20d3
parent11ea9d78322bef5d8492b9f42a9752c186ca8f73 (diff)
parent570d57488d3e0dd5652b8482d63a1fdbe77d37cd (diff)
downloadcompiler-rt-android10-android13-mainline-tzdata-release.tar.gz
Change-Id: I0d32b54d50fd53d8cc99107e5f3a404b43c1f900
-rw-r--r--Android.bp37
-rw-r--r--lib/asan/Android.bp217
-rwxr-xr-xlib/asan/scripts/symbolize.py2
-rw-r--r--lib/interception/Android.bp45
-rw-r--r--lib/lsan/Android.bp50
-rw-r--r--lib/profile/Android.bp47
-rw-r--r--lib/sanitizer_common/Android.bp72
-rw-r--r--lib/sanitizer_common/tests/Android.bp101
-rw-r--r--lib/tsan/Android.bp143
-rw-r--r--lib/ubsan/Android.bp215
10 files changed, 926 insertions, 3 deletions
diff --git a/Android.bp b/Android.bp
index d8f5cff26..b8be74026 100644
--- a/Android.bp
+++ b/Android.bp
@@ -82,7 +82,6 @@ cc_library {
support_system_process: true,
},
host_supported: true,
- native_bridge_supported: true,
// The following list contains platform-independent functionalities.
//
// Skip apple_versioning.c since it is unused.
@@ -373,6 +372,7 @@ cc_library {
target: {
android: {
shared_libs: ["liblog"],
+ static_libs: ["liblzma"],
},
android_arm: {
static_libs: ["libunwind_llvm"],
@@ -401,6 +401,7 @@ cc_library {
},
linux_glibc: {
static_libs: ["libunwindbacktrace", "libunwind_static"],
+ shared_libs: ["liblzma"],
},
windows: {
enabled: true,
@@ -410,10 +411,42 @@ cc_library {
},
asflags: ["-integrated-as"],
- no_libcrt: true,
+ no_libgcc: true,
sanitize: {
never: true,
},
stl: "none",
}
+
+cc_defaults {
+ name: "asan_arch_defaults",
+
+ vendor_available: true,
+ enabled: false,
+ target: {
+ android_arm: {
+ enabled: true,
+ },
+ android_arm64: {
+ enabled: true,
+ },
+ android_mips: {
+ enabled: true,
+ },
+ android_mips64: {
+ enabled: true,
+ },
+ android_x86: {
+ enabled: true,
+ },
+ android_x86_64: {
+ enabled: true,
+ },
+ linux_glibc: {
+ enabled: true,
+ },
+ },
+}
+
+subdirs=["lib/*"]
diff --git a/lib/asan/Android.bp b/lib/asan/Android.bp
new file mode 100644
index 000000000..de3b9285f
--- /dev/null
+++ b/lib/asan/Android.bp
@@ -0,0 +1,217 @@
+//
+// Copyright (C) 2012 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.
+//
+//
+
+ASAN_NEEDS_SEGV = "0"
+ASAN_HAS_EXCEPTIONS = "1"
+ASAN_FLEXIBLE_MAPPING_AND_OFFSET = "0"
+
+asan_rtl_files = [
+ "asan_activation.cc",
+ "asan_allocator.cc",
+ "asan_fake_stack.cc",
+ "asan_flags.cc",
+ "asan_globals.cc",
+ "asan_interceptors.cc",
+ "asan_linux.cc",
+ "asan_mac.cc",
+ "asan_malloc_linux.cc",
+ "asan_malloc_mac.cc",
+ "asan_malloc_win.cc",
+ "asan_poisoning.cc",
+ "asan_posix.cc",
+ "asan_report.cc",
+ "asan_rtl.cc",
+ "asan_stack.cc",
+ "asan_stats.cc",
+ "asan_suppressions.cc",
+ "asan_thread.cc",
+ "asan_win.cc",
+]
+
+asan_rtl_cxx_files = ["asan_new_delete.cc"]
+
+asan_rtl_cflags = [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-DASAN_LOW_MEMORY=1",
+ "-DASAN_NEEDS_SEGV=" + ASAN_NEEDS_SEGV,
+ "-DASAN_HAS_EXCEPTIONS=" + ASAN_HAS_EXCEPTIONS,
+ "-DASAN_FLEXIBLE_MAPPING_AND_OFFSET=" + ASAN_FLEXIBLE_MAPPING_AND_OFFSET,
+ "-Wall",
+ "-Werror",
+ "-Wno-covered-switch-default",
+ "-Wno-non-virtual-dtor",
+ "-Wno-sign-compare",
+ "-Wno-unused-parameter",
+ "-std=c++11",
+ "-fno-rtti",
+ "-fno-builtin",
+]
+
+cc_library_static {
+ name: "libasan",
+ host_supported: true,
+ recovery_available: true,
+ defaults: ["asan_arch_defaults"],
+ include_dirs: [
+ "external/compiler-rt/lib",
+ "external/compiler-rt/include",
+ ],
+ cflags: asan_rtl_cflags,
+ target: {
+ android: {
+ srcs: ["asan_preinit.cc"],
+ system_shared_libs: [],
+ },
+ host: {
+ srcs: asan_rtl_files,
+ whole_static_libs: [
+ "libubsan",
+ "libinterception",
+ "liblsan",
+ "libsan"
+ ],
+ },
+ },
+
+ sdk_version: "19",
+ stl: "none",
+
+ sanitize: {
+ never: true,
+ },
+}
+
+cc_library_host_static {
+ name: "libasan_cxx",
+ include_dirs: [
+ "external/compiler-rt/lib",
+ "external/compiler-rt/include",
+ ],
+ cflags: asan_rtl_cflags,
+ srcs: asan_rtl_cxx_files,
+
+ compile_multilib: "both",
+
+ sanitize: {
+ never: true,
+ },
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_binary {
+ name: "asanwrapper",
+ defaults: ["asan_arch_defaults"],
+
+ srcs: ["asanwrapper.cc"],
+
+ cflags: ["-Wall", "-Werror"],
+ cppflags: ["-std=c++11"],
+ sanitize: {
+ never: true,
+ },
+
+ stl: "libc++",
+}
+
+// ANDROIDMK TRANSLATION ERROR: unsupported conditional
+// ifneq (true,$(SKIP_LLVM_TESTS))
+cc_library_static {
+ name: "libasan_noinst_test",
+ host_supported: true,
+ defaults: ["asan_arch_defaults"],
+
+ include_dirs: [
+ "external/compiler-rt/include",
+ "external/compiler-rt/lib",
+ "external/compiler-rt/lib/asan/tests",
+ "external/compiler-rt/lib/sanitizer_common/tests",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-non-virtual-dtor",
+ "-Wno-unused-parameter",
+ "-Wno-sign-compare",
+ "-DASAN_UAR=0",
+ "-DASAN_HAS_BLACKLIST=1",
+ "-DASAN_HAS_EXCEPTIONS=" + ASAN_HAS_EXCEPTIONS,
+ "-DASAN_NEEDS_SEGV=" + ASAN_NEEDS_SEGV,
+ "-std=c++11",
+ ],
+ srcs: [
+ "tests/asan_noinst_test.cc",
+ "tests/asan_test_main.cc",
+ ],
+
+ static_libs: ["libgtest"],
+
+ sanitize: {
+ never: true,
+ },
+
+ stl: "libc++",
+}
+
+cc_test {
+ name: "asan_test",
+ host_supported: true,
+ defaults: ["asan_arch_defaults"],
+
+ include_dirs: [
+ "external/compiler-rt/lib",
+ "external/compiler-rt/lib/asan/tests",
+ "external/compiler-rt/lib/sanitizer_common/tests",
+ ],
+ cflags: [
+ "-DASAN_LOW_MEMORY=1",
+ "-DASAN_UAR=0",
+ "-DASAN_NEEDS_SEGV=" + ASAN_NEEDS_SEGV,
+ "-DASAN_HAS_EXCEPTIONS=" + ASAN_HAS_EXCEPTIONS,
+ "-DASAN_HAS_BLACKLIST=1",
+ "-Wall",
+ "-Werror",
+ "-Wno-covered-switch-default",
+ "-Wno-non-virtual-dtor",
+ "-Wno-sign-compare",
+ "-Wno-unused-parameter",
+ "-std=c++11",
+ ],
+
+ srcs: [
+ "tests/asan_globals_test.cc",
+ "tests/asan_test.cc",
+ //"tests/asan_noinst_test.cc",
+ //"tests/asan_test_main.cc",
+ ],
+
+ static_libs: ["libasan_noinst_test"],
+ sanitize: {
+ address: true,
+ blacklist: "tests/asan_test.ignore",
+ },
+
+ stl: "libc++",
+}
+
+// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
+// endif
+// SKIP_LLVM_TESTS
diff --git a/lib/asan/scripts/symbolize.py b/lib/asan/scripts/symbolize.py
index ebd97a567..e38507023 100755
--- a/lib/asan/scripts/symbolize.py
+++ b/lib/asan/scripts/symbolize.py
@@ -101,5 +101,5 @@ binary_prefix = os.path.join(os.environ['ANDROID_PRODUCT_OUT'], 'symbols')
paths_to_cut = [os.getcwd() + '/', os.environ['ANDROID_BUILD_TOP'] + '/'] + sys.argv[1:]
for line in sys.stdin:
- line = line.decode('utf-8', 'replace')
+ line = line.decode('utf-8')
symbolize_addr2line(line, binary_prefix, paths_to_cut)
diff --git a/lib/interception/Android.bp b/lib/interception/Android.bp
new file mode 100644
index 000000000..edca9e647
--- /dev/null
+++ b/lib/interception/Android.bp
@@ -0,0 +1,45 @@
+//
+// 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,
+ sdk_version: "19",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ cppflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-std=c++11",
+ "-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 000000000..80e43be36
--- /dev/null
+++ b/lib/lsan/Android.bp
@@ -0,0 +1,50 @@
+//
+// 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",
+ "-Wall",
+ "-Werror",
+ ],
+ srcs: [
+ "lsan_common.cc",
+ "lsan_common_linux.cc",
+ ],
+
+ 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 000000000..de76de9ad
--- /dev/null
+++ b/lib/profile/Android.bp
@@ -0,0 +1,47 @@
+//
+// 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",
+ ],
+ 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
new file mode 100644
index 000000000..378376735
--- /dev/null
+++ b/lib/sanitizer_common/Android.bp
@@ -0,0 +1,72 @@
+//
+// 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.
+//
+//
+
+//###############################################################################
+// Host modules
+
+cc_library_static {
+ name: "libsan",
+ host_supported: true,
+ sdk_version: "19",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ cppflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-fno-rtti",
+ "-fno-builtin",
+ "-std=c++11",
+ "-Wno-non-virtual-dtor",
+ "-Wno-unused-parameter",
+ ],
+ srcs: [
+ "*.cc",
+ ],
+ exclude_srcs: [
+ "sanitizer_common_nolibc.cc",
+ ],
+ arch: {
+ x86_64: {
+ srcs: [
+ "sanitizer_linux_x86_64.S",
+ ]
+ }
+ },
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+subdirs = ["tests"]
+
+// ANDROIDMK TRANSLATION ERROR: unsupported conditional
+// ifndef SANITIZE_HOST
+// ANDROIDMK TRANSLATION ERROR: unsupported include
+// include $(LOCAL_PATH)/tests/Android.mk
+// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
+// endif
diff --git a/lib/sanitizer_common/tests/Android.bp b/lib/sanitizer_common/tests/Android.bp
new file mode 100644
index 000000000..b82c2deb4
--- /dev/null
+++ b/lib/sanitizer_common/tests/Android.bp
@@ -0,0 +1,101 @@
+//
+// 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_defaults {
+ name: "san_test_defaults",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ cppflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-fno-rtti",
+ "-std=c++11",
+ "-Wno-unused-parameter",
+ "-Wno-non-virtual-dtor",
+ "-Wno-format",
+ ],
+
+ include_dirs: ["external/compiler-rt/lib"],
+}
+
+
+cc_test_host {
+ name: "san_test",
+ defaults: ["san_test_defaults"],
+
+ srcs: [
+ "sanitizer_allocator_test.cc",
+ "sanitizer_atomic_test.cc",
+ "sanitizer_bitvector_test.cc",
+ "sanitizer_bvgraph_test.cc",
+ "sanitizer_common_test.cc",
+ "sanitizer_deadlock_detector_test.cc",
+ "sanitizer_flags_test.cc",
+ "sanitizer_format_interceptor_test.cc",
+ "sanitizer_ioctl_test.cc",
+ "sanitizer_libc_test.cc",
+ "sanitizer_linux_test.cc",
+ "sanitizer_list_test.cc",
+ "sanitizer_mutex_test.cc",
+ "sanitizer_nolibc_test.cc",
+ "sanitizer_posix_test.cc",
+ "sanitizer_printf_test.cc",
+ "sanitizer_procmaps_test.cc",
+ "sanitizer_stackdepot_test.cc",
+ "sanitizer_stacktrace_printer_test.cc",
+ "sanitizer_stacktrace_test.cc",
+ "sanitizer_stoptheworld_test.cc",
+ "sanitizer_suppressions_test.cc",
+ "sanitizer_test_main.cc",
+ "sanitizer_thread_registry_test.cc",
+ ],
+ static_libs: ["libsan"],
+ sanitize: {
+ never: true,
+ },
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_binary_host {
+ name: "san_test-Nolibc",
+ defaults: ["san_test_defaults"],
+
+ srcs: ["sanitizer_nolibc_test_main.cc"],
+ static_libs: [
+ "libsan",
+ "libgtest_host",
+ ],
+ ldflags: [
+ "-nostdlib",
+ "-Qunused-arguments",
+ ],
+ sanitize: {
+ never: true,
+ },
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/lib/tsan/Android.bp b/lib/tsan/Android.bp
new file mode 100644
index 000000000..13eb7dac0
--- /dev/null
+++ b/lib/tsan/Android.bp
@@ -0,0 +1,143 @@
+//
+// 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_cflags = [
+ "-Wall",
+ "-Werror",
+]
+
+tsan_rtl_cppflags = [
+ "-std=c++11",
+ "-Wno-unused-parameter",
+ "-Wno-non-virtual-dtor",
+ "-fno-rtti",
+ "-fno-builtin",
+]
+
+cc_library_host_static {
+ name: "libtsan",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ cflags: tsan_rtl_cflags,
+ cppflags: tsan_rtl_cppflags,
+ srcs: [
+ "rtl/*.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"],
+ cflags: tsan_rtl_cflags,
+ 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"],
+ cflags: tsan_rtl_cflags,
+ 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",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_test_host {
+ name: "libtsan_rtl_test",
+
+ include_dirs: ["external/compiler-rt/lib"],
+ local_include_dirs: ["rtl"],
+ cflags: tsan_rtl_cflags,
+ 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",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/lib/ubsan/Android.bp b/lib/ubsan/Android.bp
new file mode 100644
index 000000000..bcd176f16
--- /dev/null
+++ b/lib/ubsan/Android.bp
@@ -0,0 +1,215 @@
+//
+// 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.
+//
+//
+
+ubsan_rtl_files = [
+ "ubsan_diag.cc",
+ "ubsan_init.cc",
+ "ubsan_flags.cc",
+ "ubsan_handlers.cc",
+ "ubsan_value.cc",
+]
+
+ubsan_cxx_rtl_files = [
+ "ubsan_handlers_cxx.cc",
+ "ubsan_type_hash.cc",
+ "ubsan_type_hash_itanium.cc",
+ "ubsan_type_hash_win.cc",
+]
+
+ubsan_rtl_cflags = [
+ "-Wall",
+ "-Werror",
+]
+
+ubsan_rtl_cppflags = [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+ "-std=c++11",
+ "-Wno-unused-parameter",
+ "-Wno-non-virtual-dtor",
+ "-DUBSAN_CAN_USE_CXXABI",
+]
+
+ubsan_rtl_c_includes = ["external/compiler-rt/lib"]
+
+cc_library_static {
+ name: "libubsan",
+ host_supported: true,
+
+ include_dirs: ubsan_rtl_c_includes,
+ cflags: ubsan_rtl_cflags,
+ cppflags: ubsan_rtl_cppflags,
+ srcs: ubsan_rtl_files,
+ sdk_version: "19",
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+ target: {
+ host: {
+ cflags: ["-fno-rtti"],
+ },
+ },
+}
+
+cc_library_static {
+ name: "libubsan_cxx",
+ host_supported: true,
+
+ include_dirs: ubsan_rtl_c_includes,
+ cflags: ubsan_rtl_cflags,
+ cppflags: ubsan_rtl_cppflags,
+ rtti: true,
+ srcs: ubsan_cxx_rtl_files,
+ sdk_version: "19",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+}
+
+cc_defaults {
+ name: "libclang_rt_ubsan_defaults",
+
+ include_dirs: [
+ "external/compiler-rt/lib",
+ "external/compiler-rt/include",
+ ],
+ static_libs: [
+ "libsan",
+ ],
+ whole_static_libs: [
+ "libubsan",
+ "libubsan_cxx",
+ ],
+ shared_libs: [
+ "liblog",
+ "libdl",
+ ],
+ sanitize: {
+ never: true,
+ },
+ // _cxx bits (vptr-sanitizer and cfi) need dynamic_cast<>
+ stl: "c++_static",
+ sdk_version: "19",
+ enabled: false,
+}
+
+// Disable libubsan_standalone prebuilts in aosp/master until soong has a build
+// option to pick a prebuilt or compile/build a module.
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-arm-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// arm: {
+// enabled: true,
+// },
+// },
+// }
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-aarch64-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// arm64: {
+// enabled: true,
+// },
+// },
+// }
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-i686-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// x86: {
+// enabled: true,
+// },
+// },
+// }
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-x86_64-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// x86_64: {
+// enabled: true,
+// },
+// },
+// }
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-mips-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// mips: {
+// enabled: true,
+// },
+// },
+// }
+//
+// cc_library_shared {
+// name: "libclang_rt.ubsan_standalone-mips64-android",
+// defaults: ["libclang_rt_ubsan_defaults"],
+// arch: {
+// mips64: {
+// enabled: true,
+// },
+// },
+// }
+
+//###############################################################################
+// Host modules
+
+cc_library_host_static {
+ name: "libubsan_standalone",
+
+ include_dirs: ubsan_rtl_c_includes,
+ cflags: ubsan_rtl_cflags,
+ cppflags: ubsan_rtl_cppflags + ["-fno-rtti"],
+ srcs: ubsan_rtl_files,
+ whole_static_libs: ["libsan"],
+ stl: "none",
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_library_host_static {
+ name: "libubsan_standalone_cxx",
+
+ include_dirs: ubsan_rtl_c_includes,
+ cflags: ubsan_rtl_cflags,
+ cppflags: ubsan_rtl_cppflags,
+ srcs: ubsan_cxx_rtl_files,
+ sanitize: {
+ never: true,
+ },
+ compile_multilib: "both",
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}