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 14if (current_cpu == "arm" || current_cpu == "arm64") { 15 import("$build_root/config/arm.gni") 16} 17 18if (current_cpu == "arm" || current_cpu == "arm64") { 19 import("$build_root/config/arm.gni") 20} 21 22is_ohos_or_android = is_ohos || is_android 23 24optimize_for_size = is_ohos_or_android 25 26declare_args() { 27 # Set to true to use lld, the LLVM linker. This flag may be used on Windows, 28 # Linux. 29 use_lld = is_clang && 30 (is_win || (is_linux && current_cpu == "x64") || 31 (is_linux && current_cpu == "x86") || 32 (is_ohos_or_android && (current_cpu != "arm" || arm_version >= 7))) 33} 34 35declare_args() { 36 # Whether to use the gold linker from binutils instead of lld or bfd. 37 use_gold = 38 !use_lld && 39 ((is_linux && (current_cpu == "x64" || current_cpu == "x86" || 40 current_cpu == "arm")) || 41 (is_ohos_or_android && (current_cpu == "x86" || current_cpu == "x64" || 42 current_cpu == "arm" || current_cpu == "arm64"))) 43} 44