| # Copyright 2018 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| config("config") { |
| defines = [ "NO_LIBDEXFILE_SUPPORT" ] |
| include_dirs = [ |
| "fuchsia", |
| "include", |
| ] |
| |
| if (is_mac) { |
| # This has to be public so that includes from unwindstack/ElfInterface.h can |
| # find the elf.h that is copied from //zircon below. Not to be confused with |
| # unwindstack/Elf.h, or ELF.h that's picked up from clang. o_O |
| include_dirs += [ target_gen_dir ] |
| } |
| } |
| |
| config("config_private") { |
| defines = [ "FUCHSIA" ] |
| } |
| |
| static_library("libunwindstack") { |
| public_configs = [ ":config" ] |
| configs += [ ":config_private" ] |
| |
| sources = [ |
| "ArmExidx.cpp", |
| "DwarfCfa.cpp", |
| "DwarfEhFrameWithHdr.cpp", |
| "DwarfMemory.cpp", |
| "DwarfOp.cpp", |
| "DwarfSection.cpp", |
| "Elf.cpp", |
| "ElfInterface.cpp", |
| "ElfInterfaceArm.cpp", |
| "Global.cpp", |
| "JitDebug.cpp", |
| "MapInfo.cpp", |
| "Symbols.cpp", |
| "Unwinder.cpp", |
| "fuchsia/LogFuchsia.cpp", |
| "fuchsia/MapsFuchsia.cpp", |
| |
| # These files are Android-specific and aren't compiled for Fuchsia. |
| #"DexFile.cpp", |
| #"DexFiles.cpp", |
| #"LocalUnwinder.cpp", |
| #"Log.cpp", |
| #"Maps.cpp", |
| ] |
| |
| if (is_fuchsia) { |
| # This project does some locking but doesn't annotate usage. |
| configs -= [ "//build/config/fuchsia:thread_safety_annotations" ] |
| |
| sources += [ "fuchsia/MemoryFuchsia.cpp" ] |
| |
| if (target_cpu == "x64") { |
| sources += [ "fuchsia/RegsFuchsiaX86_64.cpp" ] |
| } else if (target_cpu == "arm64") { |
| sources += [ "fuchsia/RegsFuchsiaArm64.cpp" ] |
| } |
| } else { |
| sources += [ |
| "Memory.cpp", |
| "Regs.cpp", |
| "RegsArm.cpp", |
| "RegsArm64.cpp", |
| "RegsMips.cpp", |
| "RegsMips64.cpp", |
| "RegsX86.cpp", |
| "RegsX86_64.cpp", |
| ] |
| } |
| |
| deps = [ |
| "//src/lib/fxl", |
| "//zircon/public/lib/fbl", |
| ] |
| if (is_mac) { |
| deps += [ ":copy_elf_h" ] |
| } |
| |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| if (is_mac) { |
| # libunwindstack needs elf.h which doesn't come on Mac. Copy the one out of |
| # Zircon and use it in this build. |
| copy("copy_elf_h") { |
| sources = [ "//zircon/third_party/ulib/musl/include/elf.h" ] |
| outputs = [ "$target_gen_dir/elf.h" ] |
| } |
| } |