1# Copyright (c) 2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("../../../test_template.gni") 15 16group("ldso_cfi_test") { 17 testonly = true 18 deps = [ 19 ":cfi_avaiable_schemes_test", 20 ":cfi_cross_dso_dtor_test_exe", 21 ":cfi_cross_dso_dtor_test_use", 22 ":cfi_cross_dso_test_exe", 23 ":cfi_cross_dso_test_lib", 24 ":ldso_cfi_check", 25 ":ldso_cfi_test_lib", 26 ":ldso_cfi_typeconversion", 27 ] 28 if (target_cpu == "arm64") { 29 deps += [ 30 ":cfi_icall_report_test", 31 ":cfi_report_test", 32 ] 33 } 34} 35 36ohos_executable("ldso_cfi_check") { 37 subsystem_name = "musl" 38 part_name = "libc-test" 39 include_dirs = [ 40 "../common", 41 "//third_party/musl/porting/linux/user/include", 42 "//third_party/musl/porting/linux/user/ldso", 43 "//third_party/musl/libc-test/src/common", 44 ] 45 46 sources = [ "ldso_cfi_check.c" ] 47 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 48} 49 50ohos_shared_library("ldso_cfi_test_lib") { 51 include_dirs = [ "." ] 52 sources = [ "ldso_cfi_test_lib.c" ] 53 54 output_name = "ldso_cfi_test_lib" 55 output_extension = "so" 56 subsystem_name = "musl" 57 part_name = "libc-test-lib" 58} 59 60ohos_shared_library("cfi_cross_dso_test_lib") { 61 sanitize = { 62 cfi = true 63 cfi_cross_dso = true 64 debug = true 65 } 66 subsystem_name = "musl" 67 part_name = "libc-test-lib" 68 include_dirs = [ 69 "../common", 70 "//third_party/musl/porting/linux/user/include", 71 "//third_party/musl/porting/linux/user/ldso", 72 "//third_party/musl/libc-test/src/common", 73 ] 74 use_rtti = true 75 76 sources = [ "./crossdso/cfi_test_lib.cpp" ] 77} 78 79ohos_executable("cfi_cross_dso_test_exe") { 80 sanitize = { 81 cfi = true 82 cfi_cross_dso = true 83 debug = true 84 } 85 subsystem_name = "musl" 86 part_name = "libc-test" 87 include_dirs = [ 88 "../common", 89 "//third_party/musl/porting/linux/user/include", 90 "//third_party/musl/porting/linux/user/ldso", 91 "//third_party/musl/libc-test/src/common", 92 ] 93 use_rtti = true 94 95 sources = [ "./crossdso/cfi_test_exe.cpp" ] 96 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 97} 98 99ohos_shared_library("cfi_cross_dso_dtor_test_base") { 100 sanitize = { 101 cfi = true 102 cfi_cross_dso = true 103 debug = true 104 } 105 subsystem_name = "musl" 106 part_name = "libc-test-lib" 107 include_dirs = [ 108 "../common", 109 "//third_party/musl/porting/linux/user/include", 110 "//third_party/musl/porting/linux/user/ldso", 111 "//third_party/musl/libc-test/src/common", 112 ] 113 use_rtti = true 114 115 sources = [ "./crossdso_dtor/libbase.cpp" ] 116} 117 118ohos_shared_library("cfi_cross_dso_dtor_test_use") { 119 sanitize = { 120 cfi = true 121 cfi_cross_dso = true 122 debug = true 123 } 124 subsystem_name = "musl" 125 part_name = "libc-test-lib" 126 include_dirs = [ 127 "../common", 128 "//third_party/musl/porting/linux/user/include", 129 "//third_party/musl/porting/linux/user/ldso", 130 "//third_party/musl/libc-test/src/common", 131 ] 132 use_rtti = true 133 134 sources = [ "./crossdso_dtor/libuse.cpp" ] 135 136 deps = [ ":cfi_cross_dso_dtor_test_base" ] 137} 138 139ohos_executable("cfi_cross_dso_dtor_test_exe") { 140 sanitize = { 141 cfi = true 142 cfi_cross_dso = true 143 debug = true 144 } 145 subsystem_name = "musl" 146 part_name = "libc-test" 147 include_dirs = [ 148 "../common", 149 "//third_party/musl/porting/linux/user/include", 150 "//third_party/musl/porting/linux/user/ldso", 151 "//third_party/musl/libc-test/src/common", 152 ] 153 use_rtti = true 154 155 ldflags = [ "-Wl,-rpath=./" ] 156 157 sources = [ "./crossdso_dtor/cfi_dtor_test.cpp" ] 158 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 159 deps = [ ":cfi_cross_dso_dtor_test_base" ] 160} 161 162ohos_executable("cfi_avaiable_schemes_test") { 163 sanitize = { 164 cfi = true 165 cfi_cross_dso = true 166 debug = true 167 } 168 subsystem_name = "musl" 169 part_name = "libc-test" 170 include_dirs = [ 171 "../common", 172 "//third_party/musl/porting/linux/user/include", 173 "//third_party/musl/porting/linux/user/ldso", 174 "//third_party/musl/libc-test/src/common", 175 ] 176 use_rtti = true 177 178 sources = [ "cfi_avaiable_schemes_test.cpp" ] 179 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 180} 181 182ohos_executable("ldso_cfi_typeconversion") { 183 sanitize = { 184 cfi = true 185 cfi_cross_dso = true 186 debug = true 187 } 188 subsystem_name = "musl" 189 part_name = "libc-test" 190 include_dirs = [ 191 "../common", 192 "//third_party/musl/porting/linux/user/include", 193 "//third_party/musl/porting/linux/user/ldso", 194 "//third_party/musl/libc-test/src/common", 195 ] 196 use_rtti = true 197 198 sources = [ "ldso_cfi_typeconversion.cpp" ] 199 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 200} 201 202ohos_executable("cfi_icall_report_test") { 203 sanitize = { 204 cfi = true 205 cfi_cross_dso = true 206 debug = false 207 } 208 subsystem_name = "musl" 209 part_name = "libc-test" 210 211 sources = [ "./cfi_report_test/cfi_icall_report_test.cpp" ] 212 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 213} 214 215ohos_executable("cfi_report_test") { 216 subsystem_name = "musl" 217 part_name = "libc-test" 218 219 sources = [ "./cfi_report_test/cfi_report_test.cpp" ] 220 configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 221} 222