Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2019 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 17 | cc_defaults { |
| 18 | name: "libscudo_defaults", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 19 | native_coverage: false, |
Yifan Hong | dc883f1 | 2020-01-21 17:12:16 -0800 | [diff] [blame] | 20 | ramdisk_available: true, |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 21 | recovery_available: true, |
| 22 | host_supported: true, |
| 23 | native_bridge_supported: true, |
| 24 | |
| 25 | rtti: false, |
| 26 | stl: "none", |
| 27 | |
| 28 | cflags: [ |
| 29 | "-O3", |
| 30 | "-fno-rtti", |
Christopher Ferris | 7435ef7 | 2019-09-25 17:43:02 -0700 | [diff] [blame] | 31 | // This option speeds up alloc/free code paths by about 5% to 7%. |
| 32 | "-fno-stack-protector", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 33 | "-fno-emulated-tls", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 34 | |
| 35 | "-Wall", |
| 36 | "-Wextra", |
| 37 | "-Wunused", |
| 38 | "-Wno-unused-result", |
| 39 | |
| 40 | "-Werror=pointer-to-int-cast", |
| 41 | "-Werror=int-to-pointer-cast", |
| 42 | "-Werror=type-limits", |
| 43 | "-Werror", |
Christopher Ferris | df4af6d | 2020-01-14 13:48:30 -0800 | [diff] [blame] | 44 | |
| 45 | // Always force alignment to 16 bytes even on 32 bit. |
| 46 | // Android assumes that allocations of multiples of 16 bytes |
| 47 | // will be aligned to at least 16 bytes. |
| 48 | "-DSCUDO_MIN_ALIGNMENT_LOG=4", |
Peter Collingbourne | df9219e | 2020-04-23 13:29:34 -0700 | [diff] [blame] | 49 | |
| 50 | // Allow scudo to use android_unsafe_frame_pointer_chase(), which is |
| 51 | // normally a private function. |
| 52 | "-DHAVE_ANDROID_UNSAFE_FRAME_POINTER_CHASE", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 53 | ], |
| 54 | cppflags: [ |
| 55 | "-nostdinc++", |
| 56 | "-fno-exceptions", |
| 57 | ], |
| 58 | |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 59 | include_dirs: [ |
| 60 | "external/scudo/standalone/include", |
| 61 | ], |
| 62 | |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 63 | system_shared_libs: [], |
| 64 | |
| 65 | srcs: [ |
| 66 | "standalone/checksum.cpp", |
| 67 | "standalone/common.cpp", |
| 68 | "standalone/flags.cpp", |
| 69 | "standalone/flags_parser.cpp", |
| 70 | "standalone/linux.cpp", |
Christopher Ferris | 4998f8c | 2020-02-18 10:51:54 -0800 | [diff] [blame] | 71 | "standalone/release.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 72 | "standalone/report.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 73 | "standalone/string_utils.cpp", |
| 74 | "standalone/wrappers_c_bionic.cpp" |
| 75 | ], |
| 76 | arch: { |
| 77 | arm: { |
| 78 | cflags: ["-mcrc"], |
| 79 | srcs: ["standalone/crc32_hw.cpp"], |
| 80 | }, |
| 81 | arm64: { |
| 82 | cflags: ["-mcrc"], |
| 83 | srcs: ["standalone/crc32_hw.cpp"], |
| 84 | }, |
| 85 | x86_64: { |
| 86 | cflags: ["-msse4.2"], |
| 87 | srcs: ["standalone/crc32_hw.cpp"], |
| 88 | }, |
| 89 | x86: { |
| 90 | cflags: ["-msse4.2"], |
| 91 | srcs: ["standalone/crc32_hw.cpp"], |
| 92 | }, |
| 93 | }, |
| 94 | |
| 95 | target: { |
| 96 | linux_glibc: { |
| 97 | enabled: true, |
| 98 | }, |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame^] | 99 | android: { |
| 100 | header_libs: ["bionic_libc_platform_headers"], |
| 101 | product_variables: { |
| 102 | experimental_mte: { |
| 103 | cflags: ["-DANDROID_EXPERIMENTAL_MTE"], |
| 104 | }, |
| 105 | }, |
| 106 | }, |
| 107 | linux_bionic: { |
| 108 | header_libs: ["bionic_libc_platform_headers"], |
| 109 | product_variables: { |
| 110 | experimental_mte: { |
| 111 | cflags: ["-DANDROID_EXPERIMENTAL_MTE"], |
| 112 | }, |
| 113 | }, |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 114 | }, |
| 115 | }, |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 116 | } |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 117 | |
| 118 | cc_library_static { |
| 119 | name: "libscudo", |
| 120 | defaults: ["libscudo_defaults"], |
| 121 | cflags: ["-D_BIONIC=1"], |
| 122 | } |
| 123 | |
| 124 | cc_library_static { |
| 125 | name: "libscudo_for_testing", |
| 126 | defaults: ["libscudo_defaults"], |
| 127 | } |
| 128 | |
| 129 | cc_test { |
| 130 | name: "scudo_unit_tests", |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 131 | host_supported: true, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 132 | srcs: [ |
| 133 | "standalone/tests/atomic_test.cpp", |
| 134 | "standalone/tests/bytemap_test.cpp", |
| 135 | "standalone/tests/checksum_test.cpp", |
| 136 | "standalone/tests/chunk_test.cpp", |
| 137 | "standalone/tests/combined_test.cpp", |
| 138 | "standalone/tests/flags_test.cpp", |
| 139 | "standalone/tests/list_test.cpp", |
| 140 | "standalone/tests/map_test.cpp", |
| 141 | "standalone/tests/mutex_test.cpp", |
| 142 | "standalone/tests/primary_test.cpp", |
| 143 | "standalone/tests/quarantine_test.cpp", |
| 144 | "standalone/tests/release_test.cpp", |
| 145 | "standalone/tests/report_test.cpp", |
| 146 | "standalone/tests/scudo_unit_test_main.cpp", |
| 147 | "standalone/tests/secondary_test.cpp", |
| 148 | "standalone/tests/size_class_map_test.cpp", |
| 149 | "standalone/tests/stats_test.cpp", |
| 150 | "standalone/tests/strings_test.cpp", |
| 151 | "standalone/tests/tsd_test.cpp", |
| 152 | "standalone/tests/vector_test.cpp", |
| 153 | ], |
| 154 | static_libs: ["libscudo_for_testing"], |
| 155 | include_dirs: [ |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 156 | "external/scudo/standalone", |
Dynamic Tools Team | 2661559 | 2020-03-23 16:08:18 -0700 | [diff] [blame] | 157 | "external/scudo/standalone/include", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 158 | ], |
| 159 | cflags: [ |
| 160 | "-Wno-unused-parameter", |
| 161 | "-fno-emulated-tls", |
| 162 | ], |
Martin Stjernholm | 2ad96b1 | 2020-04-23 16:48:50 +0100 | [diff] [blame^] | 163 | target: { |
| 164 | android: { |
| 165 | header_libs: ["bionic_libc_platform_headers"], |
| 166 | product_variables: { |
| 167 | experimental_mte: { |
| 168 | cflags: ["-DANDROID_EXPERIMENTAL_MTE"], |
| 169 | }, |
| 170 | }, |
| 171 | }, |
| 172 | linux_bionic: { |
| 173 | header_libs: ["bionic_libc_platform_headers"], |
| 174 | product_variables: { |
| 175 | experimental_mte: { |
| 176 | cflags: ["-DANDROID_EXPERIMENTAL_MTE"], |
| 177 | }, |
| 178 | }, |
Peter Collingbourne | 6500693 | 2019-11-26 20:02:40 -0800 | [diff] [blame] | 179 | }, |
| 180 | }, |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 181 | test_suites: ["general-tests"], |
Peter Collingbourne | af40e25 | 2020-04-23 13:26:14 -0700 | [diff] [blame] | 182 | bootstrap: true, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 183 | } |