1# Copyright (C) 2023 Huawei Technologies Co., Ltd. 2# Licensed under the Mulan PSL v2. 3# You can use this software according to the terms and conditions of the Mulan 4# PSL v2. 5# You may obtain a copy of Mulan PSL v2 at: 6# http://license.coscl.org.cn/MulanPSL2 7# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY 8# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 9# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 10# See the Mulan PSL v2 for more details. 11 12# config for security features. 13 14if ("${ENABLE_BTI}" STREQUAL "y") 15 list(APPEND COMMON_CFLAGS 16 -mbranch-protection=bti 17 ) 18 list(APPEND COMMON_LDFLAGS 19 -z force-bti 20 ) 21endif() 22if ("${ENABLE_PAC}" STREQUAL "y") 23 list(APPEND COMMON_CFLAGS 24 -mbranch-protection=pac-ret+leaf+b-key 25 ) 26endif() 27set(COMMON_LDFLAGS ${COMMON_LDFLAGS} CACHE INTERNAL "") 28set(COMMON_CFLAGS ${COMMON_CFLAGS} CACHE INTERNAL "")