1e509ee18Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
2e509ee18Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3e509ee18Sopenharmony_ci# you may not use this file except in compliance with the License.
4e509ee18Sopenharmony_ci# You may obtain a copy of the License at
5e509ee18Sopenharmony_ci#
6e509ee18Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7e509ee18Sopenharmony_ci#
8e509ee18Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9e509ee18Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10e509ee18Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11e509ee18Sopenharmony_ci# See the License for the specific language governing permissions and
12e509ee18Sopenharmony_ci# limitations under the License.
13e509ee18Sopenharmony_ci
14e509ee18Sopenharmony_ciif (current_cpu == "arm" || current_cpu == "arm64") {
15e509ee18Sopenharmony_ci  import("$build_root/config/arm.gni")
16e509ee18Sopenharmony_ci}
17e509ee18Sopenharmony_ci
18e509ee18Sopenharmony_ciif (current_cpu == "arm" || current_cpu == "arm64") {
19e509ee18Sopenharmony_ci  import("$build_root/config/arm.gni")
20e509ee18Sopenharmony_ci}
21e509ee18Sopenharmony_ci
22e509ee18Sopenharmony_ciis_ohos_or_android = is_ohos || is_android
23e509ee18Sopenharmony_ci
24e509ee18Sopenharmony_cioptimize_for_size = is_ohos_or_android
25e509ee18Sopenharmony_ci
26e509ee18Sopenharmony_cideclare_args() {
27e509ee18Sopenharmony_ci  # Set to true to use lld, the LLVM linker. This flag may be used on Windows,
28e509ee18Sopenharmony_ci  # Linux.
29e509ee18Sopenharmony_ci  use_lld = is_clang &&
30e509ee18Sopenharmony_ci            (is_win || (is_linux && current_cpu == "x64") ||
31e509ee18Sopenharmony_ci             (is_linux && current_cpu == "x86") ||
32e509ee18Sopenharmony_ci             (is_ohos_or_android && (current_cpu != "arm" || arm_version >= 7)))
33e509ee18Sopenharmony_ci}
34e509ee18Sopenharmony_ci
35e509ee18Sopenharmony_cideclare_args() {
36e509ee18Sopenharmony_ci  # Whether to use the gold linker from binutils instead of lld or bfd.
37e509ee18Sopenharmony_ci  use_gold =
38e509ee18Sopenharmony_ci      !use_lld &&
39e509ee18Sopenharmony_ci      ((is_linux && (current_cpu == "x64" || current_cpu == "x86" ||
40e509ee18Sopenharmony_ci                     current_cpu == "arm")) ||
41e509ee18Sopenharmony_ci       (is_ohos_or_android && (current_cpu == "x86" || current_cpu == "x64" ||
42e509ee18Sopenharmony_ci                               current_cpu == "arm" || current_cpu == "arm64")))
43e509ee18Sopenharmony_ci}
44