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, |
| 20 | recovery_available: true, |
| 21 | host_supported: true, |
| 22 | native_bridge_supported: true, |
| 23 | |
| 24 | rtti: false, |
| 25 | stl: "none", |
| 26 | |
| 27 | cflags: [ |
| 28 | "-O3", |
| 29 | "-fno-rtti", |
Christopher Ferris | 7435ef7 | 2019-09-25 17:43:02 -0700 | [diff] [blame] | 30 | // This option speeds up alloc/free code paths by about 5% to 7%. |
| 31 | "-fno-stack-protector", |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 32 | "-fno-emulated-tls", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 33 | |
| 34 | "-Wall", |
| 35 | "-Wextra", |
| 36 | "-Wunused", |
| 37 | "-Wno-unused-result", |
| 38 | |
| 39 | "-Werror=pointer-to-int-cast", |
| 40 | "-Werror=int-to-pointer-cast", |
| 41 | "-Werror=type-limits", |
| 42 | "-Werror", |
Christopher Ferris | df4af6d | 2020-01-14 13:48:30 -0800 | [diff] [blame^] | 43 | |
| 44 | // Always force alignment to 16 bytes even on 32 bit. |
| 45 | // Android assumes that allocations of multiples of 16 bytes |
| 46 | // will be aligned to at least 16 bytes. |
| 47 | "-DSCUDO_MIN_ALIGNMENT_LOG=4", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 48 | ], |
| 49 | cppflags: [ |
| 50 | "-nostdinc++", |
| 51 | "-fno-exceptions", |
| 52 | ], |
| 53 | |
| 54 | system_shared_libs: [], |
| 55 | |
| 56 | srcs: [ |
| 57 | "standalone/checksum.cpp", |
| 58 | "standalone/common.cpp", |
| 59 | "standalone/flags.cpp", |
| 60 | "standalone/flags_parser.cpp", |
| 61 | "standalone/linux.cpp", |
| 62 | "standalone/report.cpp", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 63 | "standalone/string_utils.cpp", |
| 64 | "standalone/wrappers_c_bionic.cpp" |
| 65 | ], |
| 66 | arch: { |
| 67 | arm: { |
| 68 | cflags: ["-mcrc"], |
| 69 | srcs: ["standalone/crc32_hw.cpp"], |
| 70 | }, |
| 71 | arm64: { |
| 72 | cflags: ["-mcrc"], |
| 73 | srcs: ["standalone/crc32_hw.cpp"], |
| 74 | }, |
| 75 | x86_64: { |
| 76 | cflags: ["-msse4.2"], |
| 77 | srcs: ["standalone/crc32_hw.cpp"], |
| 78 | }, |
| 79 | x86: { |
| 80 | cflags: ["-msse4.2"], |
| 81 | srcs: ["standalone/crc32_hw.cpp"], |
| 82 | }, |
| 83 | }, |
| 84 | |
| 85 | target: { |
| 86 | linux_glibc: { |
| 87 | enabled: true, |
| 88 | }, |
| 89 | }, |
| 90 | |
Christopher Ferris | 3e5aef0 | 2019-09-25 20:15:25 -0700 | [diff] [blame] | 91 | header_libs: [ |
| 92 | "bionic_libc_platform_headers", |
Christopher Ferris | cbfcc16 | 2019-09-24 12:28:10 -0700 | [diff] [blame] | 93 | ], |
| 94 | } |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 95 | |
| 96 | cc_library_static { |
| 97 | name: "libscudo", |
| 98 | defaults: ["libscudo_defaults"], |
| 99 | cflags: ["-D_BIONIC=1"], |
| 100 | } |
| 101 | |
| 102 | cc_library_static { |
| 103 | name: "libscudo_for_testing", |
| 104 | defaults: ["libscudo_defaults"], |
| 105 | } |
| 106 | |
| 107 | cc_test { |
| 108 | name: "scudo_unit_tests", |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 109 | host_supported: true, |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 110 | srcs: [ |
| 111 | "standalone/tests/atomic_test.cpp", |
| 112 | "standalone/tests/bytemap_test.cpp", |
| 113 | "standalone/tests/checksum_test.cpp", |
| 114 | "standalone/tests/chunk_test.cpp", |
| 115 | "standalone/tests/combined_test.cpp", |
| 116 | "standalone/tests/flags_test.cpp", |
| 117 | "standalone/tests/list_test.cpp", |
| 118 | "standalone/tests/map_test.cpp", |
| 119 | "standalone/tests/mutex_test.cpp", |
| 120 | "standalone/tests/primary_test.cpp", |
| 121 | "standalone/tests/quarantine_test.cpp", |
| 122 | "standalone/tests/release_test.cpp", |
| 123 | "standalone/tests/report_test.cpp", |
| 124 | "standalone/tests/scudo_unit_test_main.cpp", |
| 125 | "standalone/tests/secondary_test.cpp", |
| 126 | "standalone/tests/size_class_map_test.cpp", |
| 127 | "standalone/tests/stats_test.cpp", |
| 128 | "standalone/tests/strings_test.cpp", |
| 129 | "standalone/tests/tsd_test.cpp", |
| 130 | "standalone/tests/vector_test.cpp", |
| 131 | ], |
| 132 | static_libs: ["libscudo_for_testing"], |
| 133 | include_dirs: [ |
| 134 | "external", |
| 135 | "external/scudo/standalone", |
| 136 | ], |
| 137 | cflags: [ |
| 138 | "-Wno-unused-parameter", |
| 139 | "-fno-emulated-tls", |
| 140 | ], |
Christopher Ferris | dadba4c | 2019-11-21 14:34:40 -0800 | [diff] [blame] | 141 | test_suites: ["general-tests"], |
Peter Collingbourne | 1c18260 | 2019-11-19 16:07:42 -0800 | [diff] [blame] | 142 | } |