1set(CMAKE_INCLUDE_CURRENT_DIR ON) 2 3# other source files 4include_directories(../include/tdep) 5include_directories(../include) 6include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include/tdep) 7include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include) 8 9if(TARGET_ARM) 10 # Ensure that the remote and local unwind code can reside in the same binary without name clashing 11 add_definitions("-Darm_search_unwind_table=UNW_OBJ(arm_search_unwind_table)") 12 # We compile code with -std=c99 and the asm keyword is not recognized as it is a gnu extension 13 add_definitions(-Dasm=__asm__) 14 # The arm sources include ex_tables.h from include/tdep-arm without going through a redirection 15 # in include/tdep like it works for similar files on other architectures. So we need to add 16 # the include/tdep-arm to include directories 17 include_directories(../include/tdep-arm) 18elseif(TARGET_AARCH64) 19 # We compile code with -std=c99 and the asm keyword is not recognized as it is a gnu extension 20 add_definitions(-Dasm=__asm__) 21endif() 22 23SET(libunwind_ptrace_la_SOURCES 24 ptrace/_UPT_elf.c 25 ptrace/_UPT_accessors.c ptrace/_UPT_access_fpreg.c 26 ptrace/_UPT_access_mem.c ptrace/_UPT_access_reg.c 27 ptrace/_UPT_create.c ptrace/_UPT_destroy.c 28 ptrace/_UPT_find_proc_info.c ptrace/_UPT_get_dyn_info_list_addr.c 29 ptrace/_UPT_put_unwind_info.c ptrace/_UPT_get_proc_name.c 30 ptrace/_UPT_reg_offset.c ptrace/_UPT_resume.c 31) 32 33SET(libunwind_coredump_la_SOURCES 34 coredump/_UCD_accessors.c 35 coredump/_UCD_create.c 36 coredump/_UCD_destroy.c 37 coredump/_UCD_access_mem.c 38 coredump/_UCD_elf_map_image.c 39 coredump/_UCD_find_proc_info.c 40 coredump/_UCD_get_proc_name.c 41 42 coredump/_UPT_elf.c 43 coredump/_UPT_access_fpreg.c 44 coredump/_UPT_get_dyn_info_list_addr.c 45 coredump/_UPT_put_unwind_info.c 46 coredump/_UPT_resume.c 47) 48 49# List of arch-independent files needed by generic library (libunwind-$ARCH): 50SET(libunwind_la_SOURCES_generic 51 mi/Gdyn-extract.c mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c 52 # The Gget_accessors.c implements the same function as Lget_accessors.c, so 53 # the source is excluded here to prevent name clash 54 #mi/Gget_accessors.c 55 mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c 56 mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c 57 mi/Gget_reg.c mi/Gset_reg.c 58 mi/Gget_fpreg.c mi/Gset_fpreg.c 59 mi/Gset_caching_policy.c 60 mi/Gset_cache_size.c 61) 62 63SET(libunwind_la_SOURCES_os_linux 64 os-linux.c 65) 66 67SET(libunwind_la_SOURCES_os_linux_local 68# Nothing when we don't want to support CXX exceptions 69) 70 71SET(libunwind_la_SOURCES_os_freebsd 72 os-freebsd.c 73) 74 75SET(libunwind_la_SOURCES_os_freebsd_local 76# Nothing 77) 78 79SET(libunwind_la_SOURCES_os_solaris 80 os-solaris.c 81) 82 83SET(libunwind_la_SOURCES_os_solaris_local 84# Nothing 85) 86 87if(UNW_CMAKE_TARGET_LINUX) 88 SET(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_linux}) 89 SET(libunwind_la_SOURCES_os_local ${libunwind_la_SOURCES_os_linux_local}) 90 SET(libunwind_la_SOURCES_x86_os x86/Gos-linux.c) 91 SET(libunwind_x86_la_SOURCES_os x86/getcontext-linux.S) 92 SET(libunwind_la_SOURCES_x86_os_local x86/Los-linux.c) 93 SET(libunwind_la_SOURCES_x86_64_os x86_64/Gos-linux.c) 94 SET(libunwind_la_SOURCES_x86_64_os_local x86_64/Los-linux.c) 95 SET(libunwind_la_SOURCES_arm_os arm/Gos-linux.c) 96 SET(libunwind_la_SOURCES_arm_os_local arm/Los-linux.c) 97 list(APPEND libunwind_coredump_la_SOURCES coredump/_UCD_access_reg_linux.c 98 coredump/_UCD_get_threadinfo_prstatus.c 99 coredump/_UCD_get_mapinfo_linux.c) 100elseif(UNW_CMAKE_TARGET_FREEBSD) 101 SET(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_freebsd}) 102 SET(libunwind_la_SOURCES_os_local ${libunwind_la_SOURCES_os_freebsd_local}) 103 SET(libunwind_la_SOURCES_x86_os x86/Gos-freebsd.c) 104 SET(libunwind_x86_la_SOURCES_os x86/getcontext-freebsd.S) 105 SET(libunwind_la_SOURCES_x86_os_local x86/Los-freebsd.c) 106 SET(libunwind_la_SOURCES_x86_64_os x86_64/Gos-freebsd.c) 107 SET(libunwind_la_SOURCES_x86_64_os_local x86_64/Los-freebsd.c) 108 SET(libunwind_la_SOURCES_arm_os arm/Gos-freebsd.c) 109 SET(libunwind_la_SOURCES_arm_os_local arm/Los-freebsd.c) 110 list(APPEND libunwind_coredump_la_SOURCES coredump/_UCD_access_reg_freebsd.c 111 coredump/_UCD_get_threadinfo_prstatus.c 112 coredump/_UCD_get_mapinfo_generic.c) 113elseif(UNW_CMAKE_HOST_SUNOS) 114 SET(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_solaris}) 115 SET(libunwind_la_SOURCES_os_local ${libunwind_la_SOURCES_os_solaris_local}) 116 SET(libunwind_la_SOURCES_x86_64_os x86_64/Gos-solaris.c) 117 SET(libunwind_la_SOURCES_x86_64_os_local x86_64/Los-solaris.c) 118endif() 119 120# List of arch-independent files needed by both local-only and generic 121# libraries: 122SET(libunwind_la_SOURCES_common 123 ${libunwind_la_SOURCES_os} 124 mi/init.c mi/flush_cache.c mi/mempool.c mi/strerror.c 125) 126 127SET(libunwind_la_SOURCES_local_unwind 128# Nothing when we don't want to support CXX exceptions 129) 130 131# List of arch-independent files needed by local-only library (libunwind): 132SET(libunwind_la_SOURCES_local_nounwind 133 ${libunwind_la_SOURCES_os_local} 134 mi/backtrace.c 135 mi/dyn-cancel.c mi/dyn-info-list.c mi/dyn-register.c 136 mi/Ldyn-extract.c mi/Lfind_dynamic_proc_info.c 137 mi/Lget_accessors.c 138 mi/Lget_proc_info_by_ip.c mi/Lget_proc_name.c 139 mi/Lput_dynamic_unwind_info.c mi/Ldestroy_addr_space.c 140 mi/Lget_reg.c mi/Lset_reg.c 141 mi/Lget_fpreg.c mi/Lset_fpreg.c 142 mi/Lset_caching_policy.c 143 mi/Lset_cache_size.c 144) 145 146SET(libunwind_la_SOURCES_local 147 ${libunwind_la_SOURCES_local_nounwind} 148 ${libunwind_la_SOURCES_local_unwind} 149) 150 151SET(libunwind_dwarf_common_la_SOURCES 152 dwarf/global.c 153) 154 155SET(libunwind_dwarf_local_la_SOURCES 156 dwarf/Lexpr.c dwarf/Lfde.c dwarf/Lparser.c dwarf/Lpe.c 157 dwarf/Lfind_proc_info-lsb.c 158 dwarf/Lfind_unwind_table.c 159) 160 161SET(libunwind_dwarf_generic_la_SOURCES 162 dwarf/Gexpr.c dwarf/Gfde.c dwarf/Gparser.c dwarf/Gpe.c 163 dwarf/Gfind_proc_info-lsb.c 164 dwarf/Gfind_unwind_table.c 165) 166 167SET(libunwind_elf32_la_SOURCES 168 elf32.c 169) 170 171SET(libunwind_elf64_la_SOURCES 172 elf64.c 173) 174SET(libunwind_elfxx_la_SOURCES 175 elfxx.c 176) 177 178# The list of files that go into libunwind and libunwind-aarch64: 179SET(libunwind_la_SOURCES_aarch64_common 180 ${libunwind_la_SOURCES_common} 181 aarch64/is_fpreg.c 182 aarch64/regname.c 183) 184 185# The list of files that go into libunwind: 186SET(libunwind_la_SOURCES_aarch64 187 ${libunwind_la_SOURCES_aarch64_common} 188 ${libunwind_la_SOURCES_local} 189 aarch64/Lapply_reg_state.c aarch64/Lreg_states_iterate.c 190 aarch64/Lcreate_addr_space.c aarch64/Lget_proc_info.c 191 aarch64/Lget_save_loc.c aarch64/Lglobal.c aarch64/Linit.c 192 aarch64/Linit_local.c aarch64/Linit_remote.c 193 aarch64/Lis_signal_frame.c aarch64/Lregs.c aarch64/Lresume.c 194 aarch64/Lstash_frame.c aarch64/Lstep.c aarch64/Ltrace.c 195 aarch64/getcontext.S 196) 197 198SET(libunwind_aarch64_la_SOURCES_aarch64 199 ${libunwind_la_SOURCES_aarch64_common} 200 ${libunwind_la_SOURCES_generic} 201 aarch64/Gapply_reg_state.c aarch64/Greg_states_iterate.c 202 aarch64/Gcreate_addr_space.c aarch64/Gget_proc_info.c 203 aarch64/Gget_save_loc.c aarch64/Gglobal.c aarch64/Ginit.c 204 aarch64/Ginit_local.c aarch64/Ginit_remote.c 205 aarch64/Gis_signal_frame.c aarch64/Gregs.c aarch64/Gresume.c 206 aarch64/Gstash_frame.c aarch64/Gstep.c aarch64/Gtrace.c 207) 208 209# The list of files that go into libunwind and libunwind-arm: 210SET(libunwind_la_SOURCES_arm_common 211 ${libunwind_la_SOURCES_common} 212 arm/is_fpreg.c arm/regname.c 213) 214 215# The list of files that go into libunwind: 216SET(libunwind_la_SOURCES_arm 217 ${libunwind_la_SOURCES_arm_common} 218 ${libunwind_la_SOURCES_arm_os_local} 219 ${libunwind_la_SOURCES_local} 220 arm/getcontext.S 221 arm/Lapply_reg_state.c arm/Lreg_states_iterate.c 222 arm/Lcreate_addr_space.c arm/Lget_proc_info.c arm/Lget_save_loc.c 223 arm/Lglobal.c arm/Linit.c arm/Linit_local.c arm/Linit_remote.c 224 arm/Lregs.c arm/Lresume.c arm/Lstep.c 225 arm/Lex_tables.c arm/Lstash_frame.c arm/Ltrace.c 226) 227 228# The list of files that go into libunwind-arm: 229SET(libunwind_arm_la_SOURCES_arm 230 ${libunwind_la_SOURCES_arm_common} 231 ${libunwind_la_SOURCES_arm_os} 232 ${libunwind_la_SOURCES_generic} 233 arm/Gapply_reg_state.c arm/Greg_states_iterate.c 234 arm/Gcreate_addr_space.c arm/Gget_proc_info.c arm/Gget_save_loc.c 235 arm/Gglobal.c arm/Ginit.c arm/Ginit_local.c arm/Ginit_remote.c 236 arm/Gregs.c arm/Gresume.c arm/Gstep.c 237 arm/Gex_tables.c arm/Gstash_frame.c arm/Gtrace.c 238) 239 240# The list of files that go both into libunwind and libunwind-x86_64: 241SET(libunwind_la_SOURCES_x86_64_common 242 ${libunwind_la_SOURCES_common} 243 x86_64/is_fpreg.c x86_64/regname.c 244) 245 246# The list of files that go into libunwind: 247SET(libunwind_la_SOURCES_x86_64 248 ${libunwind_la_SOURCES_x86_64_common} 249 ${libunwind_la_SOURCES_x86_64_os_local} 250 ${libunwind_la_SOURCES_local} 251 x86_64/setcontext.S 252 x86_64/Lapply_reg_state.c x86_64/Lreg_states_iterate.c 253 x86_64/Lcreate_addr_space.c x86_64/Lget_save_loc.c x86_64/Lglobal.c 254 x86_64/Linit.c x86_64/Linit_local.c x86_64/Linit_remote.c 255 x86_64/Lget_proc_info.c x86_64/Lregs.c x86_64/Lresume.c 256 x86_64/Lstash_frame.c x86_64/Lstep.c x86_64/Ltrace.c x86_64/getcontext.S 257) 258 259# The list of files that go into libunwind-x86_64: 260SET(libunwind_x86_64_la_SOURCES_x86_64 261 ${libunwind_la_SOURCES_x86_64_common} 262 ${libunwind_la_SOURCES_x86_64_os} 263 ${libunwind_la_SOURCES_generic} 264 x86_64/Gapply_reg_state.c x86_64/Greg_states_iterate.c 265 x86_64/Gcreate_addr_space.c x86_64/Gget_save_loc.c x86_64/Gglobal.c 266 x86_64/Ginit.c x86_64/Ginit_local.c x86_64/Ginit_remote.c 267 x86_64/Gget_proc_info.c x86_64/Gregs.c x86_64/Gresume.c 268 x86_64/Gstash_frame.c x86_64/Gstep.c x86_64/Gtrace.c 269) 270 271# The list of files that go both into libunwind and libunwind-s390x: 272SET(libunwind_la_SOURCES_s390x_common 273 ${libunwind_la_SOURCES_common} 274 s390x/is_fpreg.c s390x/regname.c 275) 276 277# The list of files that go into libunwind: 278SET(libunwind_la_SOURCES_s390x 279 ${libunwind_la_SOURCES_s390x_common} 280 ${libunwind_la_SOURCES_local} 281 s390x/setcontext.S s390x/getcontext.S 282 s390x/Lapply_reg_state.c s390x/Lreg_states_iterate.c 283 s390x/Lcreate_addr_space.c s390x/Lget_save_loc.c s390x/Lglobal.c 284 s390x/Linit.c s390x/Linit_local.c s390x/Linit_remote.c 285 s390x/Lget_proc_info.c s390x/Lregs.c s390x/Lresume.c 286 s390x/Lis_signal_frame.c s390x/Lstep.c 287) 288 289# The list of files that go into libunwind-s390x: 290SET(libunwind_s390x_la_SOURCES_s390x 291 ${libunwind_la_SOURCES_s390x_common} 292 ${libunwind_la_SOURCES_generic} 293 s390x/Gapply_reg_state.c s390x/Greg_states_iterate.c 294 s390x/Gcreate_addr_space.c s390x/Gget_save_loc.c s390x/Gglobal.c 295 s390x/Ginit.c s390x/Ginit_local.c s390x/Ginit_remote.c 296 s390x/Gget_proc_info.c s390x/Gregs.c s390x/Gresume.c 297 s390x/Gis_signal_frame.c s390x/Gstep.c 298) 299 300if(TARGET_AARCH64) 301 SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_aarch64}) 302 SET(libunwind_remote_la_SOURCES ${libunwind_aarch64_la_SOURCES_aarch64}) 303 SET(libunwind_elf_la_SOURCES ${libunwind_elf64_la_SOURCES}) 304 list(APPEND libunwind_setjmp_la_SOURCES aarch64/siglongjmp.S) 305elseif(TARGET_ARM) 306 SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_arm}) 307 SET(libunwind_remote_la_SOURCES ${libunwind_arm_la_SOURCES_arm}) 308 SET(libunwind_elf_la_SOURCES ${libunwind_elf32_la_SOURCES}) 309 list(APPEND libunwind_setjmp_la_SOURCES arm/siglongjmp.S) 310elseif(TARGET_AMD64) 311 SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_x86_64}) 312 SET(libunwind_remote_la_SOURCES ${libunwind_x86_64_la_SOURCES_x86_64}) 313 SET(libunwind_elf_la_SOURCES ${libunwind_elf64_la_SOURCES}) 314 list(APPEND libunwind_setjmp_la_SOURCES x86_64/longjmp.S x86_64/siglongjmp.SA) 315elseif(TARGET_S390X) 316 SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_s390x}) 317 SET(libunwind_remote_la_SOURCES ${libunwind_s390x_la_SOURCES_s390x}) 318 SET(libunwind_elf_la_SOURCES ${libunwind_elf64_la_SOURCES}) 319endif() 320 321add_library(libunwind 322 OBJECT 323 win/pal-single-threaded.c 324 # ${libunwind_la_SOURCES} Local... 325 ${libunwind_remote_la_SOURCES} 326 # Commented out above for LOCAL + REMOTE runtime build 327 mi/Gget_accessors.c 328 # ${libunwind_dwarf_local_la_SOURCES} 329 ${libunwind_dwarf_common_la_SOURCES} 330 ${libunwind_dwarf_generic_la_SOURCES} 331 ${libunwind_elf_la_SOURCES} 332) 333