1# Copyright (c) 2024 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("//build/ohos.gni") 15import("../../../code_signature.gni") 16 17config("public_jit_code_sign_configs") { 18 include_dirs = [ "include" ] 19} 20 21config("private_jit_code_sign_configs") { 22 cflags = [ "-march=armv8.4-a" ] 23 defines = [ "ARCH_PAC_SUPPORT" ] 24} 25 26ohos_source_set("pac_sign_feature") { 27 sources = [ "src/pac_sign_ctx.cpp" ] 28 sanitize = { 29 cfi = true 30 cfi_cross_dso = true 31 debug = false 32 } 33 branch_protector_ret = "pac_ret" 34 public_configs = [ 35 ":public_jit_code_sign_configs", 36 "${code_signature_root_dir}:common_public_config", 37 ] 38 configs = [ "${code_signature_root_dir}:common_utils_config" ] 39 if (jit_code_sign_enable) { 40 configs += [ ":private_jit_code_sign_configs" ] 41 } 42 external_deps = [ 43 "bounds_checking_function:libsec_shared", 44 "hilog:libhilog", 45 ] 46 part_name = "code_signature" 47 subsystem_name = "security" 48} 49 50ohos_shared_library("libjit_code_sign") { 51 sources = [ "src/jit_code_signer.cpp" ] 52 deps = [ ":pac_sign_feature" ] 53 cflags_cc = [ 54 "-Os", 55 "-fno-asynchronous-unwind-tables", 56 "-fno-unwind-tables", 57 ] 58 branch_protector_ret = "pac_ret" 59 sanitize = { 60 cfi = true 61 cfi_cross_dso = true 62 debug = false 63 } 64 public_configs = [ 65 ":public_jit_code_sign_configs", 66 "${code_signature_root_dir}:common_public_config", 67 ] 68 configs = [ "${code_signature_root_dir}:common_utils_config" ] 69 external_deps = [ 70 "bounds_checking_function:libsec_shared", 71 "hilog:libhilog", 72 ] 73 part_name = "code_signature" 74 subsystem_name = "security" 75} 76