# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("$build_root/config/compiler/compiler.gni") import("$build_root/config/ohos/config.gni") import("$build_root/third_party_gn/musl/musl_config.gni") assert(is_ohos) config("compiler") { cflags = [ "-ffunction-sections", "-fno-short-enums", ] defines = [ "HAVE_SYS_UIO_H" ] cflags += [ "--target=$abi_target" ] include_dirs = [ "${musl_sysroot}/usr/include/${abi_target}" ] ldflags = [ "--target=$abi_target" ] asmflags = cflags } config("runtime_config") { cflags_cc = [] defines = [ "__MUSL__", "_LIBCPP_HAS_MUSL_LIBC", "__BUILD_LINUX_WITH_CLANG", ] ldflags = [ "-nostdlib" ] libs = [ rebase_path(libclang_rt_file), "c", rebase_path(libcxxabi_file), ] if ((current_cpu == "arm" && arm_version == 6) || current_cpu == "mipsel") { libs += [ "atomic" ] libs_out_dir = "usr/lib/${musl_target_triple}" output_dir = "${target_out_dir}/${libs_out_dir}" atomic_path = rebase_path("${output_dir}") ldflags += [ "-L${atomic_path}" ] } ldflags += [ "-Wl,--warn-shared-textrel" ] } config("executable_config") { cflags = [ "-fPIE", "-fPIC", ] asmflags = [ "-fPIE" ] }