# 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("//arkcompiler/ets_runtime/js_runtime_config.gni")
config("mapleallcompilecfg") {
cflags = []
cflags_cc = [ "-frtti" ]
cflags_c = []
if (is_fastverify) {
cflags_cc += [
"-O3",
"-ggdb3",
"-fno-omit-frame-pointer",
"-D_GLIBCXX_ASSERTIONS",
]
cflags_c += [
"-O3",
"-ggdb3",
"-fno-omit-frame-pointer",
"-D_GLIBCXX_ASSERTIONS",
]
} else if (is_debug) {
cflags_cc += [
"-O0",
"-g3",
"-ftrapv",
"-fstack-check",
"-DDEBUG",
]
cflags_c += [
"-O0",
"-g3",
"-ftrapv",
"-fstack-check",
"-DDEBUG",
]
} else {
cflags_cc += [
"-O2",
"-fno-strict-aliasing",
"-D_FORTIFY_SOURCE=2",
]
cflags_c += [
"-O2",
"-fno-strict-aliasing",
"-D_FORTIFY_SOURCE=2",
]
}
cflags_c += [
"-Wall",
"-fstack-protector-strong",
"-fvisibility=hidden",
"-pipe",
"-Werror",
"-Wdate-time",
"-Wfloat-equal",
"-Wno-c99-designator",
]
cflags_cc += [
"-Wall",
"-fstack-protector-strong",
"-fvisibility=hidden",
"-pipe",
"-Wno-c99-designator",
"-Wno-range-loop-construct",
"-Werror",
"-Wdate-time",
"-Wfloat-equal",
"-DDYNAMICLANG",
"-DRC_NO_MMAP",
"-DMIR_FEATURE_FULL=1",
"-std=c++17",
"-fno-common",
]
if (current_os != "mingw") {
cflags_c += [
"-fPIC",
"-fPIE",
]
cflags_cc += [ "-fPIC" ]
} else {
cflags_c += [ "-fno-stack-protector" ]
cflags_cc += [ "-fno-stack-protector" ]
}
if (TARGET == "aarch64" || TARGET == "x86_64") {
cflags_cc += [ "-DTARGX86_64" ]
cflags_cc += [ "-DTARGAARCH64" ]
}
# Setting up IS_RELEASE_VERSION if compiling as release version
if (build_variant == "user") {
cflags_c += [ "-DIS_RELEASE_VERSION" ]
cflags_cc += [ "-DIS_RELEASE_VERSION" ]
}
if (TARGET == "riscv64") {
cflags_cc += [ "-DTARGRISCV64" ]
}
if (TARGET == "ark") {
cflags_cc += [ "-DTARGARK" ]
}
if (HOST_ARCH == 64) {
ldflags = []
ldflags += [
"-rdynamic",
"-lpthread",
"-Wl,-z,relro",
"-Wl,-z,now",
"-Wl,-z,noexecstack",
"-pie",
]
}
if (enable_litecg_emit) {
defines = [ "ARK_LITECG_DEBUG" ]
}
}