blob: 544605a3a1efc98a15bdc2a16aad142bbe19caa1 [file] [log] [blame]
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# 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.
common_sources = [
"src/AddressSpace.hpp",
"src/CompactUnwinder.hpp",
"src/DwarfInstructions.hpp",
"src/DwarfParser.hpp",
"src/EHHeaderParser.hpp",
"src/RWMutex.hpp",
"src/Registers.hpp",
"src/Unwind-EHABI.cpp",
"src/Unwind-EHABI.h",
"src/Unwind-sjlj.c",
"src/UnwindCursor.hpp",
"src/UnwindLevel1-gcc-ext.c",
"src/UnwindLevel1.c",
"src/UnwindRegistersRestore.S",
"src/UnwindRegistersSave.S",
"src/assembly.h",
"src/config.h",
"src/dwarf2.h",
"src/libunwind.cpp",
"src/libunwind_ext.h",
]
if (is_apple) {
common_sources += [ "src/Unwind_AppleExtras.cpp" ]
}
config("common_unwind_dependents_config") {
include_dirs = [ "include" ]
defines = [
# Ensure that __external_threading is used for threading support.
"_LIBCPP_HAS_THREAD_API_EXTERNAL",
"LLVM_PATH=" +
rebase_path("//third_party/llvm-project/llvm/", root_build_dir),
]
}
# TODO: this conditional is only to prevent gn check errors related to evergreen
# dependencies from spilling over to gn check when run for non-evergreen
# platforms (e.g., raspi-2_gn_devel). It can and should be removed once the gn
# check errors have been resolved for evergreen.
if (sb_is_evergreen) {
config("unwind_evergreen_config") {
configs = [ ":common_unwind_dependents_config" ]
cflags = [
"-nostdinc",
"-Wno-unused-command-line-argument",
]
cflags_cc = [
"-std=c++11",
"-nostdinc++",
"-fPIC",
"-Werror=return-type",
"-fvisibility-inlines-hidden",
"-fms-compatibility-version=19.00",
"-funwind-tables",
"-Wall",
"-Wextra",
"-Wwrite-strings",
"-Wshorten-64-to-32",
"-Wno-error",
"-Wno-unused-parameter",
]
defines = [
# Build libunwind with concurrency built upon Starboard mutexes and
# condition variables.
"_LIBUNWIND_HAS_STARBOARD_THREADS",
"LIBUNWIND_PRINT_APIS",
"LIBUNWIND_PRINT_DWARF",
"LIBUNWIND_PRINT_UNWINDING",
]
}
static_library("unwind_evergreen") {
sources = common_sources
configs += [ ":unwind_evergreen_config" ]
all_dependent_configs = [ ":common_unwind_dependents_config" ]
deps = [
"//starboard/common",
"//third_party/musl:c",
]
}
}
config("unwind_starboard_config") {
configs = [
":common_unwind_dependents_config",
"//starboard/build/config:starboard_implementation",
]
cflags = [ "-Wno-unused-command-line-argument" ]
cflags_cc = [
"-std=c++11",
"-fPIC",
"-Werror=return-type",
"-fvisibility-inlines-hidden",
"-funwind-tables",
"-Wall",
"-Wextra",
"-Wwrite-strings",
"-Wno-error",
"-Wno-unused-parameter",
]
defines = [
# Build libunwind with concurrency built upon Starboard mutexes and
# condition variables.
"_LIBUNWIND_HAS_STARBOARD_THREADS",
]
}
static_library("unwind_starboard") {
sources = common_sources
configs += [ ":unwind_starboard_config" ]
all_dependent_configs = [ ":common_unwind_dependents_config" ]
public_deps = [
"//starboard/common",
"//starboard/elf_loader:evergreen_info",
]
}