1570af302Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd. 2570af302Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3570af302Sopenharmony_ci# you may not use this file except in compliance with the License. 4570af302Sopenharmony_ci# You may obtain a copy of the License at 5570af302Sopenharmony_ci# 6570af302Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7570af302Sopenharmony_ci# 8570af302Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9570af302Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10570af302Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11570af302Sopenharmony_ci# See the License for the specific language governing permissions and 12570af302Sopenharmony_ci# limitations under the License. 13570af302Sopenharmony_ci 14570af302Sopenharmony_ciimport("../../../test_template.gni") 15570af302Sopenharmony_ci 16570af302Sopenharmony_cigroup("ldso_cfi_test") { 17570af302Sopenharmony_ci testonly = true 18570af302Sopenharmony_ci deps = [ 19570af302Sopenharmony_ci ":cfi_avaiable_schemes_test", 20570af302Sopenharmony_ci ":cfi_cross_dso_dtor_test_exe", 21570af302Sopenharmony_ci ":cfi_cross_dso_dtor_test_use", 22570af302Sopenharmony_ci ":cfi_cross_dso_test_exe", 23570af302Sopenharmony_ci ":cfi_cross_dso_test_lib", 24570af302Sopenharmony_ci ":large_size_lib", 25570af302Sopenharmony_ci ":large_size_test", 26570af302Sopenharmony_ci ":ldso_cfi_check", 27570af302Sopenharmony_ci ":ldso_cfi_test_lib", 28570af302Sopenharmony_ci ":ldso_cfi_typeconversion", 29570af302Sopenharmony_ci ] 30570af302Sopenharmony_ci if (target_cpu == "arm64") { 31570af302Sopenharmony_ci deps += [ 32570af302Sopenharmony_ci ":cfi_icall_report_test", 33570af302Sopenharmony_ci ":cfi_report_test", 34570af302Sopenharmony_ci ] 35570af302Sopenharmony_ci } 36570af302Sopenharmony_ci} 37570af302Sopenharmony_ci 38570af302Sopenharmony_ciohos_executable("ldso_cfi_check") { 39570af302Sopenharmony_ci subsystem_name = "musl" 40570af302Sopenharmony_ci part_name = "libc-test" 41570af302Sopenharmony_ci include_dirs = [ 42570af302Sopenharmony_ci "../common", 43570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 44570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 45570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 46570af302Sopenharmony_ci ] 47570af302Sopenharmony_ci 48570af302Sopenharmony_ci sources = [ "ldso_cfi_check.c" ] 49570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 50570af302Sopenharmony_ci} 51570af302Sopenharmony_ci 52570af302Sopenharmony_ciohos_shared_library("ldso_cfi_test_lib") { 53570af302Sopenharmony_ci include_dirs = [ "." ] 54570af302Sopenharmony_ci sources = [ "ldso_cfi_test_lib.c" ] 55570af302Sopenharmony_ci 56570af302Sopenharmony_ci output_name = "ldso_cfi_test_lib" 57570af302Sopenharmony_ci output_extension = "so" 58570af302Sopenharmony_ci subsystem_name = "musl" 59570af302Sopenharmony_ci part_name = "libc-test-lib" 60570af302Sopenharmony_ci} 61570af302Sopenharmony_ci 62570af302Sopenharmony_ciohos_shared_library("cfi_cross_dso_test_lib") { 63570af302Sopenharmony_ci sanitize = { 64570af302Sopenharmony_ci cfi = true 65570af302Sopenharmony_ci cfi_cross_dso = true 66570af302Sopenharmony_ci debug = true 67570af302Sopenharmony_ci } 68570af302Sopenharmony_ci subsystem_name = "musl" 69570af302Sopenharmony_ci part_name = "libc-test-lib" 70570af302Sopenharmony_ci include_dirs = [ 71570af302Sopenharmony_ci "../common", 72570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 73570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 74570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 75570af302Sopenharmony_ci ] 76570af302Sopenharmony_ci use_rtti = true 77570af302Sopenharmony_ci 78570af302Sopenharmony_ci sources = [ "./crossdso/cfi_test_lib.cpp" ] 79570af302Sopenharmony_ci} 80570af302Sopenharmony_ci 81570af302Sopenharmony_ciohos_executable("cfi_cross_dso_test_exe") { 82570af302Sopenharmony_ci sanitize = { 83570af302Sopenharmony_ci cfi = true 84570af302Sopenharmony_ci cfi_cross_dso = true 85570af302Sopenharmony_ci debug = true 86570af302Sopenharmony_ci } 87570af302Sopenharmony_ci subsystem_name = "musl" 88570af302Sopenharmony_ci part_name = "libc-test" 89570af302Sopenharmony_ci include_dirs = [ 90570af302Sopenharmony_ci "../common", 91570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 92570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 93570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 94570af302Sopenharmony_ci ] 95570af302Sopenharmony_ci use_rtti = true 96570af302Sopenharmony_ci 97570af302Sopenharmony_ci sources = [ "./crossdso/cfi_test_exe.cpp" ] 98570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 99570af302Sopenharmony_ci} 100570af302Sopenharmony_ci 101570af302Sopenharmony_ciohos_shared_library("cfi_cross_dso_dtor_test_base") { 102570af302Sopenharmony_ci sanitize = { 103570af302Sopenharmony_ci cfi = true 104570af302Sopenharmony_ci cfi_cross_dso = true 105570af302Sopenharmony_ci debug = true 106570af302Sopenharmony_ci } 107570af302Sopenharmony_ci subsystem_name = "musl" 108570af302Sopenharmony_ci part_name = "libc-test-lib" 109570af302Sopenharmony_ci include_dirs = [ 110570af302Sopenharmony_ci "../common", 111570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 112570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 113570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 114570af302Sopenharmony_ci ] 115570af302Sopenharmony_ci use_rtti = true 116570af302Sopenharmony_ci 117570af302Sopenharmony_ci sources = [ "./crossdso_dtor/libbase.cpp" ] 118570af302Sopenharmony_ci} 119570af302Sopenharmony_ci 120570af302Sopenharmony_ciohos_shared_library("cfi_cross_dso_dtor_test_use") { 121570af302Sopenharmony_ci sanitize = { 122570af302Sopenharmony_ci cfi = true 123570af302Sopenharmony_ci cfi_cross_dso = true 124570af302Sopenharmony_ci debug = true 125570af302Sopenharmony_ci } 126570af302Sopenharmony_ci subsystem_name = "musl" 127570af302Sopenharmony_ci part_name = "libc-test-lib" 128570af302Sopenharmony_ci include_dirs = [ 129570af302Sopenharmony_ci "../common", 130570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 131570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 132570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 133570af302Sopenharmony_ci ] 134570af302Sopenharmony_ci use_rtti = true 135570af302Sopenharmony_ci 136570af302Sopenharmony_ci sources = [ "./crossdso_dtor/libuse.cpp" ] 137570af302Sopenharmony_ci 138570af302Sopenharmony_ci deps = [ ":cfi_cross_dso_dtor_test_base" ] 139570af302Sopenharmony_ci} 140570af302Sopenharmony_ci 141570af302Sopenharmony_ciohos_executable("cfi_cross_dso_dtor_test_exe") { 142570af302Sopenharmony_ci sanitize = { 143570af302Sopenharmony_ci cfi = true 144570af302Sopenharmony_ci cfi_cross_dso = true 145570af302Sopenharmony_ci debug = true 146570af302Sopenharmony_ci } 147570af302Sopenharmony_ci subsystem_name = "musl" 148570af302Sopenharmony_ci part_name = "libc-test" 149570af302Sopenharmony_ci include_dirs = [ 150570af302Sopenharmony_ci "../common", 151570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 152570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 153570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 154570af302Sopenharmony_ci ] 155570af302Sopenharmony_ci use_rtti = true 156570af302Sopenharmony_ci 157570af302Sopenharmony_ci ldflags = [ "-Wl,-rpath=./" ] 158570af302Sopenharmony_ci 159570af302Sopenharmony_ci sources = [ "./crossdso_dtor/cfi_dtor_test.cpp" ] 160570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 161570af302Sopenharmony_ci deps = [ ":cfi_cross_dso_dtor_test_base" ] 162570af302Sopenharmony_ci} 163570af302Sopenharmony_ci 164570af302Sopenharmony_ciohos_executable("cfi_avaiable_schemes_test") { 165570af302Sopenharmony_ci sanitize = { 166570af302Sopenharmony_ci cfi = true 167570af302Sopenharmony_ci cfi_cross_dso = true 168570af302Sopenharmony_ci debug = true 169570af302Sopenharmony_ci } 170570af302Sopenharmony_ci subsystem_name = "musl" 171570af302Sopenharmony_ci part_name = "libc-test" 172570af302Sopenharmony_ci include_dirs = [ 173570af302Sopenharmony_ci "../common", 174570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 175570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 176570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 177570af302Sopenharmony_ci ] 178570af302Sopenharmony_ci use_rtti = true 179570af302Sopenharmony_ci 180570af302Sopenharmony_ci sources = [ "cfi_avaiable_schemes_test.cpp" ] 181570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 182570af302Sopenharmony_ci} 183570af302Sopenharmony_ci 184570af302Sopenharmony_ciohos_executable("ldso_cfi_typeconversion") { 185570af302Sopenharmony_ci sanitize = { 186570af302Sopenharmony_ci cfi = true 187570af302Sopenharmony_ci cfi_cross_dso = true 188570af302Sopenharmony_ci debug = true 189570af302Sopenharmony_ci } 190570af302Sopenharmony_ci subsystem_name = "musl" 191570af302Sopenharmony_ci part_name = "libc-test" 192570af302Sopenharmony_ci include_dirs = [ 193570af302Sopenharmony_ci "../common", 194570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/include", 195570af302Sopenharmony_ci "//third_party/musl/porting/linux/user/ldso", 196570af302Sopenharmony_ci "//third_party/musl/libc-test/src/common", 197570af302Sopenharmony_ci ] 198570af302Sopenharmony_ci use_rtti = true 199570af302Sopenharmony_ci 200570af302Sopenharmony_ci sources = [ "ldso_cfi_typeconversion.cpp" ] 201570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 202570af302Sopenharmony_ci} 203570af302Sopenharmony_ci 204570af302Sopenharmony_ciohos_executable("cfi_icall_report_test") { 205570af302Sopenharmony_ci sanitize = { 206570af302Sopenharmony_ci cfi = true 207570af302Sopenharmony_ci cfi_cross_dso = true 208570af302Sopenharmony_ci debug = false 209570af302Sopenharmony_ci } 210570af302Sopenharmony_ci subsystem_name = "musl" 211570af302Sopenharmony_ci part_name = "libc-test" 212570af302Sopenharmony_ci 213570af302Sopenharmony_ci sources = [ "./cfi_report_test/cfi_icall_report_test.cpp" ] 214570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 215570af302Sopenharmony_ci} 216570af302Sopenharmony_ci 217570af302Sopenharmony_ciohos_executable("cfi_report_test") { 218570af302Sopenharmony_ci subsystem_name = "musl" 219570af302Sopenharmony_ci part_name = "libc-test" 220570af302Sopenharmony_ci 221570af302Sopenharmony_ci sources = [ "./cfi_report_test/cfi_report_test.cpp" ] 222570af302Sopenharmony_ci configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] 223570af302Sopenharmony_ci} 224570af302Sopenharmony_ci 225570af302Sopenharmony_ciohos_executable("large_size_test") { 226570af302Sopenharmony_ci sanitize = { 227570af302Sopenharmony_ci cfi = true 228570af302Sopenharmony_ci cfi_cross_dso = true 229570af302Sopenharmony_ci } 230570af302Sopenharmony_ci ldflags = [ "-Wl,-rpath=./" ] 231570af302Sopenharmony_ci subsystem_name = "musl" 232570af302Sopenharmony_ci part_name = "libc-test" 233570af302Sopenharmony_ci deps = [ ":large_size_lib" ] 234570af302Sopenharmony_ci sources = [ "./large_size_library/large_size_test.cpp" ] 235570af302Sopenharmony_ci} 236570af302Sopenharmony_ci 237570af302Sopenharmony_ciohos_shared_library("large_size_lib") { 238570af302Sopenharmony_ci sanitize = { 239570af302Sopenharmony_ci cfi = true 240570af302Sopenharmony_ci cfi_cross_dso = true 241570af302Sopenharmony_ci } 242570af302Sopenharmony_ci output_name = "large_size" 243570af302Sopenharmony_ci output_extension = "so" 244570af302Sopenharmony_ci subsystem_name = "musl" 245570af302Sopenharmony_ci part_name = "libc-test-lib" 246570af302Sopenharmony_ci 247570af302Sopenharmony_ci sources = [ "./large_size_library/large_size_lib.cpp" ] 248570af302Sopenharmony_ci} 249