1# Copyright 2019 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15LIBUNWIND_COPTS = [ 16 "-DHAVE_CONFIG_H", 17 "-D_GNU_SOURCE", 18 "-Iexternal/org_gnu_libunwind/include", 19 "-Iexternal/org_gnu_libunwind/include/tdep", 20 "-Iexternal/org_gnu_libunwind/src", 21] 22 23filegroup( 24 name = "internal_headers", 25 srcs = [ 26 "include/compiler.h", 27 "include/config.h", 28 "include/dwarf.h", 29 "include/dwarf-eh.h", 30 "include/dwarf_i.h", 31 "include/libunwind.h", 32 "include/libunwind-common.h", 33 "include/libunwind-coredump.h", 34 "include/libunwind-dynamic.h", 35 "include/libunwind-ptrace.h", 36 "include/libunwind-x86_64.h", 37 "include/libunwind_i.h", 38 "include/mempool.h", 39 "include/remote.h", 40 "include/tdep-x86_64/dwarf-config.h", 41 "include/tdep-x86_64/libunwind_i.h", 42 "include/tdep/dwarf-config.h", 43 "include/tdep/libunwind_i.h", 44 "include/unwind.h", 45 "src/elf32.h", 46 "src/elf64.h", 47 "src/elfxx.h", 48 "src/os-linux.h", 49 "src/x86_64/init.h", 50 "src/x86_64/offsets.h", 51 "src/x86_64/ucontext_i.h", 52 "src/x86_64/unwind_i.h", 53 ], 54) 55 56# Header-only library for included source files. 57cc_library( 58 name = "included_sources", 59 srcs = [ 60 "src/elf64.h", 61 "src/elfxx.h", 62 ], 63 hdrs = [ 64 "src/elfxx.c", # Included by elf32.c/elf64.c 65 ], 66) 67 68filegroup( 69 name = "sources_common", 70 srcs = [ 71 "src/dwarf/Gexpr.c", 72 "src/dwarf/Gfde.c", 73 "src/dwarf/Gfind_proc_info-lsb.c", 74 "src/dwarf/Gfind_unwind_table.c", 75 "src/dwarf/Gparser.c", 76 "src/dwarf/Gpe.c", 77 "src/dwarf/global.c", 78 "src/mi/Gdestroy_addr_space.c", 79 "src/mi/Gdyn-extract.c", 80 "src/mi/Gfind_dynamic_proc_info.c", 81 "src/mi/Gget_accessors.c", 82 "src/mi/Gget_proc_name.c", 83 "src/mi/Gget_reg.c", 84 "src/mi/Gput_dynamic_unwind_info.c", 85 "src/mi/flush_cache.c", 86 "src/mi/init.c", 87 "src/mi/mempool.c", 88 "src/os-linux.c", 89 "src/x86_64/Gcreate_addr_space.c", 90 "src/x86_64/Gglobal.c", 91 "src/x86_64/Ginit.c", 92 "src/x86_64/Gos-linux.c", 93 "src/x86_64/Gregs.c", 94 "src/x86_64/Gresume.c", 95 "src/x86_64/Gstash_frame.c", 96 "src/x86_64/Gstep.c", 97 "src/x86_64/is_fpreg.c", 98 "src/x86_64/setcontext.S", 99 ":internal_headers", 100 ], 101) 102 103filegroup( 104 name = "sources_ptrace", 105 srcs = ["src/x86_64/Ginit_remote.c"], 106) 107 108cc_library( 109 name = "unwind-ptrace", 110 srcs = [ 111 "src/mi/Gdyn-remote.c", 112 "src/ptrace/_UPT_access_fpreg.c", 113 "src/ptrace/_UPT_access_mem.c", 114 "src/ptrace/_UPT_access_reg.c", 115 "src/ptrace/_UPT_accessors.c", 116 "src/ptrace/_UPT_create.c", 117 "src/ptrace/_UPT_destroy.c", 118 "src/ptrace/_UPT_elf.c", 119 "src/ptrace/_UPT_find_proc_info.c", 120 "src/ptrace/_UPT_get_dyn_info_list_addr.c", 121 "src/ptrace/_UPT_get_proc_name.c", 122 "src/ptrace/_UPT_internal.h", 123 "src/ptrace/_UPT_put_unwind_info.c", 124 "src/ptrace/_UPT_reg_offset.c", 125 "src/ptrace/_UPT_resume.c", 126 ":internal_headers", 127 ":sources_common", 128 ":sources_ptrace", 129 ], 130 hdrs = [ 131 "include/config.h", 132 "include/libunwind.h", 133 "include/libunwind-ptrace.h", 134 ], 135 copts = LIBUNWIND_COPTS + [ 136 # Assume our inferior doesn't have frame pointers, regardless of 137 # whether we ourselves do or not. 138 "-DNO_FRAME_POINTER", 139 "-fno-common", 140 "-Wno-cpp", # Warning in src/ptrace/_UPT_get_dyn_info_list_addr.c 141 ], 142 visibility = ["//visibility:public"], 143 deps = [ 144 ":included_sources", 145 ], 146) 147