| # 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. |
| |
| import("$zx/public/gn/config/levels.gni") |
| |
| library("ngunwind") { |
| shared = true |
| deps += [ |
| ":private_config", |
| "$zx/system/ulib/zircon", |
| ] |
| sources = [ |
| "src/dwarf/Gexpr.c", |
| "src/dwarf/Gfde.c", |
| "src/dwarf/Gfind_proc_info-lsb.c", |
| "src/dwarf/Gfind_unwind_table.c", |
| "src/dwarf/Gparser.c", |
| "src/dwarf/Gpe.c", |
| "src/dwarf/Gstep.c", |
| "src/dwarf/global.c", |
| "src/fuchsia.c", |
| "src/mi/Gdestroy_addr_space.c", |
| "src/mi/Gdyn-extract.c", |
| "src/mi/Gdyn-remote.c", |
| "src/mi/Gfind_dynamic_proc_info.c", |
| "src/mi/Gget_accessors.c", |
| "src/mi/Gget_fpreg.c", |
| "src/mi/Gget_proc_info_by_ip.c", |
| "src/mi/Gget_proc_name.c", |
| "src/mi/Gget_reg.c", |
| "src/mi/Gput_dynamic_unwind_info.c", |
| "src/mi/Gset_caching_policy.c", |
| "src/mi/Gset_fpreg.c", |
| "src/mi/Gset_reg.c", |
| "src/mi/common.c", |
| "src/mi/flush_cache.c", |
| "src/mi/init.c", |
| "src/mi/mempool.c", |
| "src/mi/strerror.c", |
| ] |
| if (current_cpu == "arm64") { |
| sources += [ |
| "src/aarch64/Gcreate_addr_space.c", |
| "src/aarch64/Gget_proc_info.c", |
| "src/aarch64/Gget_save_loc.c", |
| "src/aarch64/Gglobal.c", |
| "src/aarch64/Ginit.c", |
| "src/aarch64/Ginit_local.c", |
| "src/aarch64/Ginit_remote.c", |
| "src/aarch64/Gregs.c", |
| "src/aarch64/Gsignal_frame.c", |
| "src/aarch64/Gstash_frame.c", |
| "src/aarch64/Gstep.c", |
| "src/aarch64/fuchsia.c", |
| "src/aarch64/regname.c", |
| "src/elf64.c", |
| ] |
| } else if (current_cpu == "x64") { |
| sources += [ |
| "src/elf64.c", |
| "src/x86_64/Gcreate_addr_space.c", |
| "src/x86_64/Gget_proc_info.c", |
| "src/x86_64/Gget_save_loc.c", |
| "src/x86_64/Gglobal.c", |
| "src/x86_64/Ginit.c", |
| "src/x86_64/Ginit_local.c", |
| "src/x86_64/Ginit_remote.c", |
| "src/x86_64/Gregs.c", |
| "src/x86_64/Gsignal_frame.c", |
| "src/x86_64/Gstash_frame.c", |
| "src/x86_64/Gstep.c", |
| "src/x86_64/fuchsia.c", |
| "src/x86_64/regname.c", |
| ] |
| } |
| |
| # Compile this with frame pointers so that if we crash |
| # the simplistic unwinder will work. |
| deps -= [ "$zx/public/gn/config:default_frame_pointers" ] |
| deps += [ "$zx/public/gn/config:frame_pointers" ] |
| |
| if (opt_level < 2) { |
| # Force -O2 since the library doesn't build with -Og. |
| deps -= [ "$zx/public/gn/config:opt_level" ] |
| cflags = [ "-O2" ] |
| } |
| } |
| |
| config_group("private_config") { |
| visibility = [ ":*" ] |
| |
| defines = [ "DEBUG" ] |
| include_dirs = [ |
| "include/ngunwind", |
| "include/ngunwind/private", |
| ] |
| |
| # cflags has to go in a config rather than directly in the target because |
| # the target's cflags comes before the standard configs that include the |
| # positive -W* switches, but -Wno-* switches must come afterwards. |
| if (!is_gcc) { |
| cflags = [ "-Wno-absolute-value" ] |
| } |
| } |