summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-03-12 04:27:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-12 05:00:44 +0000
commit6dd404e028547a29c21b047c2d91ed90ebb1edfb (patch)
treef9213eeb75ef30e5fd5d7d0d810bc5e096cb0a76 /src
parent2d3589491b2d0bb93d44219018a175d4a9ac0b76 (diff)
downloadmongo-6dd404e028547a29c21b047c2d91ed90ebb1edfb.tar.gz
SERVER-61856 SERVER-42470 update libunwind to 1.6.2
Diffstat (limited to 'src')
-rw-r--r--src/third_party/SConscript4
-rw-r--r--src/third_party/unwind/SConscript8
-rw-r--r--src/third_party/unwind/dist/ChangeLog52
-rw-r--r--src/third_party/unwind/dist/Makefile.am10
-rw-r--r--src/third_party/unwind/dist/Makefile.in17
-rw-r--r--src/third_party/unwind/dist/README10
-rw-r--r--src/third_party/unwind/dist/acinclude.m431
-rwxr-xr-xsrc/third_party/unwind/dist/configure187
-rw-r--r--src/third_party/unwind/dist/configure.ac59
-rw-r--r--src/third_party/unwind/dist/doc/unw_init_remote.man6
-rw-r--r--src/third_party/unwind/dist/include/compiler.h2
-rw-r--r--src/third_party/unwind/dist/include/config.h.in19
-rw-r--r--src/third_party/unwind/dist/include/dwarf-eh.h10
-rw-r--r--src/third_party/unwind/dist/include/dwarf.h11
-rw-r--r--src/third_party/unwind/dist/include/dwarf_i.h2
-rw-r--r--src/third_party/unwind/dist/include/libunwind-aarch64.h43
-rw-r--r--src/third_party/unwind/dist/include/libunwind-arm.h64
-rw-r--r--src/third_party/unwind/dist/include/libunwind-dynamic.h1
-rw-r--r--src/third_party/unwind/dist/include/libunwind-mips.h2
-rw-r--r--src/third_party/unwind/dist/include/libunwind-ppc64.h2
-rw-r--r--src/third_party/unwind/dist/include/libunwind-ptrace.h1
-rw-r--r--src/third_party/unwind/dist/include/libunwind-riscv.h187
-rw-r--r--src/third_party/unwind/dist/include/libunwind.h2
-rw-r--r--src/third_party/unwind/dist/include/libunwind.h.in2
-rw-r--r--src/third_party/unwind/dist/include/libunwind_i.h159
-rw-r--r--src/third_party/unwind/dist/include/remote.h6
-rw-r--r--src/third_party/unwind/dist/include/tdep-aarch64/libunwind_i.h33
-rw-r--r--src/third_party/unwind/dist/include/tdep-arm/libunwind_i.h24
-rw-r--r--src/third_party/unwind/dist/include/tdep-hppa/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-ia64/libunwind_i.h7
-rw-r--r--src/third_party/unwind/dist/include/tdep-ia64/script.h8
-rw-r--r--src/third_party/unwind/dist/include/tdep-mips/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-ppc32/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-ppc64/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-riscv/dwarf-config.h50
-rw-r--r--src/third_party/unwind/dist/include/tdep-riscv/jmpbuf.h49
-rw-r--r--src/third_party/unwind/dist/include/tdep-riscv/libunwind_i.h303
-rw-r--r--src/third_party/unwind/dist/include/tdep-s390x/libunwind_i.h23
-rw-r--r--src/third_party/unwind/dist/include/tdep-sh/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-tilegx/libunwind_i.h9
-rw-r--r--src/third_party/unwind/dist/include/tdep-x86/dwarf-config.h2
-rw-r--r--src/third_party/unwind/dist/include/tdep-x86/libunwind_i.h82
-rw-r--r--src/third_party/unwind/dist/include/tdep-x86_64/libunwind_i.h61
-rw-r--r--src/third_party/unwind/dist/include/tdep/dwarf-config.h4
-rw-r--r--src/third_party/unwind/dist/include/tdep/jmpbuf.h2
-rw-r--r--src/third_party/unwind/dist/include/tdep/libunwind_i.h2
-rw-r--r--src/third_party/unwind/dist/include/tdep/libunwind_i.h.in2
-rw-r--r--src/third_party/unwind/dist/include/unwind.h5
-rw-r--r--src/third_party/unwind/dist/src/Makefile.am43
-rw-r--r--src/third_party/unwind/dist/src/Makefile.in860
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Gcreate_addr_space.c5
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Gglobal.c8
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Ginit.c247
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Ginit_local.c6
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Ginit_remote.c13
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Gresume.c2
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Gstep.c20
-rw-r--r--src/third_party/unwind/dist/src/aarch64/Gtrace.c4
-rw-r--r--src/third_party/unwind/dist/src/arm/Gcreate_addr_space.c5
-rw-r--r--src/third_party/unwind/dist/src/arm/Gex_tables.c26
-rw-r--r--src/third_party/unwind/dist/src/arm/Gglobal.c11
-rw-r--r--src/third_party/unwind/dist/src/arm/Ginit.c13
-rw-r--r--src/third_party/unwind/dist/src/arm/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/arm/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/arm/Gresume.c2
-rw-r--r--src/third_party/unwind/dist/src/arm/Gstep.c55
-rw-r--r--src/third_party/unwind/dist/src/arm/Gtrace.c4
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_access_reg_linux.c8
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_corefile_elf.c126
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_create.c183
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_elf_map_image.c6
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_find_proc_info.c8
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_generic.c34
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_linux.c134
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_get_proc_name.c4
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_get_threadinfo_prstatus.c121
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UCD_internal.h16
-rw-r--r--src/third_party/unwind/dist/src/coredump/_UPT_get_dyn_info_list_addr.c15
-rw-r--r--src/third_party/unwind/dist/src/dl-iterate-phdr.c95
-rw-r--r--src/third_party/unwind/dist/src/dwarf/Gexpr.c45
-rw-r--r--src/third_party/unwind/dist/src/dwarf/Gfde.c10
-rw-r--r--src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c85
-rw-r--r--src/third_party/unwind/dist/src/dwarf/Gfind_unwind_table.c1
-rw-r--r--src/third_party/unwind/dist/src/dwarf/Gparser.c23
-rw-r--r--src/third_party/unwind/dist/src/elf32.h4
-rw-r--r--src/third_party/unwind/dist/src/elf64.h4
-rw-r--r--src/third_party/unwind/dist/src/elfxx.c9
-rw-r--r--src/third_party/unwind/dist/src/elfxx.h4
-rw-r--r--src/third_party/unwind/dist/src/hppa/Gcreate_addr_space.c2
-rw-r--r--src/third_party/unwind/dist/src/hppa/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/hppa/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/hppa/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/hppa/Gresume.c6
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gcreate_addr_space.c8
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gglobal.c4
-rw-r--r--src/third_party/unwind/dist/src/ia64/Ginit.c8
-rw-r--r--src/third_party/unwind/dist/src/ia64/Ginit_local.c6
-rw-r--r--src/third_party/unwind/dist/src/ia64/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gregs.c2
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gresume.c6
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gscript.c44
-rw-r--r--src/third_party/unwind/dist/src/ia64/Gstep.c4
-rw-r--r--src/third_party/unwind/dist/src/ia64/dyn_info_list.S2
-rw-r--r--src/third_party/unwind/dist/src/ia64/mk_Gcursor_i.c65
-rw-r--r--src/third_party/unwind/dist/src/ia64/mk_Lcursor_i.c2
-rwxr-xr-xsrc/third_party/unwind/dist/src/ia64/mk_cursor_i7
-rw-r--r--src/third_party/unwind/dist/src/ia64/unwind_i.h2
-rw-r--r--src/third_party/unwind/dist/src/mi/Gget_accessors.c3
-rw-r--r--src/third_party/unwind/dist/src/mi/Gset_cache_size.c2
-rw-r--r--src/third_party/unwind/dist/src/mi/Gset_caching_policy.c2
-rw-r--r--src/third_party/unwind/dist/src/mi/flush_cache.c9
-rw-r--r--src/third_party/unwind/dist/src/mi/init.c28
-rw-r--r--src/third_party/unwind/dist/src/mi/mempool.c27
-rw-r--r--src/third_party/unwind/dist/src/mips/Gcreate_addr_space.c8
-rw-r--r--src/third_party/unwind/dist/src/mips/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/mips/Ginit.c2
-rw-r--r--src/third_party/unwind/dist/src/mips/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/mips/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/mips/Gstep.c7
-rw-r--r--src/third_party/unwind/dist/src/os-linux.c36
-rw-r--r--src/third_party/unwind/dist/src/os-linux.h23
-rw-r--r--src/third_party/unwind/dist/src/os-solaris.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc32/Gcreate_addr_space.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc32/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/ppc32/Gresume.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc32/unwind_i.h2
-rw-r--r--src/third_party/unwind/dist/src/ppc64/Gcreate_addr_space.c13
-rw-r--r--src/third_party/unwind/dist/src/ppc64/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/ppc64/Ginit.c18
-rw-r--r--src/third_party/unwind/dist/src/ppc64/Gresume.c2
-rw-r--r--src/third_party/unwind/dist/src/ppc64/Gstep.c11
-rw-r--r--src/third_party/unwind/dist/src/ppc64/ucontext_i.h279
-rw-r--r--src/third_party/unwind/dist/src/ppc64/unwind_i.h2
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_access_fpreg.c7
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c10
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_find_proc_info.c2
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_get_dyn_info_list_addr.c4
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_get_proc_name.c4
-rw-r--r--src/third_party/unwind/dist/src/ptrace/_UPT_reg_offset.c88
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gapply_reg_state.c36
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gcreate_addr_space.c54
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gget_proc_info.c45
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gget_save_loc.c97
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gglobal.c127
-rw-r--r--src/third_party/unwind/dist/src/riscv/Ginit.c442
-rw-r--r--src/third_party/unwind/dist/src/riscv/Ginit_local.c81
-rw-r--r--src/third_party/unwind/dist/src/riscv/Ginit_remote.c55
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gis_signal_frame.c79
-rw-r--r--src/third_party/unwind/dist/src/riscv/Greg_states_iterate.c36
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gregs.c95
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gresume.c122
-rw-r--r--src/third_party/unwind/dist/src/riscv/Gstep.c130
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lapply_reg_state.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lcreate_addr_space.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lget_proc_info.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lget_save_loc.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lglobal.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Linit.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Linit_local.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Linit_remote.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lis_signal_frame.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lreg_states_iterate.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lregs.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lresume.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/Lstep.c5
-rw-r--r--src/third_party/unwind/dist/src/riscv/asm.h46
-rw-r--r--src/third_party/unwind/dist/src/riscv/getcontext.S87
-rw-r--r--src/third_party/unwind/dist/src/riscv/init.h65
-rw-r--r--src/third_party/unwind/dist/src/riscv/is_fpreg.c31
-rw-r--r--src/third_party/unwind/dist/src/riscv/offsets.h13
-rw-r--r--src/third_party/unwind/dist/src/riscv/regname.c59
-rw-r--r--src/third_party/unwind/dist/src/riscv/setcontext.S87
-rw-r--r--src/third_party/unwind/dist/src/riscv/siglongjmp.S7
-rw-r--r--src/third_party/unwind/dist/src/riscv/unwind_i.h46
-rw-r--r--src/third_party/unwind/dist/src/s390x/Gcreate_addr_space.c6
-rw-r--r--src/third_party/unwind/dist/src/s390x/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/s390x/Ginit.c25
-rw-r--r--src/third_party/unwind/dist/src/s390x/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/s390x/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/s390x/Gresume.c4
-rw-r--r--src/third_party/unwind/dist/src/sh/Gcreate_addr_space.c5
-rw-r--r--src/third_party/unwind/dist/src/sh/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/sh/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/sh/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/tilegx/Gcreate_addr_space.c21
-rw-r--r--src/third_party/unwind/dist/src/tilegx/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/tilegx/Ginit.c2
-rw-r--r--src/third_party/unwind/dist/src/tilegx/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/tilegx/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/x86/Gglobal.c6
-rw-r--r--src/third_party/unwind/dist/src/x86/Ginit.c13
-rw-r--r--src/third_party/unwind/dist/src/x86/Ginit_local.c2
-rw-r--r--src/third_party/unwind/dist/src/x86/Ginit_remote.c2
-rw-r--r--src/third_party/unwind/dist/src/x86/Gos-freebsd.c1
-rw-r--r--src/third_party/unwind/dist/src/x86/Gos-linux.c4
-rw-r--r--src/third_party/unwind/dist/src/x86/Gregs.c2
-rw-r--r--src/third_party/unwind/dist/src/x86/Gstep.c4
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gglobal.c13
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Ginit.c76
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Ginit_local.c7
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Ginit_remote.c7
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gos-freebsd.c37
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gos-linux.c5
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gregs.c2
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gresume.c3
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gstep.c18
-rw-r--r--src/third_party/unwind/dist/src/x86_64/Gtrace.c39
-rw-r--r--src/third_party/unwind/dist/src/x86_64/init.h6
-rw-r--r--src/third_party/unwind/dist/src/x86_64/unwind_i.h2
-rw-r--r--src/third_party/unwind/dist/tests/Gia64-test-nat.c4
-rw-r--r--src/third_party/unwind/dist/tests/Gtest-exc.c22
-rw-r--r--src/third_party/unwind/dist/tests/Ltest-mem-validate.c22
-rw-r--r--src/third_party/unwind/dist/tests/Makefile.am6
-rw-r--r--src/third_party/unwind/dist/tests/Makefile.in12
-rw-r--r--src/third_party/unwind/dist/tests/check-namespace.sh.in15
-rw-r--r--src/third_party/unwind/dist/tests/test-coredump-unwind.c15
-rw-r--r--src/third_party/unwind/dist/tests/test-ptrace.c6
-rw-r--r--src/third_party/unwind/dist/tests/test-setjmp.c4
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/build/include/config.h27
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/build/include/libunwind-common.h4
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/build/include/libunwind.h2
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/build/include/stamp-h11
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/build/include/tdep/libunwind_i.h2
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-aarch64.h43
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-common.h4
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-dynamic.h1
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/install/include/libunwind.h2
-rw-r--r--src/third_party/unwind/platform/linux_aarch64/install/include/unwind.h5
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/build/include/config.h27
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/build/include/libunwind-common.h4
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/build/include/libunwind.h2
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/build/include/stamp-h11
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/build/include/tdep/libunwind_i.h2
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-common.h4
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-dynamic.h1
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/install/include/libunwind.h2
-rw-r--r--src/third_party/unwind/platform/linux_x86_64/install/include/unwind.h5
-rwxr-xr-xsrc/third_party/unwind/scripts/host_config.sh1
-rwxr-xr-xsrc/third_party/unwind/scripts/import.sh6
241 files changed, 5544 insertions, 1627 deletions
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
index 1a663077ffa..c8b4716b124 100644
--- a/src/third_party/SConscript
+++ b/src/third_party/SConscript
@@ -196,11 +196,11 @@ if not use_system_version_of_library('kms-message'):
if use_system_libunwind:
thirdPartyEnvironmentModifications['unwind'] = {
- 'SYSLIBDEPS_PRIVATE' : [env['LIBDEPS_UNWIND_SYSLIBDEP'], 'lzma'],
+ 'SYSLIBDEPS_PRIVATE' : [env['LIBDEPS_UNWIND_SYSLIBDEP'], env['LIBDEPS_LZMA_SYSLIBDEP']],
}
elif use_vendored_libunwind:
thirdPartyEnvironmentModifications['unwind'] = {
- 'SYSLIBDEPS_PRIVATE' : ['lzma'],
+ 'SYSLIBDEPS_PRIVATE' : [env['LIBDEPS_LZMA_SYSLIBDEP']],
}
def injectThirdParty(thisEnv, libraries=[], parts=[]):
diff --git a/src/third_party/unwind/SConscript b/src/third_party/unwind/SConscript
index ba49060607e..1554698232a 100644
--- a/src/third_party/unwind/SConscript
+++ b/src/third_party/unwind/SConscript
@@ -100,7 +100,9 @@ env.Append(
CCFLAGS=[
'-fexceptions',
'-Wno-unused-result',
- '-Wno-pointer-sign'
+ '-Wno-pointer-sign',
+ '-Wno-incompatible-pointer-types',
+ '-Wno-unused-variable',
])
if env.ToolchainIs('clang'):
@@ -117,10 +119,10 @@ env.Append(
# propagates to consumers that Inject (depend on) unwind.
env.RegisterConsumerModifications(
CPPPATH=[unwind_platform.Dir("install/include")],
- SYSLIBDEPS_PRIVATE=['lzma'])
+ SYSLIBDEPS_PRIVATE=[env['LIBDEPS_LZMA_SYSLIBDEP']])
env.Append(
- SYSLIBDEPS_PRIVATE=['lzma'])
+ SYSLIBDEPS_PRIVATE=[env['LIBDEPS_LZMA_SYSLIBDEP']])
env.Append(
CPPDEFINES=[
diff --git a/src/third_party/unwind/dist/ChangeLog b/src/third_party/unwind/dist/ChangeLog
index dfa24b957cb..8713adc8ef0 100644
--- a/src/third_party/unwind/dist/ChangeLog
+++ b/src/third_party/unwind/dist/ChangeLog
@@ -1,55 +1,7 @@
***********************************************************
- Discontinued. See git log instead at
+Discontinued. See git log instead at
- http://www.kernel.org/git/gitweb.cgi?p=libs/libunwind/libunwind.git;a=log
+ https://github.com/libunwind/libunwind/commits/master
***********************************************************
-
-2002-11-08 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * src/ia64/unwind_i.h (ia64_getfp): Change from macro to inline
- function. Check "loc" argument for being NULL before dereferencing it.
- (ia64_putfp): Ditto.
- (ia64_get): Ditto.
- (ia64_put): Ditto.
-
-2002-01-18 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * src/ia64/parser.c (__ia64_unw_create_state_record): Set
- IA64_FLAG_HAS_HANDLER if the unwind info descriptors indicate that
- there a handler.
-
- * src/ia64/regs.c (__ia64_access_reg): Return zero for UNW_REG_HANDLER
- in frames that don't have a personality routine.
-
- * src/ia64/unwind_i.h (IA64_FLAG_HAS_HANDLER): New flag.
-
- * src/ia64/regs.c (__ia64_access_reg): When reading UNW_REG_HANDLER,
- account for the fact that the personality address is gp-relative.
-
- * src/ia64/parser.c (__ia64_unw_create_state_record): Fix
- initialization of segbase and len.
-
-2002-01-17 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * include/unwind-ia64.h: Include via "unwind.h" to ensure
- the file is picked up from same directory.
-
-2002-01-16 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * include/unwind.h: Define UNW_ESTOPUNWIND. This error code may
- be returned by acquire_unwind_info() to force termination of
- unwinding. An application may want to do this when encountering a
- call frame for dynamically generated code, for example.
-
- * unwind.h: Pass opaque argument pointer to acquire_unwind_info()
- and release_unwind_info() like we do for access_mem() etc.
-
-2002-01-14 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * Version 0.0 released.
-
-2002-01-11 David Mosberger-Tang <David.Mosberger@acm.org>
-
- * ChangeLog created.
diff --git a/src/third_party/unwind/dist/Makefile.am b/src/third_party/unwind/dist/Makefile.am
index 8132fa4cb95..9bb2413dc98 100644
--- a/src/third_party/unwind/dist/Makefile.am
+++ b/src/third_party/unwind/dist/Makefile.am
@@ -44,9 +44,15 @@ endif
if ARCH_S390X
include_HEADERS += include/libunwind-s390x.h
endif
+if ARCH_RISCV
+include_HEADERS += include/libunwind-riscv.h
+endif
if !REMOTE_ONLY
-include_HEADERS += include/libunwind.h include/unwind.h
+include_HEADERS += include/libunwind.h
+if BUILD_UNWIND_HEADER
+include_HEADERS += include/unwind.h
+endif
endif
nodist_include_HEADERS = include/libunwind-common.h
@@ -89,6 +95,8 @@ noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
include/tdep-sh/jmpbuf.h include/tdep-sh/libunwind_i.h \
include/tdep-s390x/dwarf-config.h \
include/tdep-s390x/jmpbuf.h include/tdep-s390x/libunwind_i.h \
+ include/tdep-riscv/dwarf-config.h \
+ include/tdep-riscv/jmpbuf.h include/tdep-riscv/libunwind_i.h \
include/tdep/libunwind_i.h \
include/tdep/jmpbuf.h include/tdep/dwarf-config.h
diff --git a/src/third_party/unwind/dist/Makefile.in b/src/third_party/unwind/dist/Makefile.in
index e999c0cbd08..50ac2756206 100644
--- a/src/third_party/unwind/dist/Makefile.in
+++ b/src/third_party/unwind/dist/Makefile.in
@@ -103,9 +103,11 @@ target_triplet = @target@
@ARCH_PPC64_TRUE@am__append_12 = include/libunwind-ppc64.h
@ARCH_SH_TRUE@am__append_13 = include/libunwind-sh.h
@ARCH_S390X_TRUE@am__append_14 = include/libunwind-s390x.h
-@REMOTE_ONLY_FALSE@am__append_15 = include/libunwind.h include/unwind.h
-@CONFIG_TESTS_TRUE@am__append_16 = tests
-@CONFIG_DOCS_TRUE@am__append_17 = doc
+@ARCH_RISCV_TRUE@am__append_15 = include/libunwind-riscv.h
+@REMOTE_ONLY_FALSE@am__append_16 = include/libunwind.h
+@BUILD_UNWIND_HEADER_TRUE@@REMOTE_ONLY_FALSE@am__append_17 = include/unwind.h
+@CONFIG_TESTS_TRUE@am__append_18 = tests
+@CONFIG_DOCS_TRUE@am__append_19 = doc
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -159,7 +161,7 @@ am__include_HEADERS_DIST = include/libunwind-dynamic.h \
include/libunwind-x86.h include/libunwind-x86_64.h \
include/libunwind-ppc32.h include/libunwind-ppc64.h \
include/libunwind-sh.h include/libunwind-s390x.h \
- include/libunwind.h include/unwind.h
+ include/libunwind-riscv.h include/libunwind.h include/unwind.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -427,9 +429,10 @@ include_HEADERS = include/libunwind-dynamic.h $(am__append_1) \
$(am__append_5) $(am__append_6) $(am__append_7) \
$(am__append_8) $(am__append_9) $(am__append_10) \
$(am__append_11) $(am__append_12) $(am__append_13) \
- $(am__append_14) $(am__append_15)
+ $(am__append_14) $(am__append_15) $(am__append_16) \
+ $(am__append_17)
nodist_include_HEADERS = include/libunwind-common.h
-SUBDIRS = src $(am__append_16) $(am__append_17)
+SUBDIRS = src $(am__append_18) $(am__append_19)
noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
include/compiler.h include/libunwind_i.h include/mempool.h \
include/remote.h \
@@ -458,6 +461,8 @@ noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
include/tdep-sh/jmpbuf.h include/tdep-sh/libunwind_i.h \
include/tdep-s390x/dwarf-config.h \
include/tdep-s390x/jmpbuf.h include/tdep-s390x/libunwind_i.h \
+ include/tdep-riscv/dwarf-config.h \
+ include/tdep-riscv/jmpbuf.h include/tdep-riscv/libunwind_i.h \
include/tdep/libunwind_i.h \
include/tdep/jmpbuf.h include/tdep/dwarf-config.h
diff --git a/src/third_party/unwind/dist/README b/src/third_party/unwind/dist/README
index b6d93ae4a68..9427144c826 100644
--- a/src/third_party/unwind/dist/README
+++ b/src/third_party/unwind/dist/README
@@ -2,8 +2,7 @@
[![Build Status](https://travis-ci.org/libunwind/libunwind.svg?branch=master)](https://travis-ci.org/libunwind/libunwind)
-This is version 1.5 of the unwind library. This library supports
-several architecture/operating-system combinations:
+This library supports several architecture/operating-system combinations:
| System | Architecture | Status |
| :------ | :----------- | :----- |
@@ -11,12 +10,14 @@ several architecture/operating-system combinations:
| Linux | x86 | ✓ |
| Linux | ARM | ✓ |
| Linux | AArch64 | ✓ |
+| Linux | PPC32 | ✓ |
| Linux | PPC64 | ✓ |
| Linux | SuperH | ✓ |
| Linux | IA-64 | ✓ |
| Linux | PARISC | Works well, but C library missing unwind-info |
| Linux | Tilegx | 64-bit mode only |
| Linux | MIPS | Newly added |
+| Linux | RISC-V | 64-bit only |
| HP-UX | IA-64 | Mostly works, but known to have serious limitations |
| FreeBSD | x86-64 | ✓ |
| FreeBSD | x86 | ✓ |
@@ -34,7 +35,7 @@ such dependencies
- p, provides its own implementation
- empty, no requirement
-| Archtecture | getcontext | setcontext |
+| Architecture | getcontext | setcontext |
|--------------|------------|------------|
| aarch64 | p | |
| arm | p | |
@@ -43,6 +44,7 @@ such dependencies
| mips | p | |
| ppc32 | r | |
| ppc64 | r | r |
+| riscv | p | p |
| s390x | p | p |
| sh | r | |
| tilegx | r | r |
@@ -54,7 +56,7 @@ such dependencies
In general, this library can be built and installed with the following
commands:
- $ ./autogen.sh # Needed only for building from git. Depends on libtool.
+ $ autoreconf -i # Needed only for building from git. Depends on libtool.
$ ./configure
$ make
$ make install prefix=PREFIX
diff --git a/src/third_party/unwind/dist/acinclude.m4 b/src/third_party/unwind/dist/acinclude.m4
index 497f7c2f215..8b137891791 100644
--- a/src/third_party/unwind/dist/acinclude.m4
+++ b/src/third_party/unwind/dist/acinclude.m4
@@ -1,32 +1 @@
-AC_DEFUN([LIBUNWIND___THREAD],
-[dnl Check whether the compiler supports the __thread keyword.
-if test "x$enable___thread" != xno; then
- AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
- [cat > conftest.c <<\EOF
- __thread int a = 42;
-EOF
- if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
- libc_cv_gcc___thread=yes
- else
- libc_cv_gcc___thread=no
- fi
- rm -f conftest*])
- if test "$libc_cv_gcc___thread" = yes; then
- AC_DEFINE(HAVE___THREAD, 1,
- [Define to 1 if __thread keyword is supported by the C compiler.])
- fi
-else
- libc_cv_gcc___thread=no
-fi])
-AC_DEFUN([CHECK_ATOMIC_OPS],
-[dnl Check whether the system has the atomic_ops package installed.
- AC_CHECK_HEADERS(atomic_ops.h)
-#
-# Don't link against libatomic_ops for now. We don't want libunwind
-# to depend on libatomic_ops.so. Fortunately, none of the platforms
-# we care about so far need libatomic_ops.a (everything is done via
-# inline macros).
-#
-# AC_CHECK_LIB(atomic_ops, main)
-])
diff --git a/src/third_party/unwind/dist/configure b/src/third_party/unwind/dist/configure
index 4e61bf4beb8..dd3c573db7e 100755
--- a/src/third_party/unwind/dist/configure
+++ b/src/third_party/unwind/dist/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libunwind 1.5.0.
+# Generated by GNU Autoconf 2.69 for libunwind 1.6.2.
#
# Report bugs to <libunwind-devel@nongnu.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libunwind'
PACKAGE_TARNAME='libunwind'
-PACKAGE_VERSION='1.5.0'
-PACKAGE_STRING='libunwind 1.5.0'
+PACKAGE_VERSION='1.6.2'
+PACKAGE_STRING='libunwind 1.6.2'
PACKAGE_BUGREPORT='libunwind-devel@nongnu.org'
PACKAGE_URL=''
@@ -683,6 +683,8 @@ OS_HPUX_FALSE
OS_HPUX_TRUE
OS_LINUX_FALSE
OS_LINUX_TRUE
+ARCH_RISCV_FALSE
+ARCH_RISCV_TRUE
ARCH_S390X_FALSE
ARCH_S390X_TRUE
ARCH_TILEGX_FALSE
@@ -711,6 +713,8 @@ REMOTE_ONLY_FALSE
REMOTE_ONLY_TRUE
NO_PTRACE_TEST_FALSE
NO_PTRACE_TEST_TRUE
+BUILD_UNWIND_HEADER_FALSE
+BUILD_UNWIND_HEADER_TRUE
BUILD_SETJMP_FALSE
BUILD_SETJMP_TRUE
BUILD_PTRACE_FALSE
@@ -872,6 +876,7 @@ enable_setjmp
enable_documentation
enable_tests
enable_weak_backtrace
+enable_unwind_header
enable_debug
enable_cxx_exceptions
enable_debug_frame
@@ -1448,7 +1453,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libunwind 1.5.0 to adapt to many kinds of systems.
+\`configure' configures libunwind 1.6.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1520,7 +1525,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libunwind 1.5.0:";;
+ short | recursive ) echo "Configuration of libunwind 1.6.2:";;
esac
cat <<\_ACEOF
@@ -1549,6 +1554,7 @@ Optional Features:
--disable-tests Disable tests build
--disable-weak-backtrace
Do not provide the weak 'backtrace' symbol.
+ --disable-unwind-header Do not export the 'unwind.h' header
--enable-debug turn on debug support (slows down execution)
--enable-cxx-exceptions use libunwind to handle C++ exceptions
--enable-debug-frame Load the ".debug_frame" section if available
@@ -1658,7 +1664,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libunwind configure 1.5.0
+libunwind configure 1.6.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2488,7 +2494,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libunwind $as_me 1.5.0, which was
+It was created by libunwind $as_me 1.6.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3462,7 +3468,7 @@ fi
# Define the identity of the package.
PACKAGE='libunwind'
- VERSION='1.5.0'
+ VERSION='1.6.2'
cat >>confdefs.h <<_ACEOF
@@ -16791,27 +16797,6 @@ case "$ac_cv_search_dlopen" in
*) DLLIB="";;
esac
- for ac_header in atomic_ops.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "atomic_ops.h" "ac_cv_header_atomic_ops_h" "$ac_includes_default"
-if test "x$ac_cv_header_atomic_ops_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_ATOMIC_OPS_H 1
-_ACEOF
-
-fi
-
-done
-
-#
-# Don't link against libatomic_ops for now. We don't want libunwind
-# to depend on libatomic_ops.so. Fortunately, none of the platforms
-# we care about so far need libatomic_ops.a (everything is done via
-# inline macros).
-#
-# AC_CHECK_LIB(atomic_ops, main)
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
@@ -16924,9 +16909,10 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
-for ac_header in asm/ptrace_offsets.h endian.h sys/endian.h execinfo.h \
- ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
- sys/procfs.h sys/ptrace.h byteswap.h elf.h sys/elf.h link.h sys/link.h
+for ac_header in asm/ptrace_offsets.h asm/ptrace.h endian.h sys/endian.h sys/param.h \
+ execinfo.h ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
+ sys/procfs.h sys/ptrace.h sys/syscall.h byteswap.h elf.h sys/elf.h \
+ link.h sys/link.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -17454,6 +17440,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
build_arch=x86_64 ;; #(
tile*) :
build_arch=tilegx ;; #(
+ riscv*) :
+ build_arch=riscv ;; #(
*) :
build_arch=$build_cpu ;;
esac
@@ -17478,6 +17466,8 @@ esac
host_arch=x86_64 ;; #(
tile*) :
host_arch=tilegx ;; #(
+ riscv*) :
+ host_arch=riscv ;; #(
*) :
host_arch=$host_cpu ;;
esac
@@ -17502,6 +17492,8 @@ esac
target_arch=x86_64 ;; #(
tile*) :
target_arch=tilegx ;; #(
+ riscv*) :
+ target_arch=riscv ;; #(
*) :
target_arch=$target_cpu ;;
esac
@@ -17528,7 +17520,7 @@ if test "${enable_coredump+set}" = set; then :
enableval=$enable_coredump;
else
case $host_arch in #(
- aarch64*|arm*|mips*|sh*|x86*|tile*) :
+ aarch64*|arm*|mips*|sh*|x86*|tile*|riscv*) :
enable_coredump=yes ;; #(
*) :
enable_coredump=no ;;
@@ -17567,7 +17559,7 @@ $as_echo "$enable_ptrace" >&6; }
if test "${enable_setjmp+set}" = set; then :
enableval=$enable_setjmp;
else
- if test x$target_arch == x$host_arch; then :
+ if test x$target_arch = x$host_arch; then :
enable_setjmp=yes
else
enable_setjmp=no
@@ -17600,6 +17592,19 @@ else
fi
+# Check whether --enable-unwind-header was given.
+if test "${enable_unwind_header+set}" = set; then :
+ enableval=$enable_unwind_header;
+else
+ enable_unwind_header=yes
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should export unwind.h" >&5
+$as_echo_n "checking if we should export unwind.h... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_unwind_header" >&5
+$as_echo "$enable_unwind_header" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should build libunwind-setjmp" >&5
$as_echo_n "checking if we should build libunwind-setjmp... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_setjmp" >&5
@@ -17646,6 +17651,14 @@ else
BUILD_SETJMP_FALSE=
fi
+ if test "x$enable_unwind_header" = xyes; then
+ BUILD_UNWIND_HEADER_TRUE=
+ BUILD_UNWIND_HEADER_FALSE='#'
+else
+ BUILD_UNWIND_HEADER_TRUE='#'
+ BUILD_UNWIND_HEADER_FALSE=
+fi
+
if test x$build_arch != x$host_arch; then
NO_PTRACE_TEST_TRUE=
NO_PTRACE_TEST_FALSE='#'
@@ -17758,6 +17771,14 @@ else
ARCH_S390X_FALSE=
fi
+ if test x$target_arch = xriscv; then
+ ARCH_RISCV_TRUE=
+ ARCH_RISCV_FALSE='#'
+else
+ ARCH_RISCV_TRUE='#'
+ ARCH_RISCV_FALSE=
+fi
+
if expr x$target_os : xlinux >/dev/null; then
OS_LINUX_TRUE=
OS_LINUX_FALSE='#'
@@ -17806,7 +17827,7 @@ case "${target_arch}" in
$as_echo "32" >&6; };;
(aarch64|ia64|ppc64|x86_64|s390x|tilegx) use_elf64=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: 64" >&5
$as_echo "64" >&6; };;
-(mips) use_elfxx=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: xx" >&5
+(mips|riscv) use_elfxx=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: xx" >&5
$as_echo "xx" >&6; };;
*) as_fn_error $? "Unknown ELF target: ${target_arch}" "$LINENO" 5
esac
@@ -17853,13 +17874,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_dwarf" >&5
$as_echo "$use_dwarf" >&6; }
-if test x$target_arch = xppc64; then
- libdir='${exec_prefix}/lib64'
- { $as_echo "$as_me:${as_lineno-$LINENO}: PowerPC64 detected, lib will be installed ${libdir}" >&5
-$as_echo "$as_me: PowerPC64 detected, lib will be installed ${libdir}" >&6;};
-
-fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to restrict build to remote support" >&5
$as_echo_n "checking whether to restrict build to remote support... " >&6; }
if test x$target_arch != x$host_arch; then
@@ -17900,6 +17914,7 @@ case $target_arch in
arm*) enable_cxx_exceptions=no;;
mips*) enable_cxx_exceptions=no;;
tile*) enable_cxx_exceptions=no;;
+ s390x*) enable_cxx_exceptions=no;;
*) enable_cxx_exceptions=yes;;
esac
@@ -17931,6 +17946,9 @@ case "${target_arch}" in
esac
fi
+if test x$remote_only = xyes; then
+ enable_debug_frame=no
+fi
if test x$enable_debug_frame = xyes; then
$as_echo "#define CONFIG_DEBUG_FRAME /**/" >>confdefs.h
@@ -18149,45 +18167,9 @@ fi
$as_echo "$enable_per_thread_cache" >&6; }
if test x$enable_per_thread_cache = xyes; then :
- if test "x$enable___thread" != xno; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread" >&5
-$as_echo_n "checking for __thread... " >&6; }
-if ${libc_cv_gcc___thread+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat > conftest.c <<\EOF
- __thread int a = 42;
-EOF
- if { ac_try='${CC-cc} $CFLAGS -c conftest.c >&5'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- libc_cv_gcc___thread=yes
- else
- libc_cv_gcc___thread=no
- fi
- rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc___thread" >&5
-$as_echo "$libc_cv_gcc___thread" >&6; }
- if test "$libc_cv_gcc___thread" = yes; then
-
-$as_echo "#define HAVE___THREAD 1" >>confdefs.h
- fi
-else
- libc_cv_gcc___thread=no
-fi
- if test x$libc_cv_gcc___thread = xno; then :
+$as_echo "#define HAVE___CACHE_PER_THREAD 1" >>confdefs.h
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "UNW_CACHE_PER_THREAD requires __thread
-See \`config.log' for more details" "$LINENO" 5; }
-
-fi
fi
@@ -18338,45 +18320,14 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have__builtin_unreachable" >&5
$as_echo "$have__builtin_unreachable" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync atomics" >&5
-$as_echo_n "checking for __sync atomics... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- __sync_bool_compare_and_swap((int *)0, 0, 1);
- __sync_fetch_and_add((int *)0, 1);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- have_sync_atomics=yes
-else
- have_sync_atomics=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-if test x$have_sync_atomics = xyes; then
-
-$as_echo "#define HAVE_SYNC_ATOMICS 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sync_atomics" >&5
-$as_echo "$have_sync_atomics" >&6; }
-
CCASFLAGS="${CCASFLAGS} ${CPPFLAGS}"
arch="$target_arch"
ARCH=`echo $target_arch | tr a-z A-Z`
PKG_MAJOR=1
-PKG_MINOR=5
-PKG_EXTRA=0
+PKG_MINOR=6
+PKG_EXTRA=2
PKG_MAINTAINER=libunwind-devel@nongnu.org
old_LIBS="$LIBS"
@@ -18713,6 +18664,10 @@ if test -z "${BUILD_SETJMP_TRUE}" && test -z "${BUILD_SETJMP_FALSE}"; then
as_fn_error $? "conditional \"BUILD_SETJMP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${BUILD_UNWIND_HEADER_TRUE}" && test -z "${BUILD_UNWIND_HEADER_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_UNWIND_HEADER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${NO_PTRACE_TEST_TRUE}" && test -z "${NO_PTRACE_TEST_FALSE}"; then
as_fn_error $? "conditional \"NO_PTRACE_TEST\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -18769,6 +18724,10 @@ if test -z "${ARCH_S390X_TRUE}" && test -z "${ARCH_S390X_FALSE}"; then
as_fn_error $? "conditional \"ARCH_S390X\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ARCH_RISCV_TRUE}" && test -z "${ARCH_RISCV_FALSE}"; then
+ as_fn_error $? "conditional \"ARCH_RISCV\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${OS_LINUX_TRUE}" && test -z "${OS_LINUX_FALSE}"; then
as_fn_error $? "conditional \"OS_LINUX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19226,7 +19185,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libunwind $as_me 1.5.0, which was
+This file was extended by libunwind $as_me 1.6.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19292,7 +19251,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libunwind config.status 1.5.0
+libunwind config.status 1.6.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/src/third_party/unwind/dist/configure.ac b/src/third_party/unwind/dist/configure.ac
index c8d68f785c2..2893f0cf269 100644
--- a/src/third_party/unwind/dist/configure.ac
+++ b/src/third_party/unwind/dist/configure.ac
@@ -1,6 +1,6 @@
define(pkg_major, 1)
-define(pkg_minor, 5)
-define(pkg_extra, 0)
+define(pkg_minor, 6)
+define(pkg_extra, 2)
define(pkg_maintainer, libunwind-devel@nongnu.org)
define(mkvers, $1.$2.$3)
dnl Process this file with autoconf to produce a configure script.
@@ -32,13 +32,12 @@ case "$ac_cv_search_dlopen" in
*) DLLIB="";;
esac
-CHECK_ATOMIC_OPS
-
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(asm/ptrace_offsets.h endian.h sys/endian.h execinfo.h \
- ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
- sys/procfs.h sys/ptrace.h byteswap.h elf.h sys/elf.h link.h sys/link.h)
+AC_CHECK_HEADERS(asm/ptrace_offsets.h asm/ptrace.h endian.h sys/endian.h sys/param.h \
+ execinfo.h ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
+ sys/procfs.h sys/ptrace.h sys/syscall.h byteswap.h elf.h sys/elf.h \
+ link.h sys/link.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -98,6 +97,7 @@ AC_DEFUN([SET_ARCH],[
[sh*],[$2=sh],
[amd64],[$2=x86_64],
[tile*],[$2=tilegx],
+ [riscv*],[$2=riscv],
[$2=$1])
]) dnl SET_ARCH
@@ -120,7 +120,7 @@ esac
AC_ARG_ENABLE(coredump,
AS_HELP_STRING([--enable-coredump],[building libunwind-coredump library]),,
- [AS_CASE([$host_arch], [aarch64*|arm*|mips*|sh*|x86*|tile*], [enable_coredump=yes], [enable_coredump=no])]
+ [AS_CASE([$host_arch], [aarch64*|arm*|mips*|sh*|x86*|tile*|riscv*], [enable_coredump=yes], [enable_coredump=no])]
)
AC_MSG_CHECKING([if we should build libunwind-coredump])
@@ -136,7 +136,7 @@ AC_MSG_RESULT([$enable_ptrace])
AC_ARG_ENABLE(setjmp,
AS_HELP_STRING([--enable-setjmp],[building libunwind-setjmp library]),,
- [AS_IF([test x$target_arch == x$host_arch], [enable_setjmp=yes], [enable_setjmp=no])]
+ [AS_IF([test x$target_arch = x$host_arch], [enable_setjmp=yes], [enable_setjmp=no])]
)
AC_ARG_ENABLE(documentation,
@@ -151,6 +151,13 @@ AC_ARG_ENABLE(weak-backtrace,
AS_HELP_STRING([--disable-weak-backtrace],[Do not provide the weak 'backtrace' symbol.]),,
[enable_weak_backtrace=yes])
+AC_ARG_ENABLE(unwind-header,
+ AS_HELP_STRING([--disable-unwind-header],[Do not export the 'unwind.h' header]),,
+ [enable_unwind_header=yes])
+
+AC_MSG_CHECKING([if we should export unwind.h])
+AC_MSG_RESULT([$enable_unwind_header])
+
AC_MSG_CHECKING([if we should build libunwind-setjmp])
AC_MSG_RESULT([$enable_setjmp])
@@ -166,6 +173,7 @@ AC_MSG_RESULT([$target_os])
AM_CONDITIONAL(BUILD_COREDUMP, test x$enable_coredump = xyes)
AM_CONDITIONAL(BUILD_PTRACE, test x$enable_ptrace = xyes)
AM_CONDITIONAL(BUILD_SETJMP, test x$enable_setjmp = xyes)
+AM_CONDITIONAL(BUILD_UNWIND_HEADER, test "x$enable_unwind_header" = xyes)
AM_CONDITIONAL(NO_PTRACE_TEST, test x$build_arch != x$host_arch)
AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch)
AM_CONDITIONAL(ARCH_AARCH64, test x$target_arch = xaarch64)
@@ -180,6 +188,7 @@ AM_CONDITIONAL(ARCH_PPC64, test x$target_arch = xppc64)
AM_CONDITIONAL(ARCH_SH, test x$target_arch = xsh)
AM_CONDITIONAL(ARCH_TILEGX, test x$target_arch = xtilegx)
AM_CONDITIONAL(ARCH_S390X, test x$target_arch = xs390x)
+AM_CONDITIONAL(ARCH_RISCV, test x$target_arch = xriscv)
AM_CONDITIONAL(OS_LINUX, expr x$target_os : xlinux >/dev/null)
AM_CONDITIONAL(OS_HPUX, expr x$target_os : xhpux >/dev/null)
AM_CONDITIONAL(OS_FREEBSD, expr x$target_os : xfreebsd >/dev/null)
@@ -190,7 +199,7 @@ AC_MSG_CHECKING([for ELF helper width])
case "${target_arch}" in
(arm|hppa|ppc32|x86|sh) use_elf32=yes; AC_MSG_RESULT([32]);;
(aarch64|ia64|ppc64|x86_64|s390x|tilegx) use_elf64=yes; AC_MSG_RESULT([64]);;
-(mips) use_elfxx=yes; AC_MSG_RESULT([xx]);;
+(mips|riscv) use_elfxx=yes; AC_MSG_RESULT([xx]);;
*) AC_MSG_ERROR([Unknown ELF target: ${target_arch}])
esac
AM_CONDITIONAL(USE_ELF32, [test x$use_elf32 = xyes])
@@ -206,12 +215,6 @@ fi
AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes])
AC_MSG_RESULT([$use_dwarf])
-if test x$target_arch = xppc64; then
- libdir='${exec_prefix}/lib64'
- AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]);
- AC_SUBST([libdir])
-fi
-
AC_MSG_CHECKING([whether to restrict build to remote support])
if test x$target_arch != x$host_arch; then
CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
@@ -242,6 +245,7 @@ case $target_arch in
arm*) enable_cxx_exceptions=no;;
mips*) enable_cxx_exceptions=no;;
tile*) enable_cxx_exceptions=no;;
+ s390x*) enable_cxx_exceptions=no;;
*) enable_cxx_exceptions=yes;;
esac
])
@@ -257,6 +261,9 @@ case "${target_arch}" in
(aarch64) enable_debug_frame=yes;;
(*) enable_debug_frame=no;;
esac])
+if test x$remote_only = xyes; then
+ enable_debug_frame=no
+fi
if test x$enable_debug_frame = xyes; then
AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame])
fi
@@ -328,10 +335,8 @@ AC_ARG_ENABLE([per-thread-cache],
AS_HELP_STRING([--enable-per-thread-cache], [build with support for UNW_CACHE_PER_THREAD (which imposes a hight TLS memory usage) (default: disabled)]))
AC_MSG_RESULT([$enable_per_thread_cache])
AS_IF([test x$enable_per_thread_cache = xyes], [
- LIBUNWIND___THREAD
- AS_IF([test x$libc_cv_gcc___thread = xno], [
- AC_MSG_FAILURE([UNW_CACHE_PER_THREAD requires __thread])
- ])
+ AC_DEFINE(HAVE___CACHE_PER_THREAD, 1,
+ [Define to 1 if --enable-per-thread-cache])
])
AC_MSG_CHECKING([for Intel compiler])
@@ -400,20 +405,6 @@ if test x$have__builtin_unreachable = xyes; then
fi
AC_MSG_RESULT([$have__builtin_unreachable])
-AC_MSG_CHECKING([for __sync atomics])
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]], [[
- __sync_bool_compare_and_swap((int *)0, 0, 1);
- __sync_fetch_and_add((int *)0, 1);
- ]])],
- [have_sync_atomics=yes],
- [have_sync_atomics=no])
-if test x$have_sync_atomics = xyes; then
- AC_DEFINE([HAVE_SYNC_ATOMICS], [1],
- [Defined if __sync atomics are available])
-fi
-AC_MSG_RESULT([$have_sync_atomics])
-
CCASFLAGS="${CCASFLAGS} ${CPPFLAGS}"
arch="$target_arch"
diff --git a/src/third_party/unwind/dist/doc/unw_init_remote.man b/src/third_party/unwind/dist/doc/unw_init_remote.man
index 27f39c49666..0acdac9617b 100644
--- a/src/third_party/unwind/dist/doc/unw_init_remote.man
+++ b/src/third_party/unwind/dist/doc/unw_init_remote.man
@@ -1,7 +1,5 @@
-.\" *********************************** start of \input{common.tex}
-.\" *********************************** end of \input{common.tex}
'\" t
-.\" Manual page created with latex2man on Wed Jan 13 17:21:43 UTC 2021
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
.\" NOTE: This file is generated, DO NOT EDIT.
.de Vb
.ft CW
@@ -12,7 +10,7 @@
.fi
..
-.TH "UNW\\_INIT\\_REMOTE" "3" "13 January 2021" "Programming Library " "Programming Library "
+.TH "UNW\\_INIT\\_REMOTE" "3" "16 August 2007" "Programming Library " "Programming Library "
.SH NAME
unw_init_remote
\-\- initialize cursor for remote unwinding
diff --git a/src/third_party/unwind/dist/include/compiler.h b/src/third_party/unwind/dist/include/compiler.h
index 2fa59eff7fb..22939483cdd 100644
--- a/src/third_party/unwind/dist/include/compiler.h
+++ b/src/third_party/unwind/dist/include/compiler.h
@@ -31,7 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define COMPILER_H
#ifdef __GNUC__
-# define ALIGNED(x) __attribute__((aligned(x)))
# define CONST_ATTR __attribute__((__const__))
# define UNUSED __attribute__((unused))
# define NOINLINE __attribute__((noinline))
@@ -54,7 +53,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define unlikely(x) (x)
# endif
#else
-# define ALIGNED(x)
# define ALWAYS_INLINE
# define CONST_ATTR
# define UNUSED
diff --git a/src/third_party/unwind/dist/include/config.h.in b/src/third_party/unwind/dist/include/config.h.in
index da06d6cf345..9fe8d123bbc 100644
--- a/src/third_party/unwind/dist/include/config.h.in
+++ b/src/third_party/unwind/dist/include/config.h.in
@@ -15,12 +15,12 @@
/* Define to 1 if you want every memory access validated */
#undef CONSERVATIVE_CHECKS
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+#undef HAVE_ASM_PTRACE_H
+
/* Define to 1 if you have the <asm/ptrace_offsets.h> header file. */
#undef HAVE_ASM_PTRACE_OFFSETS_H
-/* Define to 1 if you have the <atomic_ops.h> header file. */
-#undef HAVE_ATOMIC_OPS_H
-
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
@@ -152,9 +152,6 @@
/* Define to 1 if the system has the type `struct prstatus'. */
#undef HAVE_STRUCT_PRSTATUS
-/* Defined if __sync atomics are available */
-#undef HAVE_SYNC_ATOMICS
-
/* Define to 1 if you have the <sys/elf.h> header file. */
#undef HAVE_SYS_ELF_H
@@ -164,6 +161,9 @@
/* Define to 1 if you have the <sys/link.h> header file. */
#undef HAVE_SYS_LINK_H
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
@@ -173,6 +173,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#undef HAVE_SYS_SYSCALL_H
+
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
@@ -194,8 +197,8 @@
/* Defined if __builtin___clear_cache() is available */
#undef HAVE__BUILTIN___CLEAR_CACHE
-/* Define to 1 if __thread keyword is supported by the C compiler. */
-#undef HAVE___THREAD
+/* Define to 1 if --enable-per-thread-cache */
+#undef HAVE___CACHE_PER_THREAD
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
diff --git a/src/third_party/unwind/dist/include/dwarf-eh.h b/src/third_party/unwind/dist/include/dwarf-eh.h
index 96002a1b9d2..f48e91905be 100644
--- a/src/third_party/unwind/dist/include/dwarf-eh.h
+++ b/src/third_party/unwind/dist/include/dwarf-eh.h
@@ -107,6 +107,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define DW_EH_VERSION 1 /* The version we're implementing */
+#ifdef _MSC_VER
+#pragma pack(push, 1)
+#define __attribute__(x)
+#endif
+
struct __attribute__((packed)) dwarf_eh_frame_hdr
{
unsigned char version;
@@ -126,4 +131,9 @@ struct __attribute__((packed)) dwarf_eh_frame_hdr
binary_search_table[fde_count]; */
};
+#ifdef _MSC_VER
+#pragma pack(pop)
+#undef __attribute__
+#endif
+
#endif /* dwarf_eh_h */
diff --git a/src/third_party/unwind/dist/include/dwarf.h b/src/third_party/unwind/dist/include/dwarf.h
index 764f6f20ac2..23ff4c4f64f 100644
--- a/src/third_party/unwind/dist/include/dwarf.h
+++ b/src/third_party/unwind/dist/include/dwarf.h
@@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define dwarf_h
#include <libunwind.h>
+#include <stdatomic.h>
struct dwarf_cursor; /* forward-declaration */
struct elf_dyn_info;
@@ -45,6 +46,9 @@ struct elf_dyn_info;
#else
#error Could not find <link.h>
#endif
+ #if defined(__ANDROID__) && defined(__arm__) && __ANDROID_API__ < 21
+ int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+ #endif
#endif
#include <pthread.h>
@@ -227,6 +231,7 @@ typedef enum
DWARF_WHERE_REG, /* register saved in another register */
DWARF_WHERE_EXPR, /* register saved */
DWARF_WHERE_VAL_EXPR, /* register has computed value */
+ DWARF_WHERE_CFA, /* register is set to the computed cfa value */
}
dwarf_where_t;
@@ -309,7 +314,7 @@ typedef struct dwarf_cursor
void *as_arg; /* argument to address-space callbacks */
unw_addr_space_t as; /* reference to per-address-space info */
- unw_word_t cfa; /* canonical frame address; aka frame-/stack-pointer */
+ unw_word_t cfa; /* canonical frame address; aka frame-pointer */
unw_word_t ip; /* instruction pointer */
unw_word_t args_size; /* size of arguments */
unw_word_t eh_args[UNW_TDEP_NUM_EH_REGS];
@@ -347,7 +352,7 @@ struct dwarf_rs_cache
/* hash table that maps instruction pointer to rs index: */
unsigned short *hash;
- uint32_t generation; /* generation number */
+ _Atomic uint32_t generation; /* generation number */
/* rs cache: */
dwarf_reg_state_t *buckets;
@@ -366,6 +371,8 @@ struct unw_debug_frame_list
/* The start (inclusive) and end (exclusive) of the described region. */
unw_word_t start;
unw_word_t end;
+ /* ELF load offset */
+ unw_word_t load_offset;
/* The debug frame itself. */
char *debug_frame;
size_t debug_frame_size;
diff --git a/src/third_party/unwind/dist/include/dwarf_i.h b/src/third_party/unwind/dist/include/dwarf_i.h
index 983b9f5c2af..b3e4c1b4055 100644
--- a/src/third_party/unwind/dist/include/dwarf_i.h
+++ b/src/third_party/unwind/dist/include/dwarf_i.h
@@ -142,7 +142,7 @@ dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
*addr += 1;
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if UNW_BYTE_ORDER == UNW_LITTLE_ENDIAN
val >>= 8*off;
#else
val >>= 8*(sizeof (unw_word_t) - 1 - off);
diff --git a/src/third_party/unwind/dist/include/libunwind-aarch64.h b/src/third_party/unwind/dist/include/libunwind-aarch64.h
index aeaef630240..a5265c4627b 100644
--- a/src/third_party/unwind/dist/include/libunwind-aarch64.h
+++ b/src/third_party/unwind/dist/include/libunwind-aarch64.h
@@ -34,6 +34,15 @@ extern "C" {
#include <inttypes.h>
#include <stddef.h>
#include <ucontext.h>
+#include <stdalign.h>
+
+#ifndef UNW_EMPTY_STRUCT
+# ifdef __GNUC__
+# define UNW_EMPTY_STRUCT
+# else
+# define UNW_EMPTY_STRUCT uint8_t unused;
+# endif
+#endif
#define UNW_TARGET aarch64
#define UNW_TARGET_AARCH64 1
@@ -60,6 +69,7 @@ typedef long double unw_tdep_fpreg_t;
typedef struct
{
/* no aarch64-specific auxiliary proc-info */
+ UNW_EMPTY_STRUCT
}
unw_tdep_proc_info_t;
@@ -169,10 +179,11 @@ aarch64_regnum_t;
typedef struct unw_tdep_save_loc
{
/* Additional target-dependent info on a save location. */
+ UNW_EMPTY_STRUCT
}
unw_tdep_save_loc_t;
-
+#ifdef __linux__
/* On AArch64, we can directly use ucontext_t as the unwind context,
* however, the __reserved struct is quite large: tune it down to only
* the necessary used fields. */
@@ -184,7 +195,7 @@ struct unw_sigcontext
uint64_t sp;
uint64_t pc;
uint64_t pstate;
- uint8_t __reserved[(34 * 8)] __attribute__((__aligned__(16)));
+ alignas(16) uint8_t __reserved[(66 * 8)];
};
typedef struct
@@ -192,7 +203,15 @@ typedef struct
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
+#ifndef __ANDROID__
sigset_t uc_sigmask;
+#else
+ union {
+ sigset_t uc_sigmask;
+ sigset64_t uc_sigmask64;
+ };
+ char __padding[128 - sizeof(sigset_t)];
+#endif
struct unw_sigcontext uc_mcontext;
} unw_tdep_context_t;
@@ -204,16 +223,19 @@ typedef struct
uint32_t fpcr;
uint64_t vregs[64];
} unw_fpsimd_context_t;
-
+#else
+/* On AArch64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+#endif
#include "libunwind-common.h"
#include "libunwind-dynamic.h"
-#define unw_tdep_getcontext(uc) (({ \
+#define unw_tdep_getcontext(uc) ({ \
unw_tdep_context_t *unw_ctx = (uc); \
- register uint64_t *unw_base __asm__ ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \
- __asm__ __volatile__ ( \
+ register uint64_t unw_base __asm__ ("x0") = (uint64_t) unw_ctx->uc_mcontext.regs; \
+ __asm__ __volatile__ ( \
"stp x0, x1, [%[base], #0]\n" \
"stp x2, x3, [%[base], #16]\n" \
"stp x4, x5, [%[base], #32]\n" \
@@ -229,11 +251,14 @@ typedef struct
"stp x24, x25, [%[base], #192]\n" \
"stp x26, x27, [%[base], #208]\n" \
"stp x28, x29, [%[base], #224]\n" \
- "str x30, [%[base], #240]\n" \
"mov x1, sp\n" \
- "stp x1, x30, [%[base], #248]\n" \
+ "stp x30, x1, [%[base], #240]\n" \
+ "adr x1, ret%=\n" \
+ "str x1, [%[base], #256]\n" \
+ "mov %[base], #0\n" \
+ "ret%=:\n" \
: [base] "+r" (unw_base) : : "x1", "memory"); \
- }), 0)
+ (int)unw_base; })
#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
extern int unw_tdep_is_fpreg (int);
diff --git a/src/third_party/unwind/dist/include/libunwind-arm.h b/src/third_party/unwind/dist/include/libunwind-arm.h
index 6709b7abaee..0bea7958b3f 100644
--- a/src/third_party/unwind/dist/include/libunwind-arm.h
+++ b/src/third_party/unwind/dist/include/libunwind-arm.h
@@ -32,6 +32,14 @@ extern "C" {
#include <inttypes.h>
#include <stddef.h>
+#ifndef UNW_EMPTY_STRUCT
+# ifdef __GNUC__
+# define UNW_EMPTY_STRUCT
+# else
+# define UNW_EMPTY_STRUCT uint8_t unused;
+# endif
+#endif
+
#define UNW_TARGET arm
#define UNW_TARGET_ARM 1
@@ -236,7 +244,7 @@ typedef enum
UNW_TDEP_LAST_REG = UNW_ARM_D31,
- UNW_TDEP_IP = UNW_ARM_R14, /* A little white lie. */
+ UNW_TDEP_IP = UNW_ARM_R15,
UNW_TDEP_SP = UNW_ARM_R13,
UNW_TDEP_EH = UNW_ARM_R0 /* FIXME. */
}
@@ -247,6 +255,7 @@ arm_regnum_t;
typedef struct unw_tdep_save_loc
{
/* Additional target-dependent info on a save location. */
+ UNW_EMPTY_STRUCT
}
unw_tdep_save_loc_t;
@@ -259,28 +268,42 @@ typedef struct unw_tdep_context
}
unw_tdep_context_t;
-/* There is no getcontext() on ARM. Use a stub version which only saves GP
- registers. FIXME: Not ideal, may not be sufficient for all libunwind
- use cases. Stores pc+8, which is only approximately correct, really. */
+/* FIXME: this is a stub version which only saves GP registers. Not ideal, but
+ may be sufficient for all libunwind use cases.
+ In thumb mode, we return directly back to thumb mode on return (with bx), to
+ avoid altering any registers after unw_resume. */
#ifndef __thumb__
-#define unw_tdep_getcontext(uc) (({ \
- unw_tdep_context_t *unw_ctx = (uc); \
- register unsigned long *unw_base __asm__ ("r0") = unw_ctx->regs; \
- __asm__ __volatile__ ( \
- "stmia %[base], {r0-r15}" \
- : : [base] "r" (unw_base) : "memory"); \
- }), 0)
+#define unw_tdep_getcontext(uc) ({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register unsigned long *r0 __asm__ ("r0"); \
+ unsigned long *unw_base = unw_ctx->regs; \
+ __asm__ __volatile__ ( \
+ "mov r0, #0\n" \
+ "stmia %[base], {r0-r15}\n" \
+ "nop\n" /* align return address to value stored by stmia */ \
+ : [r0] "=r" (r0) : [base] "r" (unw_base) : "memory"); \
+ (int)r0; })
#else /* __thumb__ */
-#define unw_tdep_getcontext(uc) (({ \
- unw_tdep_context_t *unw_ctx = (uc); \
- register unsigned long *unw_base __asm__ ("r0") = unw_ctx->regs; \
- __asm__ __volatile__ ( \
- ".align 2\nbx pc\nnop\n.code 32\n" \
- "stmia %[base], {r0-r15}\n" \
- "orr %[base], pc, #1\nbx %[base]\n" \
+#define unw_tdep_getcontext(uc) ({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register unsigned long *r0 __asm__ ("r0"); \
+ unsigned long *unw_base = unw_ctx->regs; \
+ __asm__ __volatile__ ( \
+ ".align 2\n" \
+ "bx pc\n" \
+ "nop\n" \
+ ".code 32\n" \
+ "mov r0, #0\n" \
+ "stmia %[base], {r0-r14}\n" \
+ "adr r0, ret%=+1\n" \
+ "str r0, [%[base], #60]\n" \
+ "orr r0, pc, #1\n" \
+ "bx r0\n" \
".code 16\n" \
- : [base] "+r" (unw_base) : : "memory", "cc"); \
- }), 0)
+ "mov r0, #0\n" \
+ "ret%=:\n" \
+ : [r0] "=r" (r0) : [base] "r" (unw_base) : "memory", "cc"); \
+ (int)r0; })
#endif
#include "libunwind-dynamic.h"
@@ -288,6 +311,7 @@ unw_tdep_context_t;
typedef struct
{
/* no arm-specific auxiliary proc-info */
+ UNW_EMPTY_STRUCT
}
unw_tdep_proc_info_t;
diff --git a/src/third_party/unwind/dist/include/libunwind-dynamic.h b/src/third_party/unwind/dist/include/libunwind-dynamic.h
index edb0bbd343d..dc31b12efc9 100644
--- a/src/third_party/unwind/dist/include/libunwind-dynamic.h
+++ b/src/third_party/unwind/dist/include/libunwind-dynamic.h
@@ -141,6 +141,7 @@ typedef struct unw_dyn_info
unw_word_t gp; /* global-pointer in effect for this entry */
int32_t format; /* real type: unw_dyn_info_format_t */
int32_t pad;
+ unw_word_t load_offset; /* ELF load offset */
union
{
unw_dyn_proc_info_t pi;
diff --git a/src/third_party/unwind/dist/include/libunwind-mips.h b/src/third_party/unwind/dist/include/libunwind-mips.h
index ced34b2027a..d1cc1b7e280 100644
--- a/src/third_party/unwind/dist/include/libunwind-mips.h
+++ b/src/third_party/unwind/dist/include/libunwind-mips.h
@@ -30,7 +30,7 @@ extern "C" {
#endif
#include <inttypes.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
#ifdef mips
# undef mips
diff --git a/src/third_party/unwind/dist/include/libunwind-ppc64.h b/src/third_party/unwind/dist/include/libunwind-ppc64.h
index 9944628da02..fed478bedcd 100644
--- a/src/third_party/unwind/dist/include/libunwind-ppc64.h
+++ b/src/third_party/unwind/dist/include/libunwind-ppc64.h
@@ -72,7 +72,7 @@ typedef uint64_t unw_word_t;
typedef int64_t unw_sword_t;
#endif
-typedef long double unw_tdep_fpreg_t;
+typedef double unw_tdep_fpreg_t;
/*
* Vector register (in PowerPC64 used for AltiVec registers)
diff --git a/src/third_party/unwind/dist/include/libunwind-ptrace.h b/src/third_party/unwind/dist/include/libunwind-ptrace.h
index 801325c4d4d..916dbd246bf 100644
--- a/src/third_party/unwind/dist/include/libunwind-ptrace.h
+++ b/src/third_party/unwind/dist/include/libunwind-ptrace.h
@@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define libunwind_ptrace_h
#include <libunwind.h>
+#include <sys/types.h>
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
diff --git a/src/third_party/unwind/dist/include/libunwind-riscv.h b/src/third_party/unwind/dist/include/libunwind-riscv.h
new file mode 100644
index 00000000000..e74db0f9318
--- /dev/null
+++ b/src/third_party/unwind/dist/include/libunwind-riscv.h
@@ -0,0 +1,187 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for riscv by Zhaofeng Li <hello@zhaofeng.li>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET riscv
+#define UNW_TARGET_RISCV 1
+
+#define _U_TDEP_QP_TRUE 0 /* ignored - see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+/* FIXME for riscv: Figure out a more reasonable size */
+#define UNW_TDEP_CURSOR_LEN 4096
+
+#if __riscv_xlen == 32
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+#elif __riscv_xlen == 64
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+#endif
+
+#if __riscv_flen == 64
+typedef double unw_tdep_fpreg_t;
+#elif __riscv_flen == 32
+typedef float unw_tdep_fpreg_t;
+#else
+# error "Unsupported RISC-V floating-point size"
+#endif
+
+/* Also see src/riscv/Gglobal.c. This ordering is consistent with
+ https://github.com/riscv/riscv-elf-psabi-doc/blob/74ecf07bcebd0cb4bf3c39f3f9d96946cd6aba61/riscv-elf.md#dwarf-register-numbers- */
+
+typedef enum
+ {
+ /* integer registers */
+ UNW_RISCV_X0,
+ UNW_RISCV_X1,
+ UNW_RISCV_X2,
+ UNW_RISCV_X3,
+ UNW_RISCV_X4,
+ UNW_RISCV_X5,
+ UNW_RISCV_X6,
+ UNW_RISCV_X7,
+ UNW_RISCV_X8,
+ UNW_RISCV_X9,
+ UNW_RISCV_X10,
+ UNW_RISCV_X11,
+ UNW_RISCV_X12,
+ UNW_RISCV_X13,
+ UNW_RISCV_X14,
+ UNW_RISCV_X15,
+ UNW_RISCV_X16,
+ UNW_RISCV_X17,
+ UNW_RISCV_X18,
+ UNW_RISCV_X19,
+ UNW_RISCV_X20,
+ UNW_RISCV_X21,
+ UNW_RISCV_X22,
+ UNW_RISCV_X23,
+ UNW_RISCV_X24,
+ UNW_RISCV_X25,
+ UNW_RISCV_X26,
+ UNW_RISCV_X27,
+ UNW_RISCV_X28,
+ UNW_RISCV_X29,
+ UNW_RISCV_X30,
+ UNW_RISCV_X31,
+
+ /* floating point registers */
+ UNW_RISCV_F0,
+ UNW_RISCV_F1,
+ UNW_RISCV_F2,
+ UNW_RISCV_F3,
+ UNW_RISCV_F4,
+ UNW_RISCV_F5,
+ UNW_RISCV_F6,
+ UNW_RISCV_F7,
+ UNW_RISCV_F8,
+ UNW_RISCV_F9,
+ UNW_RISCV_F10,
+ UNW_RISCV_F11,
+ UNW_RISCV_F12,
+ UNW_RISCV_F13,
+ UNW_RISCV_F14,
+ UNW_RISCV_F15,
+ UNW_RISCV_F16,
+ UNW_RISCV_F17,
+ UNW_RISCV_F18,
+ UNW_RISCV_F19,
+ UNW_RISCV_F20,
+ UNW_RISCV_F21,
+ UNW_RISCV_F22,
+ UNW_RISCV_F23,
+ UNW_RISCV_F24,
+ UNW_RISCV_F25,
+ UNW_RISCV_F26,
+ UNW_RISCV_F27,
+ UNW_RISCV_F28,
+ UNW_RISCV_F29,
+ UNW_RISCV_F30,
+ UNW_RISCV_F31,
+
+ UNW_RISCV_PC,
+
+ UNW_TDEP_LAST_REG = UNW_RISCV_PC,
+
+ /* The CFA is the value of SP in previous frame */
+ UNW_RISCV_CFA = UNW_RISCV_X2,
+
+ UNW_TDEP_IP = UNW_RISCV_PC,
+ UNW_TDEP_SP = UNW_RISCV_X2,
+ UNW_TDEP_EH = UNW_RISCV_X10,
+ }
+riscv_regnum_t;
+
+/* https://github.com/gcc-mirror/gcc/blob/16e2427f50c208dfe07d07f18009969502c25dc8/gcc/config/riscv/riscv.h#L104-L106 */
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ char unused;
+ }
+unw_tdep_save_loc_t;
+
+/* On riscv, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+typedef struct
+ {
+ /* no riscv-specific auxiliary proc-info */
+ char unused;
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-dynamic.h"
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+
+extern int unw_tdep_getcontext (unw_tdep_context_t *);
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/third_party/unwind/dist/include/libunwind.h b/src/third_party/unwind/dist/include/libunwind.h
index 91bb8ef9cad..40f485dca17 100644
--- a/src/third_party/unwind/dist/include/libunwind.h
+++ b/src/third_party/unwind/dist/include/libunwind.h
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/libunwind.h.in b/src/third_party/unwind/dist/include/libunwind.h.in
index a13e7767325..dfea76626b6 100644
--- a/src/third_party/unwind/dist/include/libunwind.h.in
+++ b/src/third_party/unwind/dist/include/libunwind.h.in
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/libunwind_i.h b/src/third_party/unwind/dist/include/libunwind_i.h
index e0f45401442..bcf22956687 100644
--- a/src/third_party/unwind/dist/include/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/libunwind_i.h
@@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "compiler.h"
-#if defined(HAVE___THREAD) && HAVE___THREAD
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
#define UNWI_DEFAULT_CACHING_POLICY UNW_CACHE_PER_THREAD
#else
#define UNWI_DEFAULT_CACHING_POLICY UNW_CACHE_GLOBAL
@@ -55,6 +55,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <errno.h>
+#include <stdio.h>
#if defined(HAVE_ELF_H)
# include <elf.h>
@@ -63,38 +65,78 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#else
# error Could not locate <elf.h>
#endif
+#if defined(ELFCLASS32)
+# define UNW_ELFCLASS32 ELFCLASS32
+#else
+# define UNW_ELFCLASS32 1
+#endif
+#if defined(ELFCLASS64)
+# define UNW_ELFCLASS64 ELFCLASS64
+#else
+# define UNW_ELFCLASS64 2
+#endif
#if defined(HAVE_ENDIAN_H)
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
-# if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
-# define __LITTLE_ENDIAN _LITTLE_ENDIAN
-# endif
-# if defined(_BIG_ENDIAN) && !defined(__BIG_ENDIAN)
-# define __BIG_ENDIAN _BIG_ENDIAN
-# endif
-# if defined(_BYTE_ORDER) && !defined(__BYTE_ORDER)
-# define __BYTE_ORDER _BYTE_ORDER
-# endif
+#elif defined(HAVE_SYS_PARAM_H)
+# include <sys/param.h>
+#endif
+
+#if defined(__LITTLE_ENDIAN)
+# define UNW_LITTLE_ENDIAN __LITTLE_ENDIAN
+#elif defined(_LITTLE_ENDIAN)
+# define UNW_LITTLE_ENDIAN _LITTLE_ENDIAN
+#elif defined(LITTLE_ENDIAN)
+# define UNW_LITTLE_ENDIAN LITTLE_ENDIAN
+#else
+# define UNW_LITTLE_ENDIAN 1234
+#endif
+
+#if defined(__BIG_ENDIAN)
+# define UNW_BIG_ENDIAN __BIG_ENDIAN
+#elif defined(_BIG_ENDIAN)
+# define UNW_BIG_ENDIAN _BIG_ENDIAN
+#elif defined(BIG_ENDIAN)
+# define UNW_BIG_ENDIAN BIG_ENDIAN
+#else
+# define UNW_BIG_ENDIAN 4321
+#endif
+
+#if defined(__BYTE_ORDER)
+# define UNW_BYTE_ORDER __BYTE_ORDER
+#elif defined(_BYTE_ORDER)
+# define UNW_BYTE_ORDER _BYTE_ORDER
+#elif defined(BIG_ENDIAN)
+# define UNW_BYTE_ORDER BYTE_ORDER
#else
-# define __LITTLE_ENDIAN 1234
-# define __BIG_ENDIAN 4321
# if defined(__hpux)
-# define __BYTE_ORDER __BIG_ENDIAN
-# elif defined(__QNX__)
-# if defined(__BIGENDIAN__)
-# define __BYTE_ORDER __BIG_ENDIAN
-# elif defined(__LITTLEENDIAN__)
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# error Host has unknown byte-order.
-# endif
+# define UNW_BYTE_ORDER UNW_BIG_ENDIAN
# else
-# error Host has unknown byte-order.
+# error Target has unknown byte ordering.
# endif
#endif
+static inline int
+byte_order_is_valid(int byte_order)
+{
+ return byte_order != UNW_BIG_ENDIAN
+ && byte_order != UNW_LITTLE_ENDIAN;
+}
+
+static inline int
+byte_order_is_big_endian(int byte_order)
+{
+ return byte_order == UNW_BIG_ENDIAN;
+}
+
+static inline int
+target_is_big_endian()
+{
+ return byte_order_is_big_endian(UNW_BYTE_ORDER);
+}
+
#if defined(HAVE__BUILTIN_UNREACHABLE)
# define unreachable() __builtin_unreachable()
#else
@@ -123,57 +165,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define mutex_unlock(l) \
(pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0)
-#ifdef HAVE_ATOMIC_OPS_H
-# include <atomic_ops.h>
-static inline int
-cmpxchg_ptr (void *addr, void *old, void *new)
-{
- union
- {
- void *vp;
- AO_t *aop;
- }
- u;
-
- u.vp = addr;
- return AO_compare_and_swap(u.aop, (AO_t) old, (AO_t) new);
-}
-# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr)
-# define fetch_and_add(_ptr, value) AO_fetch_and_add(_ptr, value)
-# define atomic_read(ptr) (AO_load(ptr))
- /* GCC 3.2.0 on HP-UX crashes on cmpxchg_ptr() */
-# if !(defined(__hpux) && __GNUC__ == 3 && __GNUC_MINOR__ == 2)
-# define HAVE_CMPXCHG
-# endif
-# define HAVE_FETCH_AND_ADD
-#elif defined(HAVE_SYNC_ATOMICS) || defined(HAVE_IA64INTRIN_H)
-# ifdef HAVE_IA64INTRIN_H
-# include <ia64intrin.h>
-# endif
-static inline int
-cmpxchg_ptr (void *addr, void *old, void *new)
-{
- union
- {
- void *vp;
- long *vlp;
- }
- u;
-
- u.vp = addr;
- return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new);
-}
-# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
-# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value)
-# define atomic_read(ptr) (__atomic_load_n(ptr,__ATOMIC_RELAXED))
-# define HAVE_CMPXCHG
-# define HAVE_FETCH_AND_ADD
-#endif
-
-#ifndef atomic_read
-#define atomic_read(ptr) (*(ptr))
-#endif
-
#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn))
#define UNWI_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_UI,UNW_TARGET),_), fn)
@@ -275,7 +266,7 @@ extern pthread_mutex_t _U_dyn_info_list_lock;
extern long unwi_debug_level;
# include <stdio.h>
-# define Debug(level,format...) \
+# define Debug(level, /* format */ ...) \
do { \
if (unwi_debug_level >= level) \
{ \
@@ -283,13 +274,14 @@ do { \
if (_n > 16) \
_n = 16; \
fprintf (stderr, "%*c>%s: ", _n, ' ', __FUNCTION__); \
- fprintf (stderr, format); \
+ fprintf (stderr, /* format */ __VA_ARGS__); \
} \
} while (0)
-# define Dprintf(format...) fprintf (stderr, format)
+# define Dprintf(/* format */ ...) \
+ fprintf (stderr, /* format */ __VA_ARGS__)
#else
-# define Debug(level,format...)
-# define Dprintf(format...)
+# define Debug(level, /* format */ ...)
+# define Dprintf( /* format */ ...)
#endif
static ALWAYS_INLINE int
@@ -298,6 +290,13 @@ print_error (const char *string)
return write (2, string, strlen (string));
}
+HIDDEN extern long unw_page_size;
+
+static inline unw_word_t uwn_page_start(unw_word_t addr)
+{
+ return addr & ~(unw_page_size - 1);
+}
+
#define mi_init UNWI_ARCH_OBJ(mi_init)
extern void mi_init (void); /* machine-independent initializations */
@@ -356,6 +355,10 @@ static inline void invalidate_edi (struct elf_dyn_info *edi)
#include "tdep/libunwind_i.h"
+#ifndef TDEP_DWARF_SP
+#define TDEP_DWARF_SP UNW_TDEP_SP
+#endif
+
#ifndef tdep_get_func_addr
# define tdep_get_func_addr(as,addr,v) (*(v) = addr, 0)
#endif
diff --git a/src/third_party/unwind/dist/include/remote.h b/src/third_party/unwind/dist/include/remote.h
index 064d6309adb..b3ac97f6ef8 100644
--- a/src/third_party/unwind/dist/include/remote.h
+++ b/src/third_party/unwind/dist/include/remote.h
@@ -58,7 +58,7 @@ fetch8 (unw_addr_space_t as, unw_accessors_t *a,
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if UNW_BYTE_ORDER == UNW_LITTLE_ENDIAN
val >>= 8*off;
#else
val >>= 8*(WSIZE - 1 - off);
@@ -81,7 +81,7 @@ fetch16 (unw_addr_space_t as, unw_accessors_t *a,
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if UNW_BYTE_ORDER == UNW_LITTLE_ENDIAN
val >>= 8*off;
#else
val >>= 8*(WSIZE - 2 - off);
@@ -104,7 +104,7 @@ fetch32 (unw_addr_space_t as, unw_accessors_t *a,
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if UNW_BYTE_ORDER == UNW_LITTLE_ENDIAN
val >>= 8*off;
#else
val >>= 8*(WSIZE - 4 - off);
diff --git a/src/third_party/unwind/dist/include/tdep-aarch64/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-aarch64/libunwind_i.h
index b91273fa1c5..d96833a219e 100644
--- a/src/third_party/unwind/dist/include/tdep-aarch64/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-aarch64/libunwind_i.h
@@ -32,6 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf64.h"
#include "mempool.h"
@@ -78,11 +79,7 @@ struct unw_addr_space
struct unw_accessors acc;
int big_endian;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -105,8 +102,16 @@ struct cursor
unw_word_t sigcontext_sp;
unw_word_t sigcontext_pc;
int validate;
+ ucontext_t *uc;
};
+static inline ucontext_t *
+dwarf_get_uc(const struct dwarf_cursor *cursor)
+{
+ const struct cursor *c = (struct cursor *) cursor->as_arg;
+ return c->uc;
+}
+
#define DWARF_GET_LOC(l) ((l).val)
#ifdef UNW_LOCAL_ONLY
@@ -115,10 +120,10 @@ struct cursor
# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
# define DWARF_IS_REG_LOC(l) 0
# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
- tdep_uc_addr((c)->as_arg, (r)), 0))
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
- tdep_uc_addr((c)->as_arg, (r)), 0))
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
static inline int
dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
@@ -160,8 +165,14 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
# define DWARF_LOC_TYPE_FP (1 << 0)
# define DWARF_LOC_TYPE_REG (1 << 1)
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
-# define DWARF_IS_NULL_LOC(l) \
- ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+
+static inline int
+dwarf_is_null_loc(dwarf_loc_t l)
+{
+ return l.val == 0 && l.type == 0;
+}
+
+# define DWARF_IS_NULL_LOC(l) dwarf_is_null_loc(l)
# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
@@ -262,6 +273,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace)
#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init_mem_validate UNW_OBJ(init_mem_validate)
#define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */
@@ -297,9 +309,10 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) ((as)->big_endian)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
+extern void tdep_init_mem_validate (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
unw_dyn_info_t *di, unw_proc_info_t *pi,
int need_unwind_info, void *arg);
diff --git a/src/third_party/unwind/dist/include/tdep-arm/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-arm/libunwind_i.h
index 2602f41c4f7..5bd28c953a6 100644
--- a/src/third_party/unwind/dist/include/tdep-arm/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-arm/libunwind_i.h
@@ -30,6 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf32.h"
#include "mempool.h"
@@ -64,11 +65,7 @@ struct unw_addr_space
struct unw_accessors acc;
int big_endian;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -151,8 +148,14 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
# define DWARF_LOC_TYPE_FP (1 << 0)
# define DWARF_LOC_TYPE_REG (1 << 1)
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
-# define DWARF_IS_NULL_LOC(l) \
- ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+
+static inline int
+dwarf_is_null_loc(dwarf_loc_t l)
+{
+ return l.val == 0 && l.type == 0;
+}
+
+# define DWARF_IS_NULL_LOC(l) dwarf_is_null_loc(l)
# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
@@ -253,6 +256,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init)
#define arm_find_proc_info UNW_OBJ(find_proc_info)
+#define arm_find_proc_info2 UNW_OBJ(find_proc_info2)
#define arm_put_unwind_info UNW_OBJ(put_unwind_info)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */
@@ -288,12 +292,15 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) ((as)->big_endian)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
unw_proc_info_t *pi, int need_unwind_info,
void *arg);
+extern int arm_find_proc_info2 (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info,
+ void *arg, int methods);
extern void arm_put_unwind_info (unw_addr_space_t as,
unw_proc_info_t *pi, void *arg);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
@@ -317,6 +324,7 @@ extern void tdep_stash_frame (struct dwarf_cursor *c,
#define UNW_ARM_METHOD_DWARF 0x01
#define UNW_ARM_METHOD_FRAME 0x02
#define UNW_ARM_METHOD_EXIDX 0x04
+#define UNW_ARM_METHOD_LR 0x08
#define unwi_unwind_method UNW_OBJ(unwind_method)
extern int unwi_unwind_method;
diff --git a/src/third_party/unwind/dist/include/tdep-hppa/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-hppa/libunwind_i.h
index 72649aa3ecc..fd5910d0125 100644
--- a/src/third_party/unwind/dist/include/tdep-hppa/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-hppa/libunwind_i.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf32.h"
#include "mempool.h"
@@ -46,11 +47,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -260,7 +257,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-ia64/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-ia64/libunwind_i.h
index 1d9770bab85..8cb8fea2279 100644
--- a/src/third_party/unwind/dist/include/tdep-ia64/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-ia64/libunwind_i.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "elf64.h"
#include "mempool.h"
+#include <stdatomic.h>
typedef struct
{
@@ -97,11 +98,7 @@ struct unw_addr_space
int big_endian;
int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation;
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
#ifndef UNW_REMOTE_ONLY
diff --git a/src/third_party/unwind/dist/include/tdep-ia64/script.h b/src/third_party/unwind/dist/include/tdep-ia64/script.h
index fe3360bf582..8a6ab9cc01d 100644
--- a/src/third_party/unwind/dist/include/tdep-ia64/script.h
+++ b/src/third_party/unwind/dist/include/tdep-ia64/script.h
@@ -23,6 +23,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include <stdatomic.h>
+
#define IA64_LOG_UNW_CACHE_SIZE 7
#define IA64_UNW_CACHE_SIZE (1 << IA64_LOG_UNW_CACHE_SIZE)
@@ -59,11 +61,7 @@ struct ia64_script
struct ia64_script_cache
{
-#ifdef HAVE_ATOMIC_OPS_H
- AO_TS_t busy; /* is the script-cache busy? */
-#else
- pthread_mutex_t lock;
-#endif
+ atomic_flag busy; /* is the script-cache busy? */
unsigned short lru_head; /* index of lead-recently used script */
unsigned short lru_tail; /* index of most-recently used script */
diff --git a/src/third_party/unwind/dist/include/tdep-mips/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-mips/libunwind_i.h
index 0c0fd3cf47e..343a195141b 100644
--- a/src/third_party/unwind/dist/include/tdep-mips/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-mips/libunwind_i.h
@@ -30,6 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#if !defined(UNW_REMOTE_ONLY) && _MIPS_SIM == _ABI64
# include "elf64.h"
@@ -54,11 +55,7 @@ struct unw_addr_space
unsigned int addr_size;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -320,7 +317,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
#define tdep_get_ip(c) ((c)->dwarf.ip)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-ppc32/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-ppc32/libunwind_i.h
index 4cf6d135f63..b9100e6ac89 100644
--- a/src/third_party/unwind/dist/include/tdep-ppc32/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-ppc32/libunwind_i.h
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf32.h"
#include "mempool.h"
@@ -52,11 +53,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -292,7 +289,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-ppc64/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-ppc64/libunwind_i.h
index 975f3bb3662..48227c76e20 100644
--- a/src/third_party/unwind/dist/include/tdep-ppc64/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-ppc64/libunwind_i.h
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf64.h"
#include "mempool.h"
@@ -54,11 +55,7 @@ struct unw_addr_space
int big_endian;
ppc64_abi_t abi;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -347,7 +344,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) ((as)->big_endian)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-riscv/dwarf-config.h b/src/third_party/unwind/dist/include/tdep-riscv/dwarf-config.h
new file mode 100644
index 00000000000..78277761d8c
--- /dev/null
+++ b/src/third_party/unwind/dist/include/tdep-riscv/dwarf-config.h
@@ -0,0 +1,50 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for riscv by Zhaofeng Li <hello@zhaofeng.li>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* 32 integer registers + 32 floating-point registers + 2 pseudo-registers */
+#define DWARF_NUM_PRESERVED_REGS 66
+
+#define DWARF_REGNUM_MAP_LENGTH DWARF_NUM_PRESERVED_REGS
+
+/* Not big-endian. */
+#define dwarf_is_big_endian(addr_space) 0
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+ unw_word_t type; /* see RISCV_LOC_TYPE_* macros. */
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/third_party/unwind/dist/include/tdep-riscv/jmpbuf.h b/src/third_party/unwind/dist/include/tdep-riscv/jmpbuf.h
new file mode 100644
index 00000000000..8831f6900c9
--- /dev/null
+++ b/src/third_party/unwind/dist/include/tdep-riscv/jmpbuf.h
@@ -0,0 +1,49 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by Zhaofeng Li <hello@zhaofeng.li>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if defined __linux__
+
+/* https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/riscv/setjmp.S;h=0b92016b311b11aa9eeb62b38c670a262f1924c9;hb=HEAD */
+#define JB_SP 13
+#define JB_RP 0
+
+#if __riscv_xlen == 64
+
+/* GCC's internal structure for this depends on the floating-point ABI:
+ https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/rv64/jmp_buf-macros.h;h=be9199e514bf4f15f0612327b8b762e29a2b7862;hb=HEAD
+*/
+
+#if defined __riscv_float_abi_double
+# define JB_MASK_SAVED (208>>3)
+# define JB_MASK (216>>3)
+#else
+# error "Unsupported RISC-V floating point ABI"
+#endif /* __riscv_float_abi_double */
+
+#else
+# error "Add offsets here"
+#endif /* __riscv_xlen */
+
+#endif
diff --git a/src/third_party/unwind/dist/include/tdep-riscv/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-riscv/libunwind_i.h
new file mode 100644
index 00000000000..4404a47510a
--- /dev/null
+++ b/src/third_party/unwind/dist/include/tdep-riscv/libunwind_i.h
@@ -0,0 +1,303 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+ Modified for riscv by Zhaofeng Li <hello@zhaofeng.li>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef RISCV_LIBUNWIND_I_H
+#define RISCV_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+#include <stdatomic.h>
+
+/* FIXME: Remote across address sizes? */
+
+#if __riscv_xlen == 64
+# include "elf64.h"
+#elif __riscv_xlen == 32
+# include "elf32.h"
+#else
+# error "Unsupported address size"
+#endif
+
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no riscv-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+
+ int big_endian;
+ unsigned int addr_size;
+
+ unw_caching_policy_t caching_policy;
+ _Atomic uint32_t cache_generation;
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+};
+
+#define tdep_big_endian(as) ((as)->big_endian)
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+ enum
+ {
+ RISCV_SCF_NONE, // 0
+ RISCV_SCF_LINUX_RT_SIGFRAME, // 1
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ unw_word_t sigcontext_sp;
+ unw_word_t sigcontext_pc;
+ int validate;
+ ucontext_t *uc;
+ };
+
+static inline ucontext_t *
+dwarf_get_uc(const struct dwarf_cursor *cursor)
+{
+ const struct cursor *c = (struct cursor *) cursor->as_arg;
+ return c->uc;
+}
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) (intptr_t) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) (intptr_t) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ /* FIXME: unw_word_t may not be equal to FLEN */
+ addr = DWARF_GET_LOC (loc);
+#if __riscv_xlen == __riscv_flen
+ return (*c->as->acc.access_mem) (c->as, addr, (unw_word_t *) valp,
+ 0, c->as_arg);
+#else
+# error "FIXME"
+#endif
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ /* FIXME: unw_word_t may not be equal to FLEN */
+ addr = DWARF_GET_LOC (loc);
+#if __riscv_xlen == __riscv_flen
+ return (*c->as->acc.access_mem) (c->as, addr, (unw_word_t *) valp,
+ 1, c->as_arg);
+#else
+# error "FIXME"
+#endif
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_mem_validate UNW_OBJ(init_mem_validate)
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+
+extern atomic_bool tdep_init_done;
+
+extern void tdep_init (void);
+extern void tdep_init_mem_validate (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+#endif /* RISCV_LIBUNWIND_I_H */
diff --git a/src/third_party/unwind/dist/include/tdep-s390x/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-s390x/libunwind_i.h
index 137a0b8a4f9..ba75c0742f6 100644
--- a/src/third_party/unwind/dist/include/tdep-s390x/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-s390x/libunwind_i.h
@@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf64.h"
#include "mempool.h"
@@ -42,11 +43,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -167,16 +164,16 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
if (DWARF_IS_NULL_LOC (loc))
return -UNW_EBADREG;
+ /* GPRs may be saved in FPRs */
+ if (DWARF_IS_FP_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), (unw_fpreg_t*)val,
+ 0, c->as_arg);
if (DWARF_IS_REG_LOC (loc))
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
if (DWARF_IS_MEM_LOC (loc))
return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
- /* GPRs may be saved in FPRs */
- if (DWARF_IS_FP_LOC (loc))
- return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), (unw_fpreg_t*)val,
- 0, c->as_arg);
assert(DWARF_IS_VAL_LOC (loc));
*val = DWARF_GET_LOC (loc);
return 0;
@@ -191,13 +188,13 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
if (DWARF_IS_NULL_LOC (loc))
return -UNW_EBADREG;
- if (DWARF_IS_REG_LOC (loc))
- return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
- 1, c->as_arg);
/* GPRs may be saved in FPRs */
if (DWARF_IS_FP_LOC (loc))
return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), (unw_fpreg_t*) &val,
1, c->as_arg);
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
assert(DWARF_IS_MEM_LOC (loc));
return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
@@ -242,7 +239,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern void tdep_init_mem_validate (void);
diff --git a/src/third_party/unwind/dist/include/tdep-sh/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-sh/libunwind_i.h
index 8ced49104b5..7b4fe0023b4 100644
--- a/src/third_party/unwind/dist/include/tdep-sh/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-sh/libunwind_i.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf32.h"
#include "mempool.h"
@@ -47,11 +48,7 @@ struct unw_addr_space
struct unw_accessors acc;
int big_endian;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -261,7 +258,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) ((as)->big_endian)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-tilegx/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-tilegx/libunwind_i.h
index 2cfed456a70..dc4cb7fdb2e 100644
--- a/src/third_party/unwind/dist/include/tdep-tilegx/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-tilegx/libunwind_i.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
# include "elf64.h"
#include "mempool.h"
@@ -50,11 +51,7 @@ struct unw_addr_space
unsigned int addr_size;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -235,7 +232,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
#define tdep_get_ip(c) ((c)->dwarf.ip)
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as,
diff --git a/src/third_party/unwind/dist/include/tdep-x86/dwarf-config.h b/src/third_party/unwind/dist/include/tdep-x86/dwarf-config.h
index f76f9c1c4eb..11398e4e622 100644
--- a/src/third_party/unwind/dist/include/tdep-x86/dwarf-config.h
+++ b/src/third_party/unwind/dist/include/tdep-x86/dwarf-config.h
@@ -43,9 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
typedef struct dwarf_loc
{
unw_word_t val;
-#ifndef UNW_LOCAL_ONLY
unw_word_t type; /* see X86_LOC_TYPE_* macros. */
-#endif
}
dwarf_loc_t;
diff --git a/src/third_party/unwind/dist/include/tdep-x86/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-x86/libunwind_i.h
index 5231189a499..ad4edc2f5ac 100644
--- a/src/third_party/unwind/dist/include/tdep-x86/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-x86/libunwind_i.h
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <libunwind.h>
+#include <stdatomic.h>
#include "elf32.h"
#include "mempool.h"
@@ -46,11 +47,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -87,15 +84,26 @@ dwarf_get_uc(const struct dwarf_cursor *cursor)
}
#define DWARF_GET_LOC(l) ((l).val)
+# define DWARF_LOC_TYPE_MEM (0 << 0)
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_LOC_TYPE_VAL (1 << 2)
-#ifdef UNW_LOCAL_ONLY
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_IS_MEM_LOC(l) ((l).type == DWARF_LOC_TYPE_MEM)
+# define DWARF_IS_VAL_LOC(l) (((l).type & DWARF_LOC_TYPE_VAL) != 0)
+
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
-# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
-# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
-# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_VAL_LOC(c,v) DWARF_LOC ((v), DWARF_LOC_TYPE_VAL)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), DWARF_LOC_TYPE_MEM)
+
+#ifdef UNW_LOCAL_ONLY
# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
-# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
@@ -117,35 +125,8 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
return 0;
}
-static inline int
-dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
-{
- if (!DWARF_GET_LOC (loc))
- return -1;
- return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
- 0, c->as_arg);
-}
-
-static inline int
-dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
-{
- if (!DWARF_GET_LOC (loc))
- return -1;
- return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
- 1, c->as_arg);
-}
-
#else /* !UNW_LOCAL_ONLY */
-# define DWARF_LOC_TYPE_FP (1 << 0)
-# define DWARF_LOC_TYPE_REG (1 << 1)
-# define DWARF_NULL_LOC DWARF_LOC (0, 0)
-# define DWARF_IS_NULL_LOC(l) \
- ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
-# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
-# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
-# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
-# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
| DWARF_LOC_TYPE_FP))
@@ -195,38 +176,33 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
1, c->as_arg);
}
+#endif /* !UNW_LOCAL_ONLY */
+
static inline int
dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
{
if (DWARF_IS_NULL_LOC (loc))
return -UNW_EBADREG;
- /* If a code-generator were to save a value of type unw_word_t in a
- floating-point register, we would have to support this case. I
- suppose it could happen with MMX registers, but does it really
- happen? */
- assert (!DWARF_IS_FP_LOC (loc));
-
if (DWARF_IS_REG_LOC (loc))
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
- else
+ if (DWARF_IS_MEM_LOC (loc))
return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
0, c->as_arg);
+ assert(DWARF_IS_VAL_LOC (loc));
+ *val = DWARF_GET_LOC (loc);
+ return 0;
}
static inline int
dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
{
+ assert(!DWARF_IS_VAL_LOC (loc));
+
if (DWARF_IS_NULL_LOC (loc))
return -UNW_EBADREG;
- /* If a code-generator were to save a value of type unw_word_t in a
- floating-point register, we would have to support this case. I
- suppose it could happen with MMX registers, but does it really
- happen? */
- assert (!DWARF_IS_FP_LOC (loc));
-
if (DWARF_IS_REG_LOC (loc))
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
1, c->as_arg);
@@ -235,7 +211,9 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
1, c->as_arg);
}
-#endif /* !UNW_LOCAL_ONLY */
+// For historical reasons, the DWARF numbering does not match the libunwind
+// numbering, necessitating this override
+#define TDEP_DWARF_SP 4
#define tdep_getcontext_trace unw_getcontext
#define tdep_init_done UNW_OBJ(init_done)
@@ -274,7 +252,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 0
-extern int tdep_init_done;
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
diff --git a/src/third_party/unwind/dist/include/tdep-x86_64/libunwind_i.h b/src/third_party/unwind/dist/include/tdep-x86_64/libunwind_i.h
index 6b798c7115f..ff0436a09c4 100644
--- a/src/third_party/unwind/dist/include/tdep-x86_64/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep-x86_64/libunwind_i.h
@@ -31,7 +31,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* Target-dependent definitions that are internal to libunwind but need
to be shared with target-independent code. */
+#include <stdint.h>
#include <stdlib.h>
+#include <stdatomic.h>
#include <libunwind.h>
#include "elf64.h"
@@ -64,11 +66,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
unw_caching_policy_t caching_policy;
-#ifdef HAVE_ATOMIC_OPS_H
- AO_t cache_generation;
-#else
- uint32_t cache_generation;
-#endif
+ _Atomic uint32_t cache_generation;
unw_word_t dyn_generation; /* see dyn-common.h */
unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
struct dwarf_rs_cache global_cache;
@@ -93,15 +91,44 @@ struct cursor
}
sigcontext_format;
unw_word_t sigcontext_addr;
- int validate;
- ucontext_t *uc;
};
+#define AS_ARG_UCONTEXT_MASK ~0x1UL
+#define AS_ARG_VALIDATE_MASK 0x1UL
+
+#define AS_ARG_GET_UC_PTR(arg) \
+ ((ucontext_t *) ((uintptr_t) arg & AS_ARG_UCONTEXT_MASK))
+#define AS_ARG_GET_VALIDATE(arg) \
+ ((int) ((uintptr_t) arg & AS_ARG_VALIDATE_MASK))
+
static inline ucontext_t *
dwarf_get_uc(const struct dwarf_cursor *cursor)
{
- const struct cursor *c = (struct cursor *) cursor->as_arg;
- return c->uc;
+ assert(cursor->as == unw_local_addr_space);
+ return AS_ARG_GET_UC_PTR(cursor->as_arg);
+}
+
+static inline int
+dwarf_get_validate(const struct dwarf_cursor *cursor)
+{
+ assert(cursor->as == unw_local_addr_space);
+ return AS_ARG_GET_VALIDATE(cursor->as_arg);
+}
+
+static inline void
+dwarf_set_validate(const struct dwarf_cursor *cursor, const int validate)
+{
+ assert(cursor->as == unw_local_addr_space);
+ uintptr_t *packed_args = (uintptr_t *) &cursor->as_arg;
+ *packed_args |= (AS_ARG_VALIDATE_MASK & validate);
+}
+
+static inline void *
+dwarf_build_as_arg(const ucontext_t *uc, const int validate) {
+ uintptr_t packed_args = (uintptr_t) uc;
+ assert((packed_args & AS_ARG_VALIDATE_MASK) == 0);
+ packed_args |= (AS_ARG_VALIDATE_MASK & validate);
+ return (void *) packed_args;
}
#define DWARF_GET_LOC(l) ((l).val)
@@ -130,8 +157,14 @@ dwarf_get_uc(const struct dwarf_cursor *cursor)
#else /* !UNW_LOCAL_ONLY */
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
-# define DWARF_IS_NULL_LOC(l) \
- ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+
+static inline int
+dwarf_is_null_loc(dwarf_loc_t l)
+{
+ return l.val == 0 && l.type == 0;
+}
+
+# define DWARF_IS_NULL_LOC(l) dwarf_is_null_loc(l)
# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
| DWARF_LOC_TYPE_FP))
@@ -233,11 +266,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 0
-#ifdef HAVE_ATOMIC_OPS_H
-extern AO_t tdep_init_done;
-#else
-extern int tdep_init_done;
-#endif
+extern atomic_bool tdep_init_done;
extern void tdep_init (void);
extern void tdep_init_mem_validate (void);
diff --git a/src/third_party/unwind/dist/include/tdep/dwarf-config.h b/src/third_party/unwind/dist/include/tdep/dwarf-config.h
index c759a46c63b..0cfd079e66c 100644
--- a/src/third_party/unwind/dist/include/tdep/dwarf-config.h
+++ b/src/third_party/unwind/dist/include/tdep/dwarf-config.h
@@ -15,6 +15,8 @@
# include "tdep-ppc32/dwarf-config.h"
#elif defined __powerpc64__
# include "tdep-ppc64/dwarf-config.h"
+#elif defined __s390x__
+# include "tdep-s390x/dwarf-config.h"
#elif defined __sh__
# include "tdep-sh/dwarf-config.h"
#elif defined __i386__
@@ -23,6 +25,8 @@
# include "tdep-x86_64/dwarf-config.h"
#elif defined __tilegx__
# include "tdep-tilegx/dwarf-config.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/dwarf-config.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/tdep/jmpbuf.h b/src/third_party/unwind/dist/include/tdep/jmpbuf.h
index 13093a0cdc3..77d35c3da4d 100644
--- a/src/third_party/unwind/dist/include/tdep/jmpbuf.h
+++ b/src/third_party/unwind/dist/include/tdep/jmpbuf.h
@@ -23,6 +23,8 @@
# include "tdep-x86_64/jmpbuf.h"
#elif defined __tilegx__
# include "tdep-tilegx/jmpbuf.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/jmpbuf.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/tdep/libunwind_i.h b/src/third_party/unwind/dist/include/tdep/libunwind_i.h
index 19cdc156c6f..efd4f875ec4 100644
--- a/src/third_party/unwind/dist/include/tdep/libunwind_i.h
+++ b/src/third_party/unwind/dist/include/tdep/libunwind_i.h
@@ -27,6 +27,8 @@
# include "tdep-tilegx/libunwind_i.h"
#elif defined __s390x__
# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/tdep/libunwind_i.h.in b/src/third_party/unwind/dist/include/tdep/libunwind_i.h.in
index c47299640e8..a40f7cf6112 100644
--- a/src/third_party/unwind/dist/include/tdep/libunwind_i.h.in
+++ b/src/third_party/unwind/dist/include/tdep/libunwind_i.h.in
@@ -27,6 +27,8 @@
# include "tdep-tilegx/libunwind_i.h"
#elif defined __s390x__
# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/dist/include/unwind.h b/src/third_party/unwind/dist/include/unwind.h
index 7cf128deca3..93780fade8f 100644
--- a/src/third_party/unwind/dist/include/unwind.h
+++ b/src/third_party/unwind/dist/include/unwind.h
@@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* For uint64_t */
#include <stdint.h>
+#include <stdalign.h>
#ifdef __cplusplus
extern "C" {
@@ -76,11 +77,11 @@ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
even on 32-bit machines for gcc compatibility. */
struct _Unwind_Exception
{
- uint64_t exception_class;
+ alignas(8) uint64_t exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
- } __attribute__((__aligned__));
+ };
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
diff --git a/src/third_party/unwind/dist/src/Makefile.am b/src/third_party/unwind/dist/src/Makefile.am
index ff977446a7c..2b5b02959e9 100644
--- a/src/third_party/unwind/dist/src/Makefile.am
+++ b/src/third_party/unwind/dist/src/Makefile.am
@@ -60,6 +60,7 @@ libunwind_coredump_la_SOURCES = \
coredump/_UCD_elf_map_image.c \
coredump/_UCD_find_proc_info.c \
coredump/_UCD_get_proc_name.c \
+ coredump/_UCD_corefile_elf.c \
\
coredump/_UPT_elf.c \
coredump/_UPT_access_fpreg.c \
@@ -146,7 +147,7 @@ libunwind_la_SOURCES_local = \
$(libunwind_la_SOURCES_local_unwind)
noinst_HEADERS += os-linux.h
-libunwind_la_SOURCES_os_linux = os-linux.c
+libunwind_la_SOURCES_os_linux = os-linux.c dl-iterate-phdr.c
libunwind_la_SOURCES_os_hpux = os-hpux.c
@@ -246,6 +247,8 @@ noinst_HEADERS += ia64/init.h ia64/offsets.h ia64/regs.h \
ia64/ucontext_i.h ia64/unwind_decoder.h ia64/unwind_i.h
libunwind_la_SOURCES_ia64_common = $(libunwind_la_SOURCES_common) \
ia64/regname.c
+libunwind_la_EXTRAS_ia64 = ia64/mk_cursor_i ia64/mk_Lcursor_i.c \
+ ia64/mk_Gcursor_i.c
# The list of files that go into libunwind:
libunwind_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \
@@ -336,6 +339,26 @@ libunwind_tilegx_la_SOURCES_tilegx = $(libunwind_la_SOURCES_tilegx_common) \
tilegx/Gglobal.c tilegx/Ginit.c tilegx/Ginit_local.c tilegx/Ginit_remote.c \
tilegx/Gis_signal_frame.c tilegx/Gregs.c tilegx/Gresume.c tilegx/Gstep.c
+# The list of files that go info libunwind and libunwind-riscv:
+noinst_HEADERS += riscv/init.h riscv/offsets.h riscv/unwind_i.h riscv/asm.h
+libunwind_la_SOURCES_riscv_common = $(libunwind_la_SOURCES_common) \
+ riscv/is_fpreg.c riscv/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_riscv = $(libunwind_la_SOURCES_riscv_common) \
+ $(libunwind_la_SOURCES_local) \
+ riscv/getcontext.S riscv/setcontext.S \
+ riscv/Lapply_reg_state.c riscv/Lreg_states_iterate.c \
+ riscv/Lcreate_addr_space.c riscv/Lget_proc_info.c riscv/Lget_save_loc.c \
+ riscv/Lglobal.c riscv/Linit.c riscv/Linit_local.c riscv/Linit_remote.c \
+ riscv/Lis_signal_frame.c riscv/Lregs.c riscv/Lresume.c riscv/Lstep.c
+
+libunwind_riscv_la_SOURCES_riscv = $(libunwind_la_SOURCES_riscv_common) \
+ $(libunwind_la_SOURCES_generic) \
+ riscv/Gapply_reg_state.c riscv/Greg_states_iterate.c \
+ riscv/Gcreate_addr_space.c riscv/Gget_proc_info.c riscv/Gget_save_loc.c \
+ riscv/Gglobal.c riscv/Ginit.c riscv/Ginit_local.c riscv/Ginit_remote.c \
+ riscv/Gis_signal_frame.c riscv/Gregs.c riscv/Gresume.c riscv/Gstep.c
# The list of files that go both into libunwind and libunwind-x86:
noinst_HEADERS += x86/init.h x86/offsets.h x86/unwind_i.h
@@ -520,6 +543,8 @@ if OS_LINUX
libunwind_la_SOURCES_arm_os = arm/Gos-linux.c
libunwind_la_SOURCES_arm_os_local = arm/Los-linux.c
libunwind_coredump_la_SOURCES += coredump/_UCD_access_reg_linux.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_get_threadinfo_prstatus.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_get_mapinfo_linux.c
endif
if OS_HPUX
@@ -538,6 +563,8 @@ if OS_FREEBSD
libunwind_la_SOURCES_arm_os = arm/Gos-freebsd.c
libunwind_la_SOURCES_arm_os_local = arm/Los-freebsd.c
libunwind_coredump_la_SOURCES += coredump/_UCD_access_reg_freebsd.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_get_threadinfo_prstatus.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_get_mapinfo_generic.c
endif
if OS_SOLARIS
@@ -635,6 +662,18 @@ if !REMOTE_ONLY
endif
libunwind_setjmp_la_SOURCES += tilegx/siglongjmp.S
else
+if ARCH_RISCV
+ lib_LTLIBRARIES += libunwind-riscv.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_riscv)
+ libunwind_riscv_la_SOURCES = $(libunwind_riscv_la_SOURCES_riscv)
+ libunwind_riscv_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_riscv_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_riscv_la_LIBADD += libunwind-elf64.la
+if !REMOTE_ONLY
+ libunwind_riscv_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += riscv/siglongjmp.S
+else
if ARCH_X86
lib_LTLIBRARIES += libunwind-x86.la
libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86) $(libunwind_x86_la_SOURCES_os)
@@ -712,6 +751,7 @@ endif # ARCH_PPC64
endif # ARCH_PPC32
endif # ARCH_X86_64
endif # ARCH_X86
+endif # ARCH_RISCV
endif # ARCH_TILEGX
endif # ARCH_MIPS
endif # ARCH_HPPA
@@ -742,6 +782,7 @@ EXTRA_DIST = $(libunwind_la_SOURCES_aarch64) \
$(libunwind_la_SOURCES_arm) \
$(libunwind_la_SOURCES_hppa) \
$(libunwind_la_SOURCES_ia64) \
+ $(libunwind_la_EXTRAS_ia64) \
$(libunwind_la_SOURCES_mips) \
$(libunwind_la_SOURCES_sh) \
$(libunwind_la_SOURCES_x86) \
diff --git a/src/third_party/unwind/dist/src/Makefile.in b/src/third_party/unwind/dist/src/Makefile.in
index 2a5725921cd..d052d8c7986 100644
--- a/src/third_party/unwind/dist/src/Makefile.in
+++ b/src/third_party/unwind/dist/src/Makefile.in
@@ -102,8 +102,12 @@ target_triplet = @target@
@USE_DWARF_TRUE@am__append_8 = libunwind-dwarf-common.la libunwind-dwarf-generic.la
@REMOTE_ONLY_FALSE@@USE_DWARF_TRUE@am__append_9 = libunwind-dwarf-local.la
@USE_DWARF_TRUE@am__append_10 = libunwind-dwarf-local.la
-@OS_LINUX_TRUE@am__append_11 = coredump/_UCD_access_reg_linux.c
-@OS_FREEBSD_TRUE@am__append_12 = coredump/_UCD_access_reg_freebsd.c
+@OS_LINUX_TRUE@am__append_11 = coredump/_UCD_access_reg_linux.c \
+@OS_LINUX_TRUE@ coredump/_UCD_get_threadinfo_prstatus.c \
+@OS_LINUX_TRUE@ coredump/_UCD_get_mapinfo_linux.c
+@OS_FREEBSD_TRUE@am__append_12 = coredump/_UCD_access_reg_freebsd.c \
+@OS_FREEBSD_TRUE@ coredump/_UCD_get_threadinfo_prstatus.c \
+@OS_FREEBSD_TRUE@ coredump/_UCD_get_mapinfo_generic.c
@ARCH_AARCH64_TRUE@am__append_13 = libunwind-aarch64.la
@ARCH_AARCH64_TRUE@@REMOTE_ONLY_FALSE@am__append_14 = libunwind.la -lc
@ARCH_AARCH64_TRUE@am__append_15 = aarch64/siglongjmp.S
@@ -124,27 +128,30 @@ target_triplet = @target@
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am__append_28 = libunwind-tilegx.la
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@@REMOTE_ONLY_FALSE@am__append_29 = libunwind.la -lc
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am__append_30 = tilegx/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__append_31 = libunwind-x86.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@@REMOTE_ONLY_FALSE@am__append_32 = libunwind.la -lc
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__append_33 = x86/longjmp.S x86/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__append_34 = libunwind-x86_64.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_35 = libunwind.la -lc
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__append_36 = x86_64/longjmp.S x86_64/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_37 = libunwind-ppc32.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_38 = libunwind.la -lc
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_39 = ppc/longjmp.S ppc/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_40 = libunwind-ppc64.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_41 = libunwind.la -lc
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_42 = ppc/longjmp.S ppc/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_43 = libunwind-sh.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_44 = libunwind.la -lc
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_45 = sh/siglongjmp.S
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_46 = libunwind-s390x.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_47 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am__append_31 = libunwind-riscv.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@@REMOTE_ONLY_FALSE@am__append_32 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am__append_33 = riscv/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__append_34 = libunwind-x86.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@@REMOTE_ONLY_FALSE@am__append_35 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__append_36 = x86/longjmp.S x86/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__append_37 = libunwind-x86_64.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_38 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__append_39 = x86_64/longjmp.S x86_64/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_40 = libunwind-ppc32.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_41 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_42 = ppc/longjmp.S ppc/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_43 = libunwind-ppc64.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_44 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_45 = ppc/longjmp.S ppc/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_46 = libunwind-sh.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_47 = libunwind.la -lc
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_48 = sh/siglongjmp.S
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_49 = libunwind-s390x.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_50 = libunwind.la -lc
# libunwind-setjmp depends on libunwind-$(arch). Therefore must be added
# at the end.
-@BUILD_SETJMP_TRUE@am__append_48 = libunwind-setjmp.la
+@BUILD_SETJMP_TRUE@am__append_51 = libunwind-setjmp.la
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -194,8 +201,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
@ARCH_AARCH64_TRUE@ libunwind-dwarf-generic.la \
@ARCH_AARCH64_TRUE@ libunwind-elf64.la $(am__DEPENDENCIES_1)
am__libunwind_aarch64_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c aarch64/is_fpreg.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c aarch64/is_fpreg.c \
aarch64/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
@@ -210,7 +217,7 @@ am__libunwind_aarch64_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
aarch64/Gstash_frame.c aarch64/Gstep.c aarch64/Gtrace.c
am__objects_1 = os-freebsd.lo
am__objects_2 = os-hpux.lo
-am__objects_3 = os-linux.lo
+am__objects_3 = os-linux.lo dl-iterate-phdr.lo
am__objects_4 = os-qnx.lo
am__objects_5 = os-solaris.lo
@OS_FREEBSD_FALSE@@OS_HPUX_FALSE@@OS_LINUX_FALSE@@OS_QNX_FALSE@@OS_SOLARIS_TRUE@am__objects_6 = $(am__objects_5)
@@ -256,20 +263,20 @@ libunwind_aarch64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@ libunwind-elf32.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@ $(am__DEPENDENCIES_2)
am__libunwind_arm_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c arm/is_fpreg.c arm/regname.c arm/Gos-freebsd.c \
- arm/Gos-linux.c arm/Gos-other.c mi/Gdyn-extract.c \
- mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
- mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
- mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
- mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
- mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
- mi/Gset_cache_size.c arm/Gapply_reg_state.c \
- arm/Greg_states_iterate.c arm/Gcreate_addr_space.c \
- arm/Gget_proc_info.c arm/Gget_save_loc.c arm/Gglobal.c \
- arm/Ginit.c arm/Ginit_local.c arm/Ginit_remote.c arm/Gregs.c \
- arm/Gresume.c arm/Gstep.c arm/Gex_tables.c arm/Gstash_frame.c \
- arm/Gtrace.c
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c arm/is_fpreg.c \
+ arm/regname.c arm/Gos-freebsd.c arm/Gos-linux.c \
+ arm/Gos-other.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ arm/Gapply_reg_state.c arm/Greg_states_iterate.c \
+ arm/Gcreate_addr_space.c arm/Gget_proc_info.c \
+ arm/Gget_save_loc.c arm/Gglobal.c arm/Ginit.c \
+ arm/Ginit_local.c arm/Ginit_remote.c arm/Gregs.c arm/Gresume.c \
+ arm/Gstep.c arm/Gex_tables.c arm/Gstash_frame.c arm/Gtrace.c
am__objects_11 = $(am__objects_7) arm/is_fpreg.lo arm/regname.lo
@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_QNX_TRUE@am__objects_12 = arm/Gos-other.lo
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_12 = arm/Gos-linux.lo
@@ -297,18 +304,27 @@ am__libunwind_coredump_la_SOURCES_DIST = coredump/_UCD_accessors.c \
coredump/_UCD_create.c coredump/_UCD_destroy.c \
coredump/_UCD_access_mem.c coredump/_UCD_elf_map_image.c \
coredump/_UCD_find_proc_info.c coredump/_UCD_get_proc_name.c \
- coredump/_UPT_elf.c coredump/_UPT_access_fpreg.c \
+ coredump/_UCD_corefile_elf.c coredump/_UPT_elf.c \
+ coredump/_UPT_access_fpreg.c \
coredump/_UPT_get_dyn_info_list_addr.c \
coredump/_UPT_put_unwind_info.c coredump/_UPT_resume.c \
coredump/_UCD_access_reg_linux.c \
- coredump/_UCD_access_reg_freebsd.c
-@OS_LINUX_TRUE@am__objects_14 = coredump/_UCD_access_reg_linux.lo
-@OS_FREEBSD_TRUE@am__objects_15 = coredump/_UCD_access_reg_freebsd.lo
+ coredump/_UCD_get_threadinfo_prstatus.c \
+ coredump/_UCD_get_mapinfo_linux.c \
+ coredump/_UCD_access_reg_freebsd.c \
+ coredump/_UCD_get_mapinfo_generic.c
+@OS_LINUX_TRUE@am__objects_14 = coredump/_UCD_access_reg_linux.lo \
+@OS_LINUX_TRUE@ coredump/_UCD_get_threadinfo_prstatus.lo \
+@OS_LINUX_TRUE@ coredump/_UCD_get_mapinfo_linux.lo
+@OS_FREEBSD_TRUE@am__objects_15 = coredump/_UCD_access_reg_freebsd.lo \
+@OS_FREEBSD_TRUE@ coredump/_UCD_get_threadinfo_prstatus.lo \
+@OS_FREEBSD_TRUE@ coredump/_UCD_get_mapinfo_generic.lo
am_libunwind_coredump_la_OBJECTS = coredump/_UCD_accessors.lo \
coredump/_UCD_create.lo coredump/_UCD_destroy.lo \
coredump/_UCD_access_mem.lo coredump/_UCD_elf_map_image.lo \
coredump/_UCD_find_proc_info.lo coredump/_UCD_get_proc_name.lo \
- coredump/_UPT_elf.lo coredump/_UPT_access_fpreg.lo \
+ coredump/_UCD_corefile_elf.lo coredump/_UPT_elf.lo \
+ coredump/_UPT_access_fpreg.lo \
coredump/_UPT_get_dyn_info_list_addr.lo \
coredump/_UPT_put_unwind_info.lo coredump/_UPT_resume.lo \
$(am__objects_14) $(am__objects_15)
@@ -358,18 +374,19 @@ libunwind_elfxx_la_OBJECTS = $(am_libunwind_elfxx_la_OBJECTS)
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@ libunwind-elf32.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@ $(am__DEPENDENCIES_4)
am__libunwind_hppa_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c hppa/regname.c mi/Gdyn-extract.c \
- mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
- mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
- mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
- mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
- mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
- mi/Gset_cache_size.c hppa/Gapply_reg_state.c \
- hppa/Greg_states_iterate.c hppa/Gcreate_addr_space.c \
- hppa/Gget_save_loc.c hppa/Gglobal.c hppa/Ginit.c \
- hppa/Ginit_local.c hppa/Ginit_remote.c hppa/Gis_signal_frame.c \
- hppa/Gget_proc_info.c hppa/Gregs.c hppa/Gresume.c hppa/Gstep.c
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c hppa/regname.c \
+ mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ hppa/Gapply_reg_state.c hppa/Greg_states_iterate.c \
+ hppa/Gcreate_addr_space.c hppa/Gget_save_loc.c hppa/Gglobal.c \
+ hppa/Ginit.c hppa/Ginit_local.c hppa/Ginit_remote.c \
+ hppa/Gis_signal_frame.c hppa/Gget_proc_info.c hppa/Gregs.c \
+ hppa/Gresume.c hppa/Gstep.c
am__objects_16 = $(am__objects_7) hppa/regname.lo
am__objects_17 = $(am__objects_16) $(am__objects_9) \
hppa/Gapply_reg_state.lo hppa/Greg_states_iterate.lo \
@@ -390,20 +407,21 @@ libunwind_hppa_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@libunwind_ia64_la_DEPENDENCIES = libunwind-elf64.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@ $(am__DEPENDENCIES_5)
am__libunwind_ia64_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c ia64/regname.c mi/Gdyn-extract.c \
- mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
- mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
- mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
- mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
- mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
- mi/Gset_cache_size.c ia64/Gapply_reg_state.c \
- ia64/Greg_states_iterate.c ia64/Gcreate_addr_space.c \
- ia64/Gget_proc_info.c ia64/Gget_save_loc.c ia64/Gglobal.c \
- ia64/Ginit.c ia64/Ginit_local.c ia64/Ginit_remote.c \
- ia64/Ginstall_cursor.S ia64/Gis_signal_frame.c ia64/Gparser.c \
- ia64/Grbs.c ia64/Gregs.c ia64/Gresume.c ia64/Gscript.c \
- ia64/Gstep.c ia64/Gtables.c ia64/Gfind_unwind_table.c
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c ia64/regname.c \
+ mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ ia64/Gapply_reg_state.c ia64/Greg_states_iterate.c \
+ ia64/Gcreate_addr_space.c ia64/Gget_proc_info.c \
+ ia64/Gget_save_loc.c ia64/Gglobal.c ia64/Ginit.c \
+ ia64/Ginit_local.c ia64/Ginit_remote.c ia64/Ginstall_cursor.S \
+ ia64/Gis_signal_frame.c ia64/Gparser.c ia64/Grbs.c \
+ ia64/Gregs.c ia64/Gresume.c ia64/Gscript.c ia64/Gstep.c \
+ ia64/Gtables.c ia64/Gfind_unwind_table.c
am__objects_18 = $(am__objects_7) ia64/regname.lo
am__objects_19 = $(am__objects_18) $(am__objects_9) \
ia64/Gapply_reg_state.lo ia64/Greg_states_iterate.lo \
@@ -428,19 +446,19 @@ libunwind_ia64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@ libunwind-elfxx.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@ $(am__DEPENDENCIES_6)
am__libunwind_mips_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c mips/is_fpreg.c mips/regname.c mi/Gdyn-extract.c \
- mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
- mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
- mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
- mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
- mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
- mi/Gset_cache_size.c mips/Gapply_reg_state.c \
- mips/Greg_states_iterate.c mips/Gcreate_addr_space.c \
- mips/Gget_proc_info.c mips/Gget_save_loc.c mips/Gglobal.c \
- mips/Ginit.c mips/Ginit_local.c mips/Ginit_remote.c \
- mips/Gis_signal_frame.c mips/Gregs.c mips/Gresume.c \
- mips/Gstep.c
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c mips/is_fpreg.c \
+ mips/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ mips/Gapply_reg_state.c mips/Greg_states_iterate.c \
+ mips/Gcreate_addr_space.c mips/Gget_proc_info.c \
+ mips/Gget_save_loc.c mips/Gglobal.c mips/Ginit.c \
+ mips/Ginit_local.c mips/Ginit_remote.c mips/Gis_signal_frame.c \
+ mips/Gregs.c mips/Gresume.c mips/Gstep.c
am__objects_20 = $(am__objects_7) mips/is_fpreg.lo mips/regname.lo
am__objects_21 = $(am__objects_20) $(am__objects_9) \
mips/Gapply_reg_state.lo mips/Greg_states_iterate.lo \
@@ -457,21 +475,21 @@ libunwind_mips_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-o $@
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@am_libunwind_mips_la_rpath = -rpath \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@ $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_7 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_7)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_7 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_7)
am__libunwind_ppc32_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c ppc32/is_fpreg.c ppc32/regname.c \
- ppc32/get_func_addr.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
- mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
- mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
- mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
- mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
- mi/Gset_caching_policy.c mi/Gset_cache_size.c \
- ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c \
- ppc/Ginit_remote.c ppc/Gis_signal_frame.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c ppc32/is_fpreg.c \
+ ppc32/regname.c ppc32/get_func_addr.c mi/Gdyn-extract.c \
+ mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
+ mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
+ mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
+ mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
+ mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
+ mi/Gset_cache_size.c ppc/Gget_proc_info.c ppc/Gget_save_loc.c \
+ ppc/Ginit_local.c ppc/Ginit_remote.c ppc/Gis_signal_frame.c \
ppc32/Gapply_reg_state.c ppc32/Greg_states_iterate.c \
ppc32/Gcreate_addr_space.c ppc32/Gglobal.c ppc32/Ginit.c \
ppc32/Gregs.c ppc32/Gresume.c ppc32/Gstep.c
@@ -483,29 +501,29 @@ am__objects_24 = $(am__objects_22) $(am__objects_9) $(am__objects_23) \
ppc32/Gapply_reg_state.lo ppc32/Greg_states_iterate.lo \
ppc32/Gcreate_addr_space.lo ppc32/Gglobal.lo ppc32/Ginit.lo \
ppc32/Gregs.lo ppc32/Gresume.lo ppc32/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc32_la_OBJECTS = $(am__objects_24)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc32_la_OBJECTS = $(am__objects_24)
libunwind_ppc32_la_OBJECTS = $(am_libunwind_ppc32_la_OBJECTS)
libunwind_ppc32_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_ppc32_la_LDFLAGS) \
$(LDFLAGS) -o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc32_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_8 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_8)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc32_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_8 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_8)
am__libunwind_ppc64_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c ppc64/is_fpreg.c ppc64/regname.c \
- ppc64/get_func_addr.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
- mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
- mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
- mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
- mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
- mi/Gset_caching_policy.c mi/Gset_cache_size.c \
- ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c \
- ppc/Ginit_remote.c ppc/Gis_signal_frame.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c ppc64/is_fpreg.c \
+ ppc64/regname.c ppc64/get_func_addr.c mi/Gdyn-extract.c \
+ mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
+ mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
+ mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
+ mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
+ mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
+ mi/Gset_cache_size.c ppc/Gget_proc_info.c ppc/Gget_save_loc.c \
+ ppc/Ginit_local.c ppc/Ginit_remote.c ppc/Gis_signal_frame.c \
ppc64/Gapply_reg_state.c ppc64/Greg_states_iterate.c \
ppc64/Gcreate_addr_space.c ppc64/Gglobal.c ppc64/Ginit.c \
ppc64/Gregs.c ppc64/Gresume.c ppc64/Gstep.c
@@ -515,14 +533,14 @@ am__objects_26 = $(am__objects_25) $(am__objects_9) $(am__objects_23) \
ppc64/Gapply_reg_state.lo ppc64/Greg_states_iterate.lo \
ppc64/Gcreate_addr_space.lo ppc64/Gglobal.lo ppc64/Ginit.lo \
ppc64/Gregs.lo ppc64/Gresume.lo ppc64/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc64_la_OBJECTS = $(am__objects_26)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc64_la_OBJECTS = $(am__objects_26)
libunwind_ppc64_la_OBJECTS = $(am_libunwind_ppc64_la_OBJECTS)
libunwind_ppc64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_ppc64_la_LDFLAGS) \
$(LDFLAGS) -o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc64_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_ppc64_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
libunwind_ptrace_la_LIBADD =
am_libunwind_ptrace_la_OBJECTS = ptrace/_UPT_elf.lo \
ptrace/_UPT_accessors.lo ptrace/_UPT_access_fpreg.lo \
@@ -535,14 +553,49 @@ am_libunwind_ptrace_la_OBJECTS = ptrace/_UPT_elf.lo \
libunwind_ptrace_la_OBJECTS = $(am_libunwind_ptrace_la_OBJECTS)
@BUILD_PTRACE_TRUE@@REMOTE_ONLY_FALSE@am_libunwind_ptrace_la_rpath = \
@BUILD_PTRACE_TRUE@@REMOTE_ONLY_FALSE@ -rpath $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_9 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_9)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_9 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@libunwind_riscv_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@ $(am__DEPENDENCIES_9)
+am__libunwind_riscv_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c riscv/is_fpreg.c \
+ riscv/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ riscv/Gapply_reg_state.c riscv/Greg_states_iterate.c \
+ riscv/Gcreate_addr_space.c riscv/Gget_proc_info.c \
+ riscv/Gget_save_loc.c riscv/Gglobal.c riscv/Ginit.c \
+ riscv/Ginit_local.c riscv/Ginit_remote.c \
+ riscv/Gis_signal_frame.c riscv/Gregs.c riscv/Gresume.c \
+ riscv/Gstep.c
+am__objects_27 = $(am__objects_7) riscv/is_fpreg.lo riscv/regname.lo
+am__objects_28 = $(am__objects_27) $(am__objects_9) \
+ riscv/Gapply_reg_state.lo riscv/Greg_states_iterate.lo \
+ riscv/Gcreate_addr_space.lo riscv/Gget_proc_info.lo \
+ riscv/Gget_save_loc.lo riscv/Gglobal.lo riscv/Ginit.lo \
+ riscv/Ginit_local.lo riscv/Ginit_remote.lo \
+ riscv/Gis_signal_frame.lo riscv/Gregs.lo riscv/Gresume.lo \
+ riscv/Gstep.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am_libunwind_riscv_la_OBJECTS = $(am__objects_28)
+libunwind_riscv_la_OBJECTS = $(am_libunwind_riscv_la_OBJECTS)
+libunwind_riscv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libunwind_riscv_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am_libunwind_riscv_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_10 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_10)
am__libunwind_s390x_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c s390x/is_fpreg.c s390x/regname.c \
- mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c s390x/is_fpreg.c \
+ s390x/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
@@ -553,99 +606,101 @@ am__libunwind_s390x_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
s390x/Gglobal.c s390x/Ginit.c s390x/Ginit_local.c \
s390x/Ginit_remote.c s390x/Gget_proc_info.c s390x/Gregs.c \
s390x/Gresume.c s390x/Gis_signal_frame.c s390x/Gstep.c
-am__objects_27 = $(am__objects_7) s390x/is_fpreg.lo s390x/regname.lo
-am__objects_28 = $(am__objects_27) $(am__objects_9) \
+am__objects_29 = $(am__objects_7) s390x/is_fpreg.lo s390x/regname.lo
+am__objects_30 = $(am__objects_29) $(am__objects_9) \
s390x/Gapply_reg_state.lo s390x/Greg_states_iterate.lo \
s390x/Gcreate_addr_space.lo s390x/Gget_save_loc.lo \
s390x/Gglobal.lo s390x/Ginit.lo s390x/Ginit_local.lo \
s390x/Ginit_remote.lo s390x/Gget_proc_info.lo s390x/Gregs.lo \
s390x/Gresume.lo s390x/Gis_signal_frame.lo s390x/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_s390x_la_OBJECTS = $(am__objects_28)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_s390x_la_OBJECTS = $(am__objects_30)
libunwind_s390x_la_OBJECTS = $(am_libunwind_s390x_la_OBJECTS)
libunwind_s390x_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_s390x_la_LDFLAGS) \
$(LDFLAGS) -o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_s390x_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_s390x_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
libunwind_setjmp_la_DEPENDENCIES = $(LIBUNWIND_ELF) \
libunwind-$(arch).la libunwind.la
am__libunwind_setjmp_la_SOURCES_DIST = setjmp/longjmp.c \
setjmp/siglongjmp.c aarch64/siglongjmp.S arm/siglongjmp.S \
ia64/setjmp.S ia64/sigsetjmp.S ia64/longjmp.S \
ia64/siglongjmp.S hppa/siglongjmp.S mips/siglongjmp.S \
- tilegx/siglongjmp.S x86/longjmp.S x86/siglongjmp.S \
- x86_64/longjmp.S x86_64/siglongjmp.S ppc/longjmp.S \
- ppc/siglongjmp.S sh/siglongjmp.S
-@ARCH_AARCH64_TRUE@am__objects_29 = aarch64/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@am__objects_30 = arm/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@am__objects_31 = ia64/setjmp.lo \
+ tilegx/siglongjmp.S riscv/siglongjmp.S x86/longjmp.S \
+ x86/siglongjmp.S x86_64/longjmp.S x86_64/siglongjmp.S \
+ ppc/longjmp.S ppc/siglongjmp.S sh/siglongjmp.S
+@ARCH_AARCH64_TRUE@am__objects_31 = aarch64/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@am__objects_32 = arm/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@am__objects_33 = ia64/setjmp.lo \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@ ia64/sigsetjmp.lo \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@ ia64/longjmp.lo \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@ ia64/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@am__objects_32 = hppa/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@am__objects_33 = mips/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am__objects_34 = tilegx/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__objects_35 = x86/longjmp.lo \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ x86/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__objects_36 = x86_64/longjmp.lo \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ x86_64/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_37 = ppc/longjmp.lo \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ ppc/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_38 = ppc/longjmp.lo \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ ppc/siglongjmp.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_39 = sh/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@am__objects_34 = hppa/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@am__objects_35 = mips/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am__objects_36 = tilegx/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am__objects_37 = riscv/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am__objects_38 = x86/longjmp.lo \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ x86/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am__objects_39 = x86_64/longjmp.lo \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ x86_64/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_40 = ppc/longjmp.lo \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ ppc/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_41 = ppc/longjmp.lo \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ ppc/siglongjmp.lo
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__objects_42 = sh/siglongjmp.lo
am_libunwind_setjmp_la_OBJECTS = setjmp/longjmp.lo \
- setjmp/siglongjmp.lo $(am__objects_29) $(am__objects_30) \
- $(am__objects_31) $(am__objects_32) $(am__objects_33) \
- $(am__objects_34) $(am__objects_35) $(am__objects_36) \
- $(am__objects_37) $(am__objects_38) $(am__objects_39)
+ setjmp/siglongjmp.lo $(am__objects_31) $(am__objects_32) \
+ $(am__objects_33) $(am__objects_34) $(am__objects_35) \
+ $(am__objects_36) $(am__objects_37) $(am__objects_38) \
+ $(am__objects_39) $(am__objects_40) $(am__objects_41) \
+ $(am__objects_42)
libunwind_setjmp_la_OBJECTS = $(am_libunwind_setjmp_la_OBJECTS)
libunwind_setjmp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_setjmp_la_LDFLAGS) \
$(LDFLAGS) -o $@
@BUILD_SETJMP_TRUE@am_libunwind_setjmp_la_rpath = -rpath $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_10 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_10)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_11 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_11)
am__libunwind_sh_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c sh/is_fpreg.c sh/regname.c mi/Gdyn-extract.c \
- mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
- mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \
- mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \
- mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \
- mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \
- mi/Gset_cache_size.c sh/Gapply_reg_state.c \
- sh/Greg_states_iterate.c sh/Gcreate_addr_space.c \
- sh/Gget_proc_info.c sh/Gget_save_loc.c sh/Gglobal.c sh/Ginit.c \
- sh/Ginit_local.c sh/Ginit_remote.c sh/Gis_signal_frame.c \
- sh/Gregs.c sh/Gresume.c sh/Gstep.c
-am__objects_40 = $(am__objects_7) sh/is_fpreg.lo sh/regname.lo
-am__objects_41 = $(am__objects_40) $(am__objects_9) \
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c sh/is_fpreg.c \
+ sh/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c mi/Gset_cache_size.c \
+ sh/Gapply_reg_state.c sh/Greg_states_iterate.c \
+ sh/Gcreate_addr_space.c sh/Gget_proc_info.c sh/Gget_save_loc.c \
+ sh/Gglobal.c sh/Ginit.c sh/Ginit_local.c sh/Ginit_remote.c \
+ sh/Gis_signal_frame.c sh/Gregs.c sh/Gresume.c sh/Gstep.c
+am__objects_43 = $(am__objects_7) sh/is_fpreg.lo sh/regname.lo
+am__objects_44 = $(am__objects_43) $(am__objects_9) \
sh/Gapply_reg_state.lo sh/Greg_states_iterate.lo \
sh/Gcreate_addr_space.lo sh/Gget_proc_info.lo \
sh/Gget_save_loc.lo sh/Gglobal.lo sh/Ginit.lo \
sh/Ginit_local.lo sh/Ginit_remote.lo sh/Gis_signal_frame.lo \
sh/Gregs.lo sh/Gresume.lo sh/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_sh_la_OBJECTS = $(am__objects_41)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_sh_la_OBJECTS = $(am__objects_44)
libunwind_sh_la_OBJECTS = $(am_libunwind_sh_la_OBJECTS)
libunwind_sh_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_sh_la_LDFLAGS) $(LDFLAGS) \
-o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_sh_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_11 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_sh_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_12 = libunwind.la
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@libunwind_tilegx_la_DEPENDENCIES = libunwind-dwarf-generic.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ libunwind-elfxx.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ $(am__DEPENDENCIES_11)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ $(am__DEPENDENCIES_12)
am__libunwind_tilegx_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c tilegx/is_fpreg.c tilegx/regname.c \
- mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c tilegx/is_fpreg.c \
+ tilegx/regname.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
@@ -657,15 +712,15 @@ am__libunwind_tilegx_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
tilegx/Ginit_local.c tilegx/Ginit_remote.c \
tilegx/Gis_signal_frame.c tilegx/Gregs.c tilegx/Gresume.c \
tilegx/Gstep.c
-am__objects_42 = $(am__objects_7) tilegx/is_fpreg.lo tilegx/regname.lo
-am__objects_43 = $(am__objects_42) $(am__objects_9) \
+am__objects_45 = $(am__objects_7) tilegx/is_fpreg.lo tilegx/regname.lo
+am__objects_46 = $(am__objects_45) $(am__objects_9) \
tilegx/Gapply_reg_state.lo tilegx/Greg_states_iterate.lo \
tilegx/Gcreate_addr_space.lo tilegx/Gget_proc_info.lo \
tilegx/Gget_save_loc.lo tilegx/Gglobal.lo tilegx/Ginit.lo \
tilegx/Ginit_local.lo tilegx/Ginit_remote.lo \
tilegx/Gis_signal_frame.lo tilegx/Gregs.lo tilegx/Gresume.lo \
tilegx/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am_libunwind_tilegx_la_OBJECTS = $(am__objects_43)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am_libunwind_tilegx_la_OBJECTS = $(am__objects_46)
libunwind_tilegx_la_OBJECTS = $(am_libunwind_tilegx_la_OBJECTS)
libunwind_tilegx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
@@ -673,14 +728,15 @@ libunwind_tilegx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(LDFLAGS) -o $@
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am_libunwind_tilegx_la_rpath = -rpath \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_12 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__DEPENDENCIES_12)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_13 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__DEPENDENCIES_13)
am__libunwind_x86_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c x86/is_fpreg.c x86/regname.c x86/Gos-freebsd.c \
- x86/Gos-linux.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c x86/is_fpreg.c \
+ x86/regname.c x86/Gos-freebsd.c x86/Gos-linux.c \
+ mi/Gdyn-extract.c mi/Gdyn-remote.c \
mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
@@ -690,31 +746,31 @@ am__libunwind_x86_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
x86/Gcreate_addr_space.c x86/Gget_save_loc.c x86/Gglobal.c \
x86/Ginit.c x86/Ginit_local.c x86/Ginit_remote.c \
x86/Gget_proc_info.c x86/Gregs.c x86/Gresume.c x86/Gstep.c
-am__objects_44 = $(am__objects_7) x86/is_fpreg.lo x86/regname.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_45 = x86/Gos-linux.lo
-@OS_FREEBSD_TRUE@am__objects_45 = x86/Gos-freebsd.lo
-am__objects_46 = $(am__objects_44) $(am__objects_45) $(am__objects_9) \
+am__objects_47 = $(am__objects_7) x86/is_fpreg.lo x86/regname.lo
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_48 = x86/Gos-linux.lo
+@OS_FREEBSD_TRUE@am__objects_48 = x86/Gos-freebsd.lo
+am__objects_49 = $(am__objects_47) $(am__objects_48) $(am__objects_9) \
x86/Gapply_reg_state.lo x86/Greg_states_iterate.lo \
x86/Gcreate_addr_space.lo x86/Gget_save_loc.lo x86/Gglobal.lo \
x86/Ginit.lo x86/Ginit_local.lo x86/Ginit_remote.lo \
x86/Gget_proc_info.lo x86/Gregs.lo x86/Gresume.lo x86/Gstep.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_x86_la_OBJECTS = $(am__objects_46)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_x86_la_OBJECTS = $(am__objects_49)
libunwind_x86_la_OBJECTS = $(am_libunwind_x86_la_OBJECTS)
libunwind_x86_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_x86_la_LDFLAGS) $(LDFLAGS) \
-o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_x86_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(libdir)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_13 = libunwind.la
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_DEPENDENCIES = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_13)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_x86_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_14 = libunwind.la
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_DEPENDENCIES = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(am__DEPENDENCIES_14)
am__libunwind_x86_64_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
- os-linux.c os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c \
- mi/mempool.c mi/strerror.c x86_64/is_fpreg.c x86_64/regname.c \
- x86_64/Gos-freebsd.c x86_64/Gos-linux.c x86_64/Gos-solaris.c \
- mi/Gdyn-extract.c mi/Gdyn-remote.c \
+ os-linux.c dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c x86_64/is_fpreg.c \
+ x86_64/regname.c x86_64/Gos-freebsd.c x86_64/Gos-linux.c \
+ x86_64/Gos-solaris.c mi/Gdyn-extract.c mi/Gdyn-remote.c \
mi/Gfind_dynamic_proc_info.c mi/Gget_accessors.c \
mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
@@ -726,46 +782,46 @@ am__libunwind_x86_64_la_SOURCES_DIST = os-freebsd.c os-hpux.c \
x86_64/Ginit_remote.c x86_64/Gget_proc_info.c x86_64/Gregs.c \
x86_64/Gresume.c x86_64/Gstash_frame.c x86_64/Gstep.c \
x86_64/Gtrace.c
-am__objects_47 = $(am__objects_7) x86_64/is_fpreg.lo x86_64/regname.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_SOLARIS_TRUE@am__objects_48 = x86_64/Gos-solaris.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_48 = x86_64/Gos-linux.lo
-@OS_FREEBSD_TRUE@am__objects_48 = x86_64/Gos-freebsd.lo
-am__objects_49 = $(am__objects_47) $(am__objects_48) $(am__objects_9) \
+am__objects_50 = $(am__objects_7) x86_64/is_fpreg.lo x86_64/regname.lo
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_SOLARIS_TRUE@am__objects_51 = x86_64/Gos-solaris.lo
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_51 = x86_64/Gos-linux.lo
+@OS_FREEBSD_TRUE@am__objects_51 = x86_64/Gos-freebsd.lo
+am__objects_52 = $(am__objects_50) $(am__objects_51) $(am__objects_9) \
x86_64/Gapply_reg_state.lo x86_64/Greg_states_iterate.lo \
x86_64/Gcreate_addr_space.lo x86_64/Gget_save_loc.lo \
x86_64/Gglobal.lo x86_64/Ginit.lo x86_64/Ginit_local.lo \
x86_64/Ginit_remote.lo x86_64/Gget_proc_info.lo \
x86_64/Gregs.lo x86_64/Gresume.lo x86_64/Gstash_frame.lo \
x86_64/Gstep.lo x86_64/Gtrace.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_x86_64_la_OBJECTS = $(am__objects_49)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_x86_64_la_OBJECTS = $(am__objects_52)
libunwind_x86_64_la_OBJECTS = $(am_libunwind_x86_64_la_OBJECTS)
libunwind_x86_64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libunwind_x86_64_la_LDFLAGS) \
$(LDFLAGS) -o $@
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_x86_64_la_rpath = -rpath \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(libdir)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_x86_64_la_rpath = -rpath \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(libdir)
libunwind_la_DEPENDENCIES = $(am__append_10) $(LIBUNWIND_ELF) \
$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_3) \
$(am__DEPENDENCIES_3)
am__libunwind_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
- os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \
- mi/strerror.c s390x/is_fpreg.c s390x/regname.c mi/_ReadULEB.c \
- mi/_ReadSLEB.c mi/backtrace.c mi/dyn-cancel.c \
- mi/dyn-info-list.c mi/dyn-register.c mi/Ldyn-extract.c \
- mi/Lfind_dynamic_proc_info.c mi/Lget_accessors.c \
- mi/Lget_proc_info_by_ip.c mi/Lget_proc_name.c \
- mi/Lput_dynamic_unwind_info.c mi/Ldestroy_addr_space.c \
- mi/Lget_reg.c mi/Lset_reg.c mi/Lget_fpreg.c mi/Lset_fpreg.c \
- mi/Lset_caching_policy.c mi/Lset_cache_size.c \
- unwind/Backtrace.c unwind/DeleteException.c \
- unwind/FindEnclosingFunction.c unwind/ForcedUnwind.c \
- unwind/GetBSP.c unwind/GetCFA.c unwind/GetDataRelBase.c \
- unwind/GetGR.c unwind/GetIP.c unwind/GetLanguageSpecificData.c \
- unwind/GetRegionStart.c unwind/GetTextRelBase.c \
- unwind/RaiseException.c unwind/Resume.c \
- unwind/Resume_or_Rethrow.c unwind/SetGR.c unwind/SetIP.c \
- unwind/GetIPInfo.c s390x/Lapply_reg_state.c \
+ dl-iterate-phdr.c os-qnx.c os-solaris.c mi/init.c \
+ mi/flush_cache.c mi/mempool.c mi/strerror.c s390x/is_fpreg.c \
+ s390x/regname.c mi/_ReadULEB.c mi/_ReadSLEB.c mi/backtrace.c \
+ mi/dyn-cancel.c mi/dyn-info-list.c mi/dyn-register.c \
+ mi/Ldyn-extract.c mi/Lfind_dynamic_proc_info.c \
+ mi/Lget_accessors.c mi/Lget_proc_info_by_ip.c \
+ mi/Lget_proc_name.c mi/Lput_dynamic_unwind_info.c \
+ mi/Ldestroy_addr_space.c mi/Lget_reg.c mi/Lset_reg.c \
+ mi/Lget_fpreg.c mi/Lset_fpreg.c mi/Lset_caching_policy.c \
+ mi/Lset_cache_size.c unwind/Backtrace.c \
+ unwind/DeleteException.c unwind/FindEnclosingFunction.c \
+ unwind/ForcedUnwind.c unwind/GetBSP.c unwind/GetCFA.c \
+ unwind/GetDataRelBase.c unwind/GetGR.c unwind/GetIP.c \
+ unwind/GetLanguageSpecificData.c unwind/GetRegionStart.c \
+ unwind/GetTextRelBase.c unwind/RaiseException.c \
+ unwind/Resume.c unwind/Resume_or_Rethrow.c unwind/SetGR.c \
+ unwind/SetIP.c unwind/GetIPInfo.c s390x/Lapply_reg_state.c \
s390x/Lreg_states_iterate.c s390x/Lcreate_addr_space.c \
s390x/Lget_save_loc.c s390x/Lglobal.c s390x/Linit.c \
s390x/Linit_local.c s390x/Linit_remote.c \
@@ -799,7 +855,13 @@ am__libunwind_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
x86/Lget_save_loc.c x86/Lglobal.c x86/Linit.c \
x86/Linit_local.c x86/Linit_remote.c x86/Lget_proc_info.c \
x86/Lregs.c x86/Lresume.c x86/Lstep.c x86/getcontext-freebsd.S \
- x86/getcontext-linux.S tilegx/is_fpreg.c tilegx/regname.c \
+ x86/getcontext-linux.S riscv/is_fpreg.c riscv/regname.c \
+ riscv/getcontext.S riscv/setcontext.S riscv/Lapply_reg_state.c \
+ riscv/Lreg_states_iterate.c riscv/Lcreate_addr_space.c \
+ riscv/Lget_proc_info.c riscv/Lget_save_loc.c riscv/Lglobal.c \
+ riscv/Linit.c riscv/Linit_local.c riscv/Linit_remote.c \
+ riscv/Lis_signal_frame.c riscv/Lregs.c riscv/Lresume.c \
+ riscv/Lstep.c tilegx/is_fpreg.c tilegx/regname.c \
tilegx/getcontext.S tilegx/Lapply_reg_state.c \
tilegx/Lreg_states_iterate.c tilegx/Lcreate_addr_space.c \
tilegx/Lget_proc_info.c tilegx/Lget_save_loc.c \
@@ -839,10 +901,10 @@ am__libunwind_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \
aarch64/Lis_signal_frame.c aarch64/Lregs.c aarch64/Lresume.c \
aarch64/Lstash_frame.c aarch64/Lstep.c aarch64/Ltrace.c \
aarch64/getcontext.S
-@SUPPORT_CXX_EXCEPTIONS_TRUE@am__objects_50 = mi/_ReadULEB.lo \
+@SUPPORT_CXX_EXCEPTIONS_TRUE@am__objects_53 = mi/_ReadULEB.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ mi/_ReadSLEB.lo
-@OS_LINUX_TRUE@am__objects_51 = $(am__objects_50)
-am__objects_52 = $(am__objects_51) mi/backtrace.lo mi/dyn-cancel.lo \
+@OS_LINUX_TRUE@am__objects_54 = $(am__objects_53)
+am__objects_55 = $(am__objects_54) mi/backtrace.lo mi/dyn-cancel.lo \
mi/dyn-info-list.lo mi/dyn-register.lo mi/Ldyn-extract.lo \
mi/Lfind_dynamic_proc_info.lo mi/Lget_accessors.lo \
mi/Lget_proc_info_by_ip.lo mi/Lget_proc_name.lo \
@@ -850,7 +912,7 @@ am__objects_52 = $(am__objects_51) mi/backtrace.lo mi/dyn-cancel.lo \
mi/Lget_reg.lo mi/Lset_reg.lo mi/Lget_fpreg.lo \
mi/Lset_fpreg.lo mi/Lset_caching_policy.lo \
mi/Lset_cache_size.lo
-@SUPPORT_CXX_EXCEPTIONS_TRUE@am__objects_53 = unwind/Backtrace.lo \
+@SUPPORT_CXX_EXCEPTIONS_TRUE@am__objects_56 = unwind/Backtrace.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/DeleteException.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/FindEnclosingFunction.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/ForcedUnwind.lo \
@@ -865,34 +927,34 @@ am__objects_52 = $(am__objects_51) mi/backtrace.lo mi/dyn-cancel.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/Resume_or_Rethrow.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/SetGR.lo unwind/SetIP.lo \
@SUPPORT_CXX_EXCEPTIONS_TRUE@ unwind/GetIPInfo.lo
-am__objects_54 = $(am__objects_52) $(am__objects_53)
-am__objects_55 = $(am__objects_27) $(am__objects_54) \
+am__objects_57 = $(am__objects_55) $(am__objects_56)
+am__objects_58 = $(am__objects_29) $(am__objects_57) \
s390x/Lapply_reg_state.lo s390x/Lreg_states_iterate.lo \
s390x/Lcreate_addr_space.lo s390x/Lget_save_loc.lo \
s390x/Lglobal.lo s390x/Linit.lo s390x/Linit_local.lo \
s390x/Linit_remote.lo s390x/Lget_proc_info.lo s390x/Lregs.lo \
s390x/Lresume.lo s390x/Lis_signal_frame.lo s390x/Lstep.lo \
s390x/getcontext.lo s390x/setcontext.lo
-am__objects_56 = $(am__objects_40) $(am__objects_54) \
+am__objects_59 = $(am__objects_43) $(am__objects_57) \
sh/Lapply_reg_state.lo sh/Lreg_states_iterate.lo \
sh/Lcreate_addr_space.lo sh/Lget_proc_info.lo \
sh/Lget_save_loc.lo sh/Lglobal.lo sh/Linit.lo \
sh/Linit_local.lo sh/Linit_remote.lo sh/Lis_signal_frame.lo \
sh/Lregs.lo sh/Lresume.lo sh/Lstep.lo
-am__objects_57 = ppc/Lget_proc_info.lo ppc/Lget_save_loc.lo \
+am__objects_60 = ppc/Lget_proc_info.lo ppc/Lget_save_loc.lo \
ppc/Linit_local.lo ppc/Linit_remote.lo ppc/Lis_signal_frame.lo
-am__objects_58 = $(am__objects_25) $(am__objects_54) $(am__objects_57) \
+am__objects_61 = $(am__objects_25) $(am__objects_57) $(am__objects_60) \
ppc64/Lapply_reg_state.lo ppc64/Lreg_states_iterate.lo \
ppc64/Lcreate_addr_space.lo ppc64/Lglobal.lo ppc64/Linit.lo \
ppc64/Lregs.lo ppc64/Lresume.lo ppc64/Lstep.lo
-am__objects_59 = $(am__objects_22) $(am__objects_54) $(am__objects_57) \
+am__objects_62 = $(am__objects_22) $(am__objects_57) $(am__objects_60) \
ppc32/Lapply_reg_state.lo ppc32/Lreg_states_iterate.lo \
ppc32/Lcreate_addr_space.lo ppc32/Lglobal.lo ppc32/Linit.lo \
ppc32/Lregs.lo ppc32/Lresume.lo ppc32/Lstep.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_SOLARIS_TRUE@am__objects_60 = x86_64/Los-solaris.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_60 = x86_64/Los-linux.lo
-@OS_FREEBSD_TRUE@am__objects_60 = x86_64/Los-freebsd.lo
-am__objects_61 = $(am__objects_47) $(am__objects_60) $(am__objects_54) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_SOLARIS_TRUE@am__objects_63 = x86_64/Los-solaris.lo
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_63 = x86_64/Los-linux.lo
+@OS_FREEBSD_TRUE@am__objects_63 = x86_64/Los-freebsd.lo
+am__objects_64 = $(am__objects_50) $(am__objects_63) $(am__objects_57) \
x86_64/setcontext.lo x86_64/Lapply_reg_state.lo \
x86_64/Lreg_states_iterate.lo x86_64/Lcreate_addr_space.lo \
x86_64/Lget_save_loc.lo x86_64/Lglobal.lo x86_64/Linit.lo \
@@ -900,38 +962,46 @@ am__objects_61 = $(am__objects_47) $(am__objects_60) $(am__objects_54) \
x86_64/Lget_proc_info.lo x86_64/Lregs.lo x86_64/Lresume.lo \
x86_64/Lstash_frame.lo x86_64/Lstep.lo x86_64/Ltrace.lo \
x86_64/getcontext.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_62 = x86/Los-linux.lo
-@OS_FREEBSD_TRUE@am__objects_62 = x86/Los-freebsd.lo
-am__objects_63 = $(am__objects_44) $(am__objects_62) $(am__objects_54) \
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_65 = x86/Los-linux.lo
+@OS_FREEBSD_TRUE@am__objects_65 = x86/Los-freebsd.lo
+am__objects_66 = $(am__objects_47) $(am__objects_65) $(am__objects_57) \
x86/Lapply_reg_state.lo x86/Lreg_states_iterate.lo \
x86/Lcreate_addr_space.lo x86/Lget_save_loc.lo x86/Lglobal.lo \
x86/Linit.lo x86/Linit_local.lo x86/Linit_remote.lo \
x86/Lget_proc_info.lo x86/Lregs.lo x86/Lresume.lo x86/Lstep.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_64 = \
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_67 = \
@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@ x86/getcontext-linux.lo
-@OS_FREEBSD_TRUE@am__objects_64 = x86/getcontext-freebsd.lo
-am__objects_65 = $(am__objects_42) $(am__objects_54) \
+@OS_FREEBSD_TRUE@am__objects_67 = x86/getcontext-freebsd.lo
+am__objects_68 = $(am__objects_27) $(am__objects_57) \
+ riscv/getcontext.lo riscv/setcontext.lo \
+ riscv/Lapply_reg_state.lo riscv/Lreg_states_iterate.lo \
+ riscv/Lcreate_addr_space.lo riscv/Lget_proc_info.lo \
+ riscv/Lget_save_loc.lo riscv/Lglobal.lo riscv/Linit.lo \
+ riscv/Linit_local.lo riscv/Linit_remote.lo \
+ riscv/Lis_signal_frame.lo riscv/Lregs.lo riscv/Lresume.lo \
+ riscv/Lstep.lo
+am__objects_69 = $(am__objects_45) $(am__objects_57) \
tilegx/getcontext.lo tilegx/Lapply_reg_state.lo \
tilegx/Lreg_states_iterate.lo tilegx/Lcreate_addr_space.lo \
tilegx/Lget_proc_info.lo tilegx/Lget_save_loc.lo \
tilegx/Lglobal.lo tilegx/Linit.lo tilegx/Linit_local.lo \
tilegx/Linit_remote.lo tilegx/Lis_signal_frame.lo \
tilegx/Lregs.lo tilegx/Lresume.lo tilegx/Lstep.lo
-am__objects_66 = $(am__objects_20) $(am__objects_54) \
+am__objects_70 = $(am__objects_20) $(am__objects_57) \
mips/getcontext.lo mips/Lapply_reg_state.lo \
mips/Lreg_states_iterate.lo mips/Lcreate_addr_space.lo \
mips/Lget_proc_info.lo mips/Lget_save_loc.lo mips/Lglobal.lo \
mips/Linit.lo mips/Linit_local.lo mips/Linit_remote.lo \
mips/Lis_signal_frame.lo mips/Lregs.lo mips/Lresume.lo \
mips/Lstep.lo
-am__objects_67 = $(am__objects_16) $(am__objects_54) \
+am__objects_71 = $(am__objects_16) $(am__objects_57) \
hppa/getcontext.lo hppa/setcontext.lo hppa/Lapply_reg_state.lo \
hppa/Lreg_states_iterate.lo hppa/Lcreate_addr_space.lo \
hppa/Lget_save_loc.lo hppa/Lglobal.lo hppa/Linit.lo \
hppa/Linit_local.lo hppa/Linit_remote.lo \
hppa/Lis_signal_frame.lo hppa/Lget_proc_info.lo hppa/Lregs.lo \
hppa/Lresume.lo hppa/Lstep.lo
-am__objects_68 = $(am__objects_18) $(am__objects_54) \
+am__objects_72 = $(am__objects_18) $(am__objects_57) \
ia64/dyn_info_list.lo ia64/getcontext.lo \
ia64/Lapply_reg_state.lo ia64/Lreg_states_iterate.lo \
ia64/Lcreate_addr_space.lo ia64/Lget_proc_info.lo \
@@ -941,17 +1011,17 @@ am__objects_68 = $(am__objects_18) $(am__objects_54) \
ia64/Lparser.lo ia64/Lrbs.lo ia64/Lregs.lo ia64/Lresume.lo \
ia64/Lscript.lo ia64/Lstep.lo ia64/Ltables.lo \
ia64/Lfind_unwind_table.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_QNX_TRUE@am__objects_69 = arm/Los-other.lo
-@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_69 = arm/Los-linux.lo
-@OS_FREEBSD_TRUE@am__objects_69 = arm/Los-freebsd.lo
-am__objects_70 = $(am__objects_11) $(am__objects_69) $(am__objects_54) \
+@OS_FREEBSD_FALSE@@OS_LINUX_FALSE@@OS_QNX_TRUE@am__objects_73 = arm/Los-other.lo
+@OS_FREEBSD_FALSE@@OS_LINUX_TRUE@am__objects_73 = arm/Los-linux.lo
+@OS_FREEBSD_TRUE@am__objects_73 = arm/Los-freebsd.lo
+am__objects_74 = $(am__objects_11) $(am__objects_73) $(am__objects_57) \
arm/getcontext.lo arm/Lapply_reg_state.lo \
arm/Lreg_states_iterate.lo arm/Lcreate_addr_space.lo \
arm/Lget_proc_info.lo arm/Lget_save_loc.lo arm/Lglobal.lo \
arm/Linit.lo arm/Linit_local.lo arm/Linit_remote.lo \
arm/Lregs.lo arm/Lresume.lo arm/Lstep.lo arm/Lex_tables.lo \
arm/Lstash_frame.lo arm/Ltrace.lo
-am__objects_71 = $(am__objects_8) $(am__objects_54) \
+am__objects_75 = $(am__objects_8) $(am__objects_57) \
aarch64/Lapply_reg_state.lo aarch64/Lreg_states_iterate.lo \
aarch64/Lcreate_addr_space.lo aarch64/Lget_proc_info.lo \
aarch64/Lget_save_loc.lo aarch64/Lglobal.lo aarch64/Linit.lo \
@@ -959,20 +1029,21 @@ am__objects_71 = $(am__objects_8) $(am__objects_54) \
aarch64/Lis_signal_frame.lo aarch64/Lregs.lo \
aarch64/Lresume.lo aarch64/Lstash_frame.lo aarch64/Lstep.lo \
aarch64/Ltrace.lo aarch64/getcontext.lo
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_55)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_56)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_58)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_59)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_61)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_la_OBJECTS = $(am__objects_63) \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__objects_64)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am_libunwind_la_OBJECTS = $(am__objects_65)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@am_libunwind_la_OBJECTS = $(am__objects_66)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@am_libunwind_la_OBJECTS = $(am__objects_67)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_68)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_58)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_59)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_61)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_62)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@am_libunwind_la_OBJECTS = $(am__objects_64)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@am_libunwind_la_OBJECTS = $(am__objects_66) \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__objects_67)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@am_libunwind_la_OBJECTS = $(am__objects_68)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@am_libunwind_la_OBJECTS = $(am__objects_69)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@am_libunwind_la_OBJECTS = $(am__objects_70)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@am_libunwind_la_OBJECTS = $(am__objects_71)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_IA64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_72)
@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@am_libunwind_la_OBJECTS = \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@ $(am__objects_70)
-@ARCH_AARCH64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_71)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@ $(am__objects_74)
+@ARCH_AARCH64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_75)
libunwind_la_OBJECTS = $(am_libunwind_la_OBJECTS)
libunwind_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -1031,10 +1102,11 @@ SOURCES = $(libunwind_aarch64_la_SOURCES) $(libunwind_arm_la_SOURCES) \
$(libunwind_elfxx_la_SOURCES) $(libunwind_hppa_la_SOURCES) \
$(libunwind_ia64_la_SOURCES) $(libunwind_mips_la_SOURCES) \
$(libunwind_ppc32_la_SOURCES) $(libunwind_ppc64_la_SOURCES) \
- $(libunwind_ptrace_la_SOURCES) $(libunwind_s390x_la_SOURCES) \
- $(libunwind_setjmp_la_SOURCES) $(libunwind_sh_la_SOURCES) \
- $(libunwind_tilegx_la_SOURCES) $(libunwind_x86_la_SOURCES) \
- $(libunwind_x86_64_la_SOURCES) $(libunwind_la_SOURCES)
+ $(libunwind_ptrace_la_SOURCES) $(libunwind_riscv_la_SOURCES) \
+ $(libunwind_s390x_la_SOURCES) $(libunwind_setjmp_la_SOURCES) \
+ $(libunwind_sh_la_SOURCES) $(libunwind_tilegx_la_SOURCES) \
+ $(libunwind_x86_la_SOURCES) $(libunwind_x86_64_la_SOURCES) \
+ $(libunwind_la_SOURCES)
DIST_SOURCES = $(am__libunwind_aarch64_la_SOURCES_DIST) \
$(am__libunwind_arm_la_SOURCES_DIST) \
$(am__libunwind_coredump_la_SOURCES_DIST) \
@@ -1049,6 +1121,7 @@ DIST_SOURCES = $(am__libunwind_aarch64_la_SOURCES_DIST) \
$(am__libunwind_ppc32_la_SOURCES_DIST) \
$(am__libunwind_ppc64_la_SOURCES_DIST) \
$(libunwind_ptrace_la_SOURCES) \
+ $(am__libunwind_riscv_la_SOURCES_DIST) \
$(am__libunwind_s390x_la_SOURCES_DIST) \
$(am__libunwind_setjmp_la_SOURCES_DIST) \
$(am__libunwind_sh_la_SOURCES_DIST) \
@@ -1244,7 +1317,7 @@ lib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \
$(am__append_22) $(am__append_25) $(am__append_28) \
$(am__append_31) $(am__append_34) $(am__append_37) \
$(am__append_40) $(am__append_43) $(am__append_46) \
- $(am__append_48)
+ $(am__append_49) $(am__append_51)
# The list of files that go into libunwind and libunwind-aarch64:
@@ -1258,6 +1331,8 @@ lib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \
# The list of files that go info libunwind and libunwind-tilegx:
+# The list of files that go info libunwind and libunwind-riscv:
+
# The list of files that go both into libunwind and libunwind-x86:
# The list of files that go both into libunwind and libunwind-x86_64:
@@ -1277,12 +1352,14 @@ noinst_HEADERS = ptrace/_UPT_internal.h coredump/_UCD_internal.h \
ia64/unwind_decoder.h ia64/unwind_i.h hppa/init.h \
hppa/offsets.h hppa/unwind_i.h mips/init.h mips/offsets.h \
mips/unwind_i.h tilegx/init.h tilegx/offsets.h \
- tilegx/unwind_i.h x86/init.h x86/offsets.h x86/unwind_i.h \
- x86_64/offsets.h x86_64/init.h x86_64/unwind_i.h \
- x86_64/ucontext_i.h ppc32/init.h ppc32/unwind_i.h \
- ppc32/ucontext_i.h ppc64/init.h ppc64/unwind_i.h \
- ppc64/ucontext_i.h sh/init.h sh/offsets.h sh/unwind_i.h \
- s390x/init.h s390x/unwind_i.h unwind/unwind-internal.h
+ tilegx/unwind_i.h riscv/init.h riscv/offsets.h \
+ riscv/unwind_i.h riscv/asm.h x86/init.h x86/offsets.h \
+ x86/unwind_i.h x86_64/offsets.h x86_64/init.h \
+ x86_64/unwind_i.h x86_64/ucontext_i.h ppc32/init.h \
+ ppc32/unwind_i.h ppc32/ucontext_i.h ppc64/init.h \
+ ppc64/unwind_i.h ppc64/ucontext_i.h sh/init.h sh/offsets.h \
+ sh/unwind_i.h s390x/init.h s390x/unwind_i.h \
+ unwind/unwind-internal.h
noinst_LTLIBRARIES = $(am__append_8) $(am__append_9) $(LIBUNWIND_ELF)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libunwind-generic.pc $(am__append_4) $(am__append_5) \
@@ -1304,7 +1381,8 @@ libunwind_coredump_la_SOURCES = coredump/_UCD_accessors.c \
coredump/_UCD_create.c coredump/_UCD_destroy.c \
coredump/_UCD_access_mem.c coredump/_UCD_elf_map_image.c \
coredump/_UCD_find_proc_info.c coredump/_UCD_get_proc_name.c \
- coredump/_UPT_elf.c coredump/_UPT_access_fpreg.c \
+ coredump/_UCD_corefile_elf.c coredump/_UPT_elf.c \
+ coredump/_UPT_access_fpreg.c \
coredump/_UPT_get_dyn_info_list_addr.c \
coredump/_UPT_put_unwind_info.c coredump/_UPT_resume.c \
$(am__append_11) $(am__append_12)
@@ -1328,7 +1406,7 @@ libunwind_setjmp_la_SOURCES = setjmp/longjmp.c setjmp/siglongjmp.c \
$(am__append_15) $(am__append_18) $(am__append_21) \
$(am__append_24) $(am__append_27) $(am__append_30) \
$(am__append_33) $(am__append_36) $(am__append_39) \
- $(am__append_42) $(am__append_45)
+ $(am__append_42) $(am__append_45) $(am__append_48)
### libunwind:
libunwind_la_LIBADD = $(am__append_10) $(LIBUNWIND_ELF) -lc $(LIBCRTS) \
@@ -1384,7 +1462,7 @@ libunwind_la_SOURCES_local = \
$(libunwind_la_SOURCES_local_nounwind) \
$(libunwind_la_SOURCES_local_unwind)
-libunwind_la_SOURCES_os_linux = os-linux.c
+libunwind_la_SOURCES_os_linux = os-linux.c dl-iterate-phdr.c
libunwind_la_SOURCES_os_hpux = os-hpux.c
libunwind_la_SOURCES_os_freebsd = os-freebsd.c
libunwind_la_SOURCES_os_qnx = os-qnx.c
@@ -1461,6 +1539,9 @@ libunwind_arm_la_SOURCES_arm = $(libunwind_la_SOURCES_arm_common) \
libunwind_la_SOURCES_ia64_common = $(libunwind_la_SOURCES_common) \
ia64/regname.c
+libunwind_la_EXTRAS_ia64 = ia64/mk_cursor_i ia64/mk_Lcursor_i.c \
+ ia64/mk_Gcursor_i.c
+
# The list of files that go into libunwind:
libunwind_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \
@@ -1550,6 +1631,26 @@ libunwind_tilegx_la_SOURCES_tilegx = $(libunwind_la_SOURCES_tilegx_common) \
tilegx/Gglobal.c tilegx/Ginit.c tilegx/Ginit_local.c tilegx/Ginit_remote.c \
tilegx/Gis_signal_frame.c tilegx/Gregs.c tilegx/Gresume.c tilegx/Gstep.c
+libunwind_la_SOURCES_riscv_common = $(libunwind_la_SOURCES_common) \
+ riscv/is_fpreg.c riscv/regname.c
+
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_riscv = $(libunwind_la_SOURCES_riscv_common) \
+ $(libunwind_la_SOURCES_local) \
+ riscv/getcontext.S riscv/setcontext.S \
+ riscv/Lapply_reg_state.c riscv/Lreg_states_iterate.c \
+ riscv/Lcreate_addr_space.c riscv/Lget_proc_info.c riscv/Lget_save_loc.c \
+ riscv/Lglobal.c riscv/Linit.c riscv/Linit_local.c riscv/Linit_remote.c \
+ riscv/Lis_signal_frame.c riscv/Lregs.c riscv/Lresume.c riscv/Lstep.c
+
+libunwind_riscv_la_SOURCES_riscv = $(libunwind_la_SOURCES_riscv_common) \
+ $(libunwind_la_SOURCES_generic) \
+ riscv/Gapply_reg_state.c riscv/Greg_states_iterate.c \
+ riscv/Gcreate_addr_space.c riscv/Gget_proc_info.c riscv/Gget_save_loc.c \
+ riscv/Gglobal.c riscv/Ginit.c riscv/Ginit_local.c riscv/Ginit_remote.c \
+ riscv/Gis_signal_frame.c riscv/Gregs.c riscv/Gresume.c riscv/Gstep.c
+
libunwind_la_SOURCES_x86_common = $(libunwind_la_SOURCES_common) \
x86/is_fpreg.c x86/regname.c
@@ -1729,12 +1830,13 @@ libunwind_s390x_la_SOURCES_s390x = $(libunwind_la_SOURCES_s390x_common) \
@OS_FREEBSD_TRUE@libunwind_la_SOURCES_arm_os_local = arm/Los-freebsd.c
@OS_LINUX_TRUE@libunwind_la_SOURCES_arm_os_local = arm/Los-linux.c
@OS_QNX_TRUE@libunwind_la_SOURCES_arm_os_local = arm/Los-other.c
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_s390x)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_sh)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc64)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc32)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86_64)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86) $(libunwind_x86_la_SOURCES_os)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_s390x)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_sh)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc64)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc32)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86_64)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86) $(libunwind_x86_la_SOURCES_os)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_riscv)
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_tilegx)
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_TRUE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_mips)
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_TRUE@@ARCH_IA64_FALSE@libunwind_la_SOURCES = $(libunwind_la_SOURCES_hppa)
@@ -1772,36 +1874,41 @@ libunwind_s390x_la_SOURCES_s390x = $(libunwind_la_SOURCES_s390x_common) \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@libunwind_tilegx_la_LIBADD = libunwind-dwarf-generic.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ libunwind-elfxx.la \
@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_TRUE@ $(am__append_29)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_SOURCES = $(libunwind_x86_la_SOURCES_x86)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__append_32)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_SOURCES = $(libunwind_x86_64_la_SOURCES_x86_64)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(am__append_35)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_SOURCES = $(libunwind_ppc32_la_SOURCES_ppc32)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_38)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_SOURCES = $(libunwind_ppc64_la_SOURCES_ppc64)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_41)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_SOURCES = $(libunwind_sh_la_SOURCES_sh)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_44)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_SOURCES = $(libunwind_s390x_la_SOURCES_s390x)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_LIBADD = libunwind-dwarf-generic.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
-@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_47)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@libunwind_riscv_la_SOURCES = $(libunwind_riscv_la_SOURCES_riscv)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@libunwind_riscv_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@libunwind_riscv_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_TRUE@@ARCH_TILEGX_FALSE@ $(am__append_32)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_SOURCES = $(libunwind_x86_la_SOURCES_x86)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@libunwind_x86_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_TRUE@ $(am__append_35)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_SOURCES = $(libunwind_x86_64_la_SOURCES_x86_64)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@libunwind_x86_64_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_TRUE@@ARCH_X86_FALSE@ $(am__append_38)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_SOURCES = $(libunwind_ppc32_la_SOURCES_ppc32)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc32_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_41)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_SOURCES = $(libunwind_ppc64_la_SOURCES_ppc64)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_ppc64_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_TRUE@@ARCH_RISCV_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_44)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_SOURCES = $(libunwind_sh_la_SOURCES_sh)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sh_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf32.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_SH_TRUE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_47)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_SOURCES = $(libunwind_s390x_la_SOURCES_s390x)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_LIBADD = libunwind-dwarf-generic.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \
+@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_RISCV_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_50)
#
# Don't link with standard libraries, because those may mention
@@ -1816,6 +1923,7 @@ EXTRA_DIST = $(libunwind_la_SOURCES_aarch64) \
$(libunwind_la_SOURCES_arm) \
$(libunwind_la_SOURCES_hppa) \
$(libunwind_la_SOURCES_ia64) \
+ $(libunwind_la_EXTRAS_ia64) \
$(libunwind_la_SOURCES_mips) \
$(libunwind_la_SOURCES_sh) \
$(libunwind_la_SOURCES_x86) \
@@ -2076,6 +2184,8 @@ coredump/_UCD_find_proc_info.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
coredump/_UCD_get_proc_name.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
+coredump/_UCD_corefile_elf.lo: coredump/$(am__dirstamp) \
+ coredump/$(DEPDIR)/$(am__dirstamp)
coredump/_UPT_elf.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
coredump/_UPT_access_fpreg.lo: coredump/$(am__dirstamp) \
@@ -2088,8 +2198,14 @@ coredump/_UPT_resume.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
coredump/_UCD_access_reg_linux.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
+coredump/_UCD_get_threadinfo_prstatus.lo: coredump/$(am__dirstamp) \
+ coredump/$(DEPDIR)/$(am__dirstamp)
+coredump/_UCD_get_mapinfo_linux.lo: coredump/$(am__dirstamp) \
+ coredump/$(DEPDIR)/$(am__dirstamp)
coredump/_UCD_access_reg_freebsd.lo: coredump/$(am__dirstamp) \
coredump/$(DEPDIR)/$(am__dirstamp)
+coredump/_UCD_get_mapinfo_generic.lo: coredump/$(am__dirstamp) \
+ coredump/$(DEPDIR)/$(am__dirstamp)
libunwind-coredump.la: $(libunwind_coredump_la_OBJECTS) $(libunwind_coredump_la_DEPENDENCIES) $(EXTRA_libunwind_coredump_la_DEPENDENCIES)
$(AM_V_CCLD)$(libunwind_coredump_la_LINK) $(am_libunwind_coredump_la_rpath) $(libunwind_coredump_la_OBJECTS) $(libunwind_coredump_la_LIBADD) $(LIBS)
@@ -2343,6 +2459,42 @@ ptrace/_UPT_resume.lo: ptrace/$(am__dirstamp) \
libunwind-ptrace.la: $(libunwind_ptrace_la_OBJECTS) $(libunwind_ptrace_la_DEPENDENCIES) $(EXTRA_libunwind_ptrace_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(am_libunwind_ptrace_la_rpath) $(libunwind_ptrace_la_OBJECTS) $(libunwind_ptrace_la_LIBADD) $(LIBS)
+riscv/$(am__dirstamp):
+ @$(MKDIR_P) riscv
+ @: > riscv/$(am__dirstamp)
+riscv/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) riscv/$(DEPDIR)
+ @: > riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/is_fpreg.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/regname.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gapply_reg_state.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Greg_states_iterate.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gcreate_addr_space.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gget_proc_info.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gget_save_loc.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gglobal.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Ginit.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Ginit_local.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Ginit_remote.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gis_signal_frame.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gregs.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gresume.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Gstep.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
+
+libunwind-riscv.la: $(libunwind_riscv_la_OBJECTS) $(libunwind_riscv_la_DEPENDENCIES) $(EXTRA_libunwind_riscv_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libunwind_riscv_la_LINK) $(am_libunwind_riscv_la_rpath) $(libunwind_riscv_la_OBJECTS) $(libunwind_riscv_la_LIBADD) $(LIBS)
s390x/$(am__dirstamp):
@$(MKDIR_P) s390x
@: > s390x/$(am__dirstamp)
@@ -2409,6 +2561,8 @@ tilegx/$(DEPDIR)/$(am__dirstamp):
@: > tilegx/$(DEPDIR)/$(am__dirstamp)
tilegx/siglongjmp.lo: tilegx/$(am__dirstamp) \
tilegx/$(DEPDIR)/$(am__dirstamp)
+riscv/siglongjmp.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
x86/$(am__dirstamp):
@$(MKDIR_P) x86
@: > x86/$(am__dirstamp)
@@ -2764,6 +2918,33 @@ x86/getcontext-freebsd.lo: x86/$(am__dirstamp) \
x86/$(DEPDIR)/$(am__dirstamp)
x86/getcontext-linux.lo: x86/$(am__dirstamp) \
x86/$(DEPDIR)/$(am__dirstamp)
+riscv/getcontext.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/setcontext.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lapply_reg_state.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lreg_states_iterate.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lcreate_addr_space.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lget_proc_info.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lget_save_loc.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lglobal.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Linit.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Linit_local.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Linit_remote.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lis_signal_frame.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lregs.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lresume.lo: riscv/$(am__dirstamp) \
+ riscv/$(DEPDIR)/$(am__dirstamp)
+riscv/Lstep.lo: riscv/$(am__dirstamp) riscv/$(DEPDIR)/$(am__dirstamp)
tilegx/getcontext.lo: tilegx/$(am__dirstamp) \
tilegx/$(DEPDIR)/$(am__dirstamp)
tilegx/Lapply_reg_state.lo: tilegx/$(am__dirstamp) \
@@ -2959,6 +3140,8 @@ mostlyclean-compile:
-rm -f ppc64/*.lo
-rm -f ptrace/*.$(OBJEXT)
-rm -f ptrace/*.lo
+ -rm -f riscv/*.$(OBJEXT)
+ -rm -f riscv/*.lo
-rm -f s390x/*.$(OBJEXT)
-rm -f s390x/*.lo
-rm -f setjmp/*.$(OBJEXT)
@@ -2977,6 +3160,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dl-iterate-phdr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx.Plo@am__quote@
@@ -3063,11 +3247,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_access_reg_freebsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_access_reg_linux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_accessors.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_corefile_elf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_create.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_destroy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_elf_map_image.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_find_proc_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_get_mapinfo_generic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_get_mapinfo_linux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_get_proc_name.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UCD_get_threadinfo_prstatus.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UPT_access_fpreg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UPT_elf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@coredump/$(DEPDIR)/_UPT_get_dyn_info_list_addr.Plo@am__quote@
@@ -3291,6 +3479,37 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@ptrace/$(DEPDIR)/_UPT_put_unwind_info.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ptrace/$(DEPDIR)/_UPT_reg_offset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ptrace/$(DEPDIR)/_UPT_resume.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gapply_reg_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gcreate_addr_space.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gget_proc_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gget_save_loc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gglobal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Ginit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Ginit_local.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Ginit_remote.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gis_signal_frame.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Greg_states_iterate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gregs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gresume.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Gstep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lapply_reg_state.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lcreate_addr_space.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lget_proc_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lget_save_loc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lglobal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Linit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Linit_local.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Linit_remote.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lis_signal_frame.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lreg_states_iterate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lregs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lresume.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/Lstep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/getcontext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/is_fpreg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/regname.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/setcontext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@riscv/$(DEPDIR)/siglongjmp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@s390x/$(DEPDIR)/Gapply_reg_state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@s390x/$(DEPDIR)/Gcreate_addr_space.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@s390x/$(DEPDIR)/Gget_proc_info.Plo@am__quote@
@@ -3540,6 +3759,7 @@ clean-libtool:
-rm -rf ppc32/.libs ppc32/_libs
-rm -rf ppc64/.libs ppc64/_libs
-rm -rf ptrace/.libs ptrace/_libs
+ -rm -rf riscv/.libs riscv/_libs
-rm -rf s390x/.libs s390x/_libs
-rm -rf setjmp/.libs setjmp/_libs
-rm -rf sh/.libs sh/_libs
@@ -3710,6 +3930,8 @@ distclean-generic:
-rm -f ppc64/$(am__dirstamp)
-rm -f ptrace/$(DEPDIR)/$(am__dirstamp)
-rm -f ptrace/$(am__dirstamp)
+ -rm -f riscv/$(DEPDIR)/$(am__dirstamp)
+ -rm -f riscv/$(am__dirstamp)
-rm -f s390x/$(DEPDIR)/$(am__dirstamp)
-rm -f s390x/$(am__dirstamp)
-rm -f setjmp/$(DEPDIR)/$(am__dirstamp)
@@ -3736,7 +3958,7 @@ clean-am: clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
clean-libtool clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am
- -rm -rf ./$(DEPDIR) aarch64/$(DEPDIR) arm/$(DEPDIR) coredump/$(DEPDIR) dwarf/$(DEPDIR) hppa/$(DEPDIR) ia64/$(DEPDIR) mi/$(DEPDIR) mips/$(DEPDIR) ppc/$(DEPDIR) ppc32/$(DEPDIR) ppc64/$(DEPDIR) ptrace/$(DEPDIR) s390x/$(DEPDIR) setjmp/$(DEPDIR) sh/$(DEPDIR) tilegx/$(DEPDIR) unwind/$(DEPDIR) x86/$(DEPDIR) x86_64/$(DEPDIR)
+ -rm -rf ./$(DEPDIR) aarch64/$(DEPDIR) arm/$(DEPDIR) coredump/$(DEPDIR) dwarf/$(DEPDIR) hppa/$(DEPDIR) ia64/$(DEPDIR) mi/$(DEPDIR) mips/$(DEPDIR) ppc/$(DEPDIR) ppc32/$(DEPDIR) ppc64/$(DEPDIR) ptrace/$(DEPDIR) riscv/$(DEPDIR) s390x/$(DEPDIR) setjmp/$(DEPDIR) sh/$(DEPDIR) tilegx/$(DEPDIR) unwind/$(DEPDIR) x86/$(DEPDIR) x86_64/$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@@ -3783,7 +4005,7 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR) aarch64/$(DEPDIR) arm/$(DEPDIR) coredump/$(DEPDIR) dwarf/$(DEPDIR) hppa/$(DEPDIR) ia64/$(DEPDIR) mi/$(DEPDIR) mips/$(DEPDIR) ppc/$(DEPDIR) ppc32/$(DEPDIR) ppc64/$(DEPDIR) ptrace/$(DEPDIR) s390x/$(DEPDIR) setjmp/$(DEPDIR) sh/$(DEPDIR) tilegx/$(DEPDIR) unwind/$(DEPDIR) x86/$(DEPDIR) x86_64/$(DEPDIR)
+ -rm -rf ./$(DEPDIR) aarch64/$(DEPDIR) arm/$(DEPDIR) coredump/$(DEPDIR) dwarf/$(DEPDIR) hppa/$(DEPDIR) ia64/$(DEPDIR) mi/$(DEPDIR) mips/$(DEPDIR) ppc/$(DEPDIR) ppc32/$(DEPDIR) ppc64/$(DEPDIR) ptrace/$(DEPDIR) riscv/$(DEPDIR) s390x/$(DEPDIR) setjmp/$(DEPDIR) sh/$(DEPDIR) tilegx/$(DEPDIR) unwind/$(DEPDIR) x86/$(DEPDIR) x86_64/$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
diff --git a/src/third_party/unwind/dist/src/aarch64/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/aarch64/Gcreate_addr_space.c
index f217adc7455..ac2b85e2f76 100644
--- a/src/third_party/unwind/dist/src/aarch64/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/aarch64/Gcreate_addr_space.c
@@ -37,8 +37,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
unw_addr_space_t as;
/* AArch64 supports little-endian and big-endian. */
- if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -50,7 +49,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
as->acc = *a;
/* Default to little-endian for AArch64. */
- if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ if (byte_order == 0 || byte_order == UNW_LITTLE_ENDIAN)
as->big_endian = 0;
else
as->big_endian = 1;
diff --git a/src/third_party/unwind/dist/src/aarch64/Gglobal.c b/src/third_party/unwind/dist/src/aarch64/Gglobal.c
index 72e36b2d4d6..2987f2aff34 100644
--- a/src/third_party/unwind/dist/src/aarch64/Gglobal.c
+++ b/src/third_party/unwind/dist/src/aarch64/Gglobal.c
@@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (aarch64_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
HIDDEN void
tdep_init (void)
@@ -39,7 +39,7 @@ tdep_init (void)
lock_acquire (&aarch64_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -47,10 +47,12 @@ tdep_init (void)
dwarf_init ();
+ tdep_init_mem_validate ();
+
#ifndef UNW_REMOTE_ONLY
aarch64_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&aarch64_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/aarch64/Ginit.c b/src/third_party/unwind/dist/src/aarch64/Ginit.c
index 35389762f27..fe6e511df07 100644
--- a/src/third_party/unwind/dist/src/aarch64/Ginit.c
+++ b/src/third_party/unwind/dist/src/aarch64/Ginit.c
@@ -24,8 +24,11 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/mman.h>
+#include <stdatomic.h>
#include "unwind_i.h"
@@ -81,17 +84,253 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
+
+static int mem_validate_pipe[2] = {-1, -1};
+
+#ifdef HAVE_PIPE2
+static inline void
+do_pipe2 (int pipefd[2])
+{
+ pipe2 (pipefd, O_CLOEXEC | O_NONBLOCK);
+}
+#else
+static inline void
+set_pipe_flags (int fd)
+{
+ int fd_flags = fcntl (fd, F_GETFD, 0);
+ int status_flags = fcntl (fd, F_GETFL, 0);
+
+ fd_flags |= FD_CLOEXEC;
+ fcntl (fd, F_SETFD, fd_flags);
+
+ status_flags |= O_NONBLOCK;
+ fcntl (fd, F_SETFL, status_flags);
+}
+
+static inline void
+do_pipe2 (int pipefd[2])
+{
+ pipe (pipefd);
+ set_pipe_flags(pipefd[0]);
+ set_pipe_flags(pipefd[1]);
+}
+#endif
+
+static inline void
+open_pipe (void)
+{
+ if (mem_validate_pipe[0] != -1)
+ close (mem_validate_pipe[0]);
+ if (mem_validate_pipe[1] != -1)
+ close (mem_validate_pipe[1]);
+
+ do_pipe2 (mem_validate_pipe);
+}
+
+ALWAYS_INLINE
+static int
+write_validate (void *addr)
+{
+ int ret = -1;
+ ssize_t bytes = 0;
+
+ do
+ {
+ char buf;
+ bytes = read (mem_validate_pipe[0], &buf, 1);
+ }
+ while ( errno == EINTR );
+
+ int valid_read = (bytes > 0 || errno == EAGAIN || errno == EWOULDBLOCK);
+ if (!valid_read)
+ {
+ // re-open closed pipe
+ open_pipe ();
+ }
+
+ do
+ {
+ ret = write (mem_validate_pipe[1], addr, 1);
+ }
+ while ( errno == EINTR );
+
+ return ret;
+}
+
+static int (*mem_validate_func) (void *addr, size_t len);
+static int msync_validate (void *addr, size_t len)
+{
+ if (msync (addr, len, MS_ASYNC) != 0)
+ {
+ return -1;
+ }
+
+ return write_validate (addr);
+}
+
+#ifdef HAVE_MINCORE
+static int mincore_validate (void *addr, size_t len)
+{
+ unsigned char mvec[2]; /* Unaligned access may cross page boundary */
+
+ /* mincore could fail with EAGAIN but we conservatively return -1
+ instead of looping. */
+ if (mincore (addr, len, (unsigned char *)mvec) != 0)
+ {
+ return -1;
+ }
+
+ return write_validate (addr);
+}
+#endif
+
+/* Initialise memory validation method. On linux kernels <2.6.21,
+ mincore() returns incorrect value for MAP_PRIVATE mappings,
+ such as stacks. If mincore() was available at compile time,
+ check if we can actually use it. If not, use msync() instead. */
+HIDDEN void
+tdep_init_mem_validate (void)
+{
+ open_pipe ();
+
+#ifdef HAVE_MINCORE
+ unsigned char present = 1;
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
+ unsigned char mvec[1];
+ int ret;
+ while ((ret = mincore((void *)addr, len, (unsigned char *)mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
+ if (ret == 0)
+ {
+ Debug(1, "using mincore to validate memory\n");
+ mem_validate_func = mincore_validate;
+ }
+ else
+#endif
+ {
+ Debug(1, "using msync to validate memory\n");
+ mem_validate_func = msync_validate;
+ }
+}
+
+/* Cache of already validated addresses */
+#define NLGA 4
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
+// thread-local variant
+static _Thread_local unw_word_t last_good_addr[NLGA];
+static _Thread_local int lga_victim;
+
+static int
+is_cached_valid_mem(unw_word_t addr)
+{
+ int i;
+ for (i = 0; i < NLGA; i++)
+ {
+ if (addr == last_good_addr[i])
+ return 1;
+ }
+ return 0;
+}
+
+static void
+cache_valid_mem(unw_word_t addr)
+{
+ int i, victim;
+ victim = lga_victim;
+ for (i = 0; i < NLGA; i++) {
+ if (last_good_addr[victim] == 0) {
+ last_good_addr[victim] = addr;
+ return;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ last_good_addr[victim] = addr;
+ victim = (victim + 1) % NLGA;
+ lga_victim = victim;
+}
+
+#else
+// global, thread safe variant
+static _Atomic unw_word_t last_good_addr[NLGA];
+static _Atomic int lga_victim;
+
+static int
+is_cached_valid_mem(unw_word_t addr)
+{
+ int i;
+ for (i = 0; i < NLGA; i++)
+ {
+ if (addr == atomic_load(&last_good_addr[i]))
+ return 1;
+ }
+ return 0;
+}
+
+static void
+cache_valid_mem(unw_word_t addr)
+{
+ int i, victim;
+ victim = atomic_load(&lga_victim);
+ unw_word_t zero = 0;
+ for (i = 0; i < NLGA; i++) {
+ if (atomic_compare_exchange_strong(&last_good_addr[victim], &zero, addr)) {
+ return;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ atomic_store(&last_good_addr[victim], addr);
+ victim = (victim + 1) % NLGA;
+ atomic_store(&lga_victim, victim);
+}
+#endif
+
+static int
+validate_mem (unw_word_t addr)
+{
+ size_t len;
+
+ len = unw_page_size;
+ addr = uwn_page_start(addr);
+
+ if (addr == 0)
+ return -1;
+
+ if (is_cached_valid_mem(addr))
+ return 0;
+
+ if (mem_validate_func ((void *) addr, len) == -1)
+ return -1;
+
+ cache_valid_mem(addr);
+
+ return 0;
+}
+
static int
access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
void *arg)
{
- if (write)
+ if (unlikely (write))
{
Debug (16, "mem[%lx] <- %lx\n", addr, *val);
*(unw_word_t *) addr = *val;
}
else
{
+ /* validate address */
+ const struct cursor *c = (const struct cursor *)arg;
+ if (likely (c != NULL) && unlikely (c->validate)
+ && unlikely (validate_mem (addr))) {
+ Debug (16, "mem[%016lx] -> invalid\n", addr);
+ return -1;
+ }
*val = *(unw_word_t *) addr;
Debug (16, "mem[%lx] -> %lx\n", addr, *val);
}
@@ -103,7 +342,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
void *arg)
{
unw_word_t *addr;
- unw_tdep_context_t *uc = arg;
+ unw_tdep_context_t *uc = ((struct cursor *)arg)->uc;
if (unw_is_fpreg (reg))
goto badreg;
@@ -132,7 +371,7 @@ static int
access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
int write, void *arg)
{
- unw_tdep_context_t *uc = arg;
+ unw_tdep_context_t *uc = ((struct cursor *)arg)->uc;
unw_fpreg_t *addr;
if (!unw_is_fpreg (reg))
@@ -182,7 +421,7 @@ aarch64_local_addr_space_init (void)
local_addr_space.acc.access_fpreg = access_fpreg;
local_addr_space.acc.resume = aarch64_local_resume;
local_addr_space.acc.get_proc_name = get_static_proc_name;
- local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ local_addr_space.big_endian = target_is_big_endian();
unw_flush_cache (&local_addr_space, 0, 0);
}
diff --git a/src/third_party/unwind/dist/src/aarch64/Ginit_local.c b/src/third_party/unwind/dist/src/aarch64/Ginit_local.c
index 69d4ed3861d..4a055fb0938 100644
--- a/src/third_party/unwind/dist/src/aarch64/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/aarch64/Ginit_local.c
@@ -41,13 +41,15 @@ unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_pre
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
c->dwarf.as = unw_local_addr_space;
- c->dwarf.as_arg = uc;
+ c->dwarf.as_arg = c;
+ c->uc = uc;
+ c->validate = 0;
return common_init (c, use_prev_instr);
}
diff --git a/src/third_party/unwind/dist/src/aarch64/Ginit_remote.c b/src/third_party/unwind/dist/src/aarch64/Ginit_remote.c
index 9b8ba5b89de..e300173ca47 100644
--- a/src/third_party/unwind/dist/src/aarch64/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/aarch64/Ginit_remote.c
@@ -33,13 +33,22 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
c->dwarf.as = as;
- c->dwarf.as_arg = as_arg;
+ if (as == unw_local_addr_space)
+ {
+ c->dwarf.as_arg = c;
+ c->uc = as_arg;
+ }
+ else
+ {
+ c->dwarf.as_arg = as_arg;
+ c->uc = 0;
+ }
return common_init (c, 0);
#endif /* !UNW_LOCAL_ONLY */
}
diff --git a/src/third_party/unwind/dist/src/aarch64/Gresume.c b/src/third_party/unwind/dist/src/aarch64/Gresume.c
index 2cc161360ef..445bac70f0d 100644
--- a/src/third_party/unwind/dist/src/aarch64/Gresume.c
+++ b/src/third_party/unwind/dist/src/aarch64/Gresume.c
@@ -34,7 +34,7 @@ aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
#ifdef __linux__
struct cursor *c = (struct cursor *) cursor;
- unw_tdep_context_t *uc = c->dwarf.as_arg;
+ unw_tdep_context_t *uc = c->uc;
if (c->sigcontext_format == AARCH64_SCF_NONE)
{
diff --git a/src/third_party/unwind/dist/src/aarch64/Gstep.c b/src/third_party/unwind/dist/src/aarch64/Gstep.c
index fdf64a73f33..92e2a66634c 100644
--- a/src/third_party/unwind/dist/src/aarch64/Gstep.c
+++ b/src/third_party/unwind/dist/src/aarch64/Gstep.c
@@ -70,7 +70,7 @@ aarch64_handle_signal_frame (unw_cursor_t *cursor)
c->sigcontext_sp = c->dwarf.cfa;
c->sigcontext_pc = c->dwarf.ip;
- if (ret)
+ if (ret > 0)
{
c->sigcontext_format = AARCH64_SCF_LINUX_RT_SIGFRAME;
sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF;
@@ -134,14 +134,30 @@ int
unw_step (unw_cursor_t *cursor)
{
struct cursor *c = (struct cursor *) cursor;
+ int validate = c->validate;
int ret;
Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx))\n",
c, c->dwarf.ip, c->dwarf.cfa);
+ /* Validate all addresses before dereferencing. */
+ c->validate = 1;
+
/* Check if this is a signal frame. */
- if (unw_is_signal_frame (cursor) > 0)
+ ret = unw_is_signal_frame (cursor);
+ if (ret > 0)
return aarch64_handle_signal_frame (cursor);
+ else if (unlikely (ret < 0))
+ {
+ /* IP points to non-mapped memory. */
+ /* This is probably SIGBUS. */
+ /* Try to load LR in IP to recover. */
+ Debug(1, "Invalid address found in the call stack: 0x%lx\n", c->dwarf.ip);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_X30], &c->dwarf.ip);
+ }
+
+ /* Restore default memory validation state */
+ c->validate = validate;
ret = dwarf_step (&c->dwarf);
Debug(1, "dwarf_step()=%d\n", ret);
diff --git a/src/third_party/unwind/dist/src/aarch64/Gtrace.c b/src/third_party/unwind/dist/src/aarch64/Gtrace.c
index c67faf0e357..bcdf19296b3 100644
--- a/src/third_party/unwind/dist/src/aarch64/Gtrace.c
+++ b/src/third_party/unwind/dist/src/aarch64/Gtrace.c
@@ -52,8 +52,8 @@ static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
static sig_atomic_t trace_cache_once_happen;
static pthread_key_t trace_cache_key;
static struct mempool trace_cache_pool;
-static __thread unw_trace_cache_t *tls_cache;
-static __thread int tls_cache_destroyed;
+static _Thread_local unw_trace_cache_t *tls_cache;
+static _Thread_local int tls_cache_destroyed;
/* Free memory for a thread's trace cache. */
static void
diff --git a/src/third_party/unwind/dist/src/arm/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/arm/Gcreate_addr_space.c
index 7b2d6bacfdc..d4bdb4167f5 100644
--- a/src/third_party/unwind/dist/src/arm/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/arm/Gcreate_addr_space.c
@@ -37,8 +37,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
/*
* ARM supports little-endian and big-endian.
*/
- if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -50,7 +49,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
as->acc = *a;
/* Default to little-endian for ARM. */
- if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ if (byte_order == 0 || byte_order == UNW_LITTLE_ENDIAN)
as->big_endian = 0;
else
as->big_endian = 1;
diff --git a/src/third_party/unwind/dist/src/arm/Gex_tables.c b/src/third_party/unwind/dist/src/arm/Gex_tables.c
index d6573a65e0c..083d2b2f7ca 100644
--- a/src/third_party/unwind/dist/src/arm/Gex_tables.c
+++ b/src/third_party/unwind/dist/src/arm/Gex_tables.c
@@ -152,13 +152,13 @@ HIDDEN int
arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c)
{
#define READ_OP() *buf++
+ assert(buf != NULL);
+ assert(len > 0);
+
const uint8_t *end = buf + len;
int ret;
struct arm_exbuf_data edata;
- assert(buf != NULL);
- assert(len > 0);
-
while (buf < end)
{
uint8_t op = READ_OP ();
@@ -381,7 +381,7 @@ arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf)
return nbuf;
}
-int
+static int
arm_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
unw_dyn_info_t *di, unw_proc_info_t *pi,
int need_unwind_info, void *arg)
@@ -506,18 +506,20 @@ arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data)
}
HIDDEN int
-arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
- unw_proc_info_t *pi, int need_unwind_info, void *arg)
+arm_find_proc_info2 (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg,
+ int methods)
{
int ret = -1;
intrmask_t saved_mask;
Debug (14, "looking for IP=0x%lx\n", (long) ip);
- if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF))
+ if (UNW_TRY_METHOD (UNW_ARM_METHOD_DWARF) && (methods & UNW_ARM_METHOD_DWARF))
ret = dwarf_find_proc_info (as, ip, pi, need_unwind_info, arg);
- if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX))
+ if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX) &&
+ (methods & UNW_ARM_METHOD_EXIDX))
{
struct arm_cb_data cb_data;
@@ -540,6 +542,14 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
return ret;
}
+HIDDEN int
+arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ return arm_find_proc_info2 (as, ip, pi, need_unwind_info, arg,
+ UNW_ARM_METHOD_ALL);
+}
+
HIDDEN void
arm_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
{
diff --git a/src/third_party/unwind/dist/src/arm/Gglobal.c b/src/third_party/unwind/dist/src/arm/Gglobal.c
index 7b93fbd89a1..0700f930f40 100644
--- a/src/third_party/unwind/dist/src/arm/Gglobal.c
+++ b/src/third_party/unwind/dist/src/arm/Gglobal.c
@@ -26,10 +26,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (arm_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* Unwinding methods to use. See UNW_METHOD_ enums */
+#if defined(__ANDROID__)
+/* Android only supports three types of unwinding methods. */
+HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_DWARF | UNW_ARM_METHOD_EXIDX | UNW_ARM_METHOD_LR;
+#else
HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL;
+#endif
HIDDEN void
tdep_init (void)
@@ -40,7 +45,7 @@ tdep_init (void)
lock_acquire (&arm_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -58,7 +63,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
arm_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&arm_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/arm/Ginit.c b/src/third_party/unwind/dist/src/arm/Ginit.c
index 0bac0d72da6..bce52dc340a 100644
--- a/src/third_party/unwind/dist/src/arm/Ginit.c
+++ b/src/third_party/unwind/dist/src/arm/Ginit.c
@@ -71,9 +71,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
/* Cache of already validated addresses */
#define NLGA 4
static unw_word_t last_good_addr[NLGA];
@@ -83,14 +80,8 @@ static int
validate_mem (unw_word_t addr)
{
int i, victim;
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/third_party/unwind/dist/src/arm/Ginit_local.c b/src/third_party/unwind/dist/src/arm/Ginit_local.c
index e13519b79a9..8679805dfa3 100644
--- a/src/third_party/unwind/dist/src/arm/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/arm/Ginit_local.c
@@ -41,7 +41,7 @@ unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_pre
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/arm/Ginit_remote.c b/src/third_party/unwind/dist/src/arm/Ginit_remote.c
index 9b8ba5b89de..26d11ba942b 100644
--- a/src/third_party/unwind/dist/src/arm/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/arm/Ginit_remote.c
@@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/arm/Gresume.c b/src/third_party/unwind/dist/src/arm/Gresume.c
index 3b9dfb33e60..ed284e72779 100644
--- a/src/third_party/unwind/dist/src/arm/Gresume.c
+++ b/src/third_party/unwind/dist/src/arm/Gresume.c
@@ -50,7 +50,7 @@ arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
regs[6] = uc->regs[10];
regs[7] = uc->regs[11]; /* FP */
regs[8] = uc->regs[13]; /* SP */
- regs[9] = uc->regs[14]; /* LR */
+ regs[9] = uc->regs[15]; /* PC */
struct regs_overlay {
char x[sizeof(regs)];
diff --git a/src/third_party/unwind/dist/src/arm/Gstep.c b/src/third_party/unwind/dist/src/arm/Gstep.c
index 895e8a892af..e4ada651bce 100644
--- a/src/third_party/unwind/dist/src/arm/Gstep.c
+++ b/src/third_party/unwind/dist/src/arm/Gstep.c
@@ -54,17 +54,22 @@ arm_exidx_step (struct cursor *c)
c->dwarf.as_arg);
if (ret == -UNW_ENOINFO)
{
+#ifdef UNW_LOCAL_ONLY
+ if ((ret = arm_find_proc_info2 (c->dwarf.as, ip, &c->dwarf.pi,
+ 1, c->dwarf.as_arg,
+ UNW_ARM_METHOD_EXIDX)) < 0)
+ return ret;
+#else
if ((ret = tdep_find_proc_info (&c->dwarf, ip, 1)) < 0)
return ret;
+#endif
}
if (c->dwarf.pi.format != UNW_INFO_FORMAT_ARM_EXIDX)
return -UNW_ENOINFO;
ret = arm_exidx_extract (&c->dwarf, buf);
- if (ret == -UNW_ESTOPUNWIND)
- return 0;
- else if (ret < 0)
+ if (ret < 0)
return ret;
ret = arm_exidx_decode (buf, ret, &c->dwarf);
@@ -88,6 +93,7 @@ unw_step (unw_cursor_t *cursor)
{
struct cursor *c = (struct cursor *) cursor;
int ret = -UNW_EUNSPEC;
+ int has_stopunwind = 0;
Debug (1, "(cursor=%p)\n", c);
@@ -95,17 +101,31 @@ unw_step (unw_cursor_t *cursor)
if (unw_is_signal_frame (cursor) > 0)
return arm_handle_signal_frame (cursor);
+ /* First, try extbl-based unwinding. */
+ if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX))
+ {
+ ret = arm_exidx_step (c);
+ Debug(1, "arm_exidx_step()=%d\n", ret);
+ if (ret > 0)
+ return 1;
+ if (ret == 0)
+ return ret;
+ if (ret == -UNW_ESTOPUNWIND)
+ has_stopunwind = 1;
+ }
+
#ifdef CONFIG_DEBUG_FRAME
- /* First, try DWARF-based unwinding. */
+ /* Second, try DWARF-based unwinding. */
if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF))
{
+ Debug (13, "%s(ret=%d), trying extbl\n",
+ UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX) ? "arm_exidx_step() failed " : "",
+ ret);
ret = dwarf_step (&c->dwarf);
Debug(1, "dwarf_step()=%d\n", ret);
if (likely (ret > 0))
return 1;
- else if (unlikely (ret == -UNW_ESTOPUNWIND))
- return ret;
if (ret < 0 && ret != -UNW_ENOINFO)
{
@@ -115,18 +135,9 @@ unw_step (unw_cursor_t *cursor)
}
#endif /* CONFIG_DEBUG_FRAME */
- /* Next, try extbl-based unwinding. */
- if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX))
- {
- Debug (13, "%s(ret=%d), trying extbl\n",
- UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) ? "dwarf_step() failed " : "",
- ret);
- ret = arm_exidx_step (c);
- if (ret > 0)
- return 1;
- if (ret == -UNW_ESTOPUNWIND || ret == 0)
- return ret;
- }
+ // Before trying the fallback, if any unwind info tell us to stop, do that.
+ if (has_stopunwind)
+ return -UNW_ESTOPUNWIND;
/* Fall back on APCS frame parsing.
Note: This won't work in case the ARM EABI is used. */
@@ -139,13 +150,13 @@ unw_step (unw_cursor_t *cursor)
if (UNW_TRY_METHOD(UNW_ARM_METHOD_FRAME))
{
Debug (13, "%s%s%s%s(ret=%d), trying frame-chain\n",
- UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) ? "dwarf_step() " : "",
- (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) && UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX)) ? "and " : "",
UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX) ? "arm_exidx_step() " : "",
- (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) || UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX)) ? "failed " : "",
+ (UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX) && UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) ? "and " : "",
+ UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) ? "dwarf_step() " : "",
+ (UNW_TRY_METHOD(UNW_ARM_METHOD_EXIDX) || UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) ? "failed " : "",
ret);
ret = UNW_ESUCCESS;
- /* DWARF unwinding failed, try to follow APCS/optimized APCS frame chain */
+ /* EXIDX and/or DWARF unwinding failed, try to follow APCS/optimized APCS frame chain */
unw_word_t instr, i;
dwarf_loc_t ip_loc, fp_loc;
unw_word_t frame;
diff --git a/src/third_party/unwind/dist/src/arm/Gtrace.c b/src/third_party/unwind/dist/src/arm/Gtrace.c
index 2f277520b36..51fc281de35 100644
--- a/src/third_party/unwind/dist/src/arm/Gtrace.c
+++ b/src/third_party/unwind/dist/src/arm/Gtrace.c
@@ -52,8 +52,8 @@ static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
static sig_atomic_t trace_cache_once_happen;
static pthread_key_t trace_cache_key;
static struct mempool trace_cache_pool;
-static __thread unw_trace_cache_t *tls_cache;
-static __thread int tls_cache_destroyed;
+static _Thread_local unw_trace_cache_t *tls_cache;
+static _Thread_local int tls_cache_destroyed;
/* Free memory for a thread's trace cache. */
static void
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_access_reg_linux.c b/src/third_party/unwind/dist/src/coredump/_UCD_access_reg_linux.c
index 43792f849b3..27eef123867 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_access_reg_linux.c
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_access_reg_linux.c
@@ -57,6 +57,14 @@ _UCD_access_reg (unw_addr_space_t as,
#elif defined(UNW_TARGET_S390X)
if (regnum > UNW_S390X_R15)
goto badreg;
+#elif defined(UNW_TARGET_IA64) || defined(UNW_TARGET_HPPA) || defined(UNW_TARGET_PPC32) || defined(UNW_TARGET_PPC64)
+ if (regnum >= ARRAY_SIZE(ui->prstatus->pr_reg))
+ goto badreg;
+#elif defined(UNW_TARGET_RISCV)
+ if (regnum == UNW_RISCV_PC)
+ regnum = 0;
+ else if (regnum > UNW_RISCV_X31)
+ goto badreg;
#else
#if defined(UNW_TARGET_MIPS)
static const uint8_t remap_regs[] =
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_corefile_elf.c b/src/third_party/unwind/dist/src/coredump/_UCD_corefile_elf.c
new file mode 100644
index 00000000000..045e0437b63
--- /dev/null
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_corefile_elf.c
@@ -0,0 +1,126 @@
+/**
+ * Support functions for ELF corefiles
+ */
+/*
+ This file is part of libunwind.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+#include "_UCD_internal.h"
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+
+/**
+ * Read an ELF segment into an allocated memory buffer.
+ * @param[in] ui the unwind-coredump context
+ * @param[in] phdr pointer to the PHDR of the segment to load
+ * @param[out] segment pointer to the segment loaded
+ * @param[out] segment_size size of the @segment in bytes
+ *
+ * Allocates an appropriately-sized buffer to contain the segment of the
+ * coredump described by @phdr and reads it in from the core file.
+ *
+ * The caller is responsible for freeing the allocated segment memory.
+ *
+ * @returns UNW_SUCCESS on success, something else otherwise.
+ */
+HIDDEN int
+_UCD_elf_read_segment(struct UCD_info *ui, coredump_phdr_t *phdr, uint8_t **segment, size_t *segment_size)
+{
+ int ret = -UNW_EUNSPEC;
+ if (lseek(ui->coredump_fd, phdr->p_offset, SEEK_SET) != (off_t)phdr->p_offset)
+ {
+ Debug(0, "errno %d setting offset to %lu in '%s': %s\n",
+ errno, phdr->p_offset, ui->coredump_filename, strerror(errno));
+ return ret;
+ }
+
+ *segment_size = phdr->p_filesz;
+ *segment = malloc(*segment_size);
+ if (*segment == NULL)
+ {
+ Debug(0, "error %zu bytes of memory for segment\n", *segment_size);
+ return ret;
+ }
+
+ if (read(ui->coredump_fd, *segment, *segment_size) != (ssize_t)*segment_size)
+ {
+ Debug(0, "errno %d reading %zu bytes from '%s': %s\n",
+ errno, *segment_size, ui->coredump_filename, strerror(errno));
+ return ret;
+ }
+
+ ret = UNW_ESUCCESS;
+ return ret;
+}
+
+
+/**
+ * Parse a PT_NOTE segment into zero or more notes and visit each one
+ * @param[in] segment pointer to the PT_NOTE segment
+ * @param[in] segment_size size of @p segment in bytes
+ * @param[in] visit callback to process to the notes
+ * @param[in] arg context to forward to the callback
+ *
+ * One PT_NOTE segment might contain many variable-length notes. Parsing them
+ * out is just a matter of calculating the size of each note from the size
+ * fields contained in the (fixed-size) note header and adjusting for 4-byte
+ * alignment.
+ *
+ * For each note found the @p visit callback will be invoked. If the callback
+ * returns anything but UNW_ESUCCESS, traversal of the notes will be terminated
+ * and processing will return immediately, passing the return code through.
+ *
+ * @returns UNW_SUCCESS on success or the return value from @p visit otherwise.
+ */
+HIDDEN int
+_UCD_elf_visit_notes(uint8_t *segment, size_t segment_size, note_visitor_t visit, void *arg)
+{
+ int ret = UNW_ESUCCESS;
+ size_t parsed_size = 0;
+ while (parsed_size < segment_size)
+ {
+ /*
+ * Note that Elf32_Nhdr and Elf64_Nhdr are identical, so it doesn't matter which
+ * structure is chosen here. I chose the one with the larger number because
+ * bigger is better.
+ */
+ Elf64_Nhdr *note = (Elf64_Nhdr *)(segment + parsed_size);
+ unsigned header_size = sizeof(Elf64_Nhdr);
+ unsigned name_size = UNW_ALIGN(note->n_namesz, 4);
+ unsigned desc_size = UNW_ALIGN(note->n_descsz, 4);
+ unsigned note_size = header_size + name_size + desc_size;
+ char *name = (char *)(note) + header_size;
+ uint8_t *desc = (uint8_t *)(note) + header_size + name_size;
+
+ ret = visit(note->n_namesz, note->n_descsz, note->n_type, name, desc, arg);
+ if (ret != UNW_ESUCCESS)
+ {
+ break;
+ }
+
+ parsed_size += note_size;
+ }
+ return ret;
+}
+
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_create.c b/src/third_party/unwind/dist/src/coredump/_UCD_create.c
index 4c430efb27b..9b4b7fe39b8 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_create.c
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_create.c
@@ -30,47 +30,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if defined(HAVE_BYTESWAP_H)
#include <byteswap.h>
#endif
-#if defined(HAVE_ENDIAN_H)
-# include <endian.h>
-#elif defined(HAVE_SYS_ENDIAN_H)
-# include <sys/endian.h>
-#endif
-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
-# define WE_ARE_BIG_ENDIAN 1
-# define WE_ARE_LITTLE_ENDIAN 0
-#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
-# define WE_ARE_BIG_ENDIAN 0
-# define WE_ARE_LITTLE_ENDIAN 1
-#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
-# define WE_ARE_BIG_ENDIAN 1
-# define WE_ARE_LITTLE_ENDIAN 0
-#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
-# define WE_ARE_BIG_ENDIAN 0
-# define WE_ARE_LITTLE_ENDIAN 1
-#elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
-# define WE_ARE_BIG_ENDIAN 1
-# define WE_ARE_LITTLE_ENDIAN 0
-#elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
-# define WE_ARE_BIG_ENDIAN 0
-# define WE_ARE_LITTLE_ENDIAN 1
-#elif defined(__386__)
-# define WE_ARE_BIG_ENDIAN 0
-# define WE_ARE_LITTLE_ENDIAN 1
-#else
-# error "Can't determine endianness"
-#endif
-#include <elf.h>
+#if defined(HAVE_ELF_H)
+# include <elf.h>
+#elif defined(HAVE_SYS_ELF_H)
+# include <sys/elf.h>
+#endif
#include <sys/procfs.h> /* struct elf_prstatus */
#include "_UCD_lib.h"
#include "_UCD_internal.h"
-#define NOTE_DATA(_hdr) STRUCT_MEMBER_P((_hdr), sizeof (Elf32_Nhdr) + UNW_ALIGN((_hdr)->n_namesz, 4))
-#define NOTE_SIZE(_hdr) (sizeof (Elf32_Nhdr) + UNW_ALIGN((_hdr)->n_namesz, 4) + UNW_ALIGN((_hdr)->n_descsz, 4))
-#define NOTE_NEXT(_hdr) STRUCT_MEMBER_P((_hdr), NOTE_SIZE(_hdr))
-#define NOTE_FITS_IN(_hdr, _size) ((_size) >= sizeof (Elf32_Nhdr) && (_size) >= NOTE_SIZE (_hdr))
-#define NOTE_FITS(_hdr, _end) NOTE_FITS_IN((_hdr), (unsigned long)((char *)(_end) - (char *)(_hdr)))
struct UCD_info *
_UCD_create(const char *filename)
@@ -118,7 +88,7 @@ _UCD_create(const char *filename)
goto err;
}
- if (WE_ARE_LITTLE_ENDIAN != (elf_header32.e_ident[EI_DATA] == ELFDATA2LSB))
+ if (target_is_big_endian() && (elf_header32.e_ident[EI_DATA] == ELFDATA2LSB))
{
Debug(0, "'%s' is endian-incompatible\n", filename);
goto err;
@@ -205,72 +175,42 @@ _UCD_create(const char *filename)
}
}
- unsigned i = 0;
- coredump_phdr_t *cur = phdrs;
- while (i < size)
- {
- Debug(2, "phdr[%03d]: type:%d", i, cur->p_type);
- if (cur->p_type == PT_NOTE)
- {
- Elf32_Nhdr *note_hdr, *note_end;
- unsigned n_threads;
-
- ui->note_phdr = malloc(cur->p_filesz);
- if (lseek(fd, cur->p_offset, SEEK_SET) != (off_t)cur->p_offset
- || (uoff_t)read(fd, ui->note_phdr, cur->p_filesz) != cur->p_filesz)
- {
- Debug(0, "Can't read PT_NOTE from '%s'\n", filename);
- goto err;
- }
-
- note_end = STRUCT_MEMBER_P (ui->note_phdr, cur->p_filesz);
-
- /* Count number of threads */
- n_threads = 0;
- note_hdr = (Elf32_Nhdr *)ui->note_phdr;
- while (NOTE_FITS (note_hdr, note_end))
- {
- if (note_hdr->n_type == NT_PRSTATUS)
- n_threads++;
-
- note_hdr = NOTE_NEXT (note_hdr);
- }
-
- ui->n_threads = n_threads;
- ui->threads = malloc(sizeof (void *) * n_threads);
-
- n_threads = 0;
- note_hdr = (Elf32_Nhdr *)ui->note_phdr;
- while (NOTE_FITS (note_hdr, note_end))
- {
- if (note_hdr->n_type == NT_PRSTATUS)
- ui->threads[n_threads++] = NOTE_DATA (note_hdr);
-
- note_hdr = NOTE_NEXT (note_hdr);
- }
- }
- if (cur->p_type == PT_LOAD)
- {
- Debug(2, " ofs:%08llx va:%08llx filesize:%08llx memsize:%08llx flg:%x",
- (unsigned long long) cur->p_offset,
- (unsigned long long) cur->p_vaddr,
- (unsigned long long) cur->p_filesz,
- (unsigned long long) cur->p_memsz,
- cur->p_flags
- );
- if (cur->p_filesz < cur->p_memsz)
- {
- Debug(2, " partial");
- }
- if (cur->p_flags & PF_X)
- {
- Debug(2, " executable");
- }
- }
- Debug(2, "\n");
- i++;
- cur++;
- }
+ int ret = _UCD_get_threadinfo(ui, phdrs, size);
+ if (ret != UNW_ESUCCESS) {
+ Debug(0, "failure retrieving thread info from core file\n");
+ goto err;
+ }
+
+ ret = _UCD_get_mapinfo(ui, phdrs, size);
+ if (ret != UNW_ESUCCESS) {
+ Debug(0, "failure retrieving file mapping from core file\n");
+ goto err;
+ }
+
+ coredump_phdr_t *cur = phdrs;
+ for (unsigned i = 0; i < size; ++i)
+ {
+ if (cur->p_type == PT_LOAD)
+ {
+ Debug(2, " ofs:%08llx va:%08llx filesize:%08llx memsize:%08llx flg:%x",
+ (unsigned long long) cur->p_offset,
+ (unsigned long long) cur->p_vaddr,
+ (unsigned long long) cur->p_filesz,
+ (unsigned long long) cur->p_memsz,
+ cur->p_flags
+ );
+ if (cur->p_filesz < cur->p_memsz)
+ {
+ Debug(2, " partial");
+ }
+ if (cur->p_flags & PF_X)
+ {
+ Debug(2, " executable");
+ }
+ }
+ Debug(2, "\n");
+ cur++;
+ }
if (ui->n_threads == 0)
{
@@ -278,7 +218,7 @@ _UCD_create(const char *filename)
goto err;
}
- ui->prstatus = ui->threads[0];
+ ui->prstatus = &ui->threads[0];
return ui;
@@ -295,7 +235,7 @@ int _UCD_get_num_threads(struct UCD_info *ui)
void _UCD_select_thread(struct UCD_info *ui, int n)
{
if (n >= 0 && n < ui->n_threads)
- ui->prstatus = ui->threads[n];
+ ui->prstatus = &ui->threads[n];
}
pid_t _UCD_get_pid(struct UCD_info *ui)
@@ -358,41 +298,6 @@ int _UCD_add_backing_file_at_segment(struct UCD_info *ui, int phdr_no, const cha
}
//TODO: else loudly complain? Maybe even fail?
- if (phdr->p_filesz != 0)
- {
-//TODO: loop and compare in smaller blocks
- char *core_buf = malloc(phdr->p_filesz);
- char *file_buf = malloc(phdr->p_filesz);
- if (lseek(ui->coredump_fd, phdr->p_offset, SEEK_SET) != (off_t)phdr->p_offset
- || (uoff_t)read(ui->coredump_fd, core_buf, phdr->p_filesz) != phdr->p_filesz
- )
- {
- Debug(0, "Error reading from coredump file\n");
- err_read:
- free(core_buf);
- free(file_buf);
- goto err;
- }
- if ((uoff_t)read(fd, file_buf, phdr->p_filesz) != phdr->p_filesz)
- {
- Debug(0, "Error reading from '%s'\n", filename);
- goto err_read;
- }
- int r = memcmp(core_buf, file_buf, phdr->p_filesz);
- free(core_buf);
- free(file_buf);
- if (r != 0)
- {
- Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file do not match\n",
- phdr_no, (unsigned long long)phdr->p_filesz
- );
- } else {
- Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file match\n",
- phdr_no, (unsigned long long)phdr->p_filesz
- );
- }
- }
-
/* Success */
return 0;
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_elf_map_image.c b/src/third_party/unwind/dist/src/coredump/_UCD_elf_map_image.c
index 4b3db0bbff7..99fd25e83a9 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_elf_map_image.c
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_elf_map_image.c
@@ -21,7 +21,11 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include <elf.h>
+#if defined(HAVE_ELF_H)
+# include <elf.h>
+#elif defined(HAVE_SYS_ELF_H)
+# include <sys/elf.h>
+#endif
#include "_UCD_lib.h"
#include "_UCD_internal.h"
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_find_proc_info.c b/src/third_party/unwind/dist/src/coredump/_UCD_find_proc_info.c
index 33b66c8edbe..35e1624ced6 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_find_proc_info.c
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_find_proc_info.c
@@ -21,7 +21,11 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include <elf.h>
+#if defined(HAVE_ELF_H)
+# include <elf.h>
+#elif defined(HAVE_SYS_ELF_H)
+# include <sys/elf.h>
+#endif
#include "_UCD_lib.h"
#include "_UCD_internal.h"
@@ -31,7 +35,7 @@ get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip)
{
unsigned long segbase, mapoff;
-#if UNW_TARGET_IA64 && defined(__linux)
+#if UNW_TARGET_IA64 && defined(__linux__)
if (!ui->edi.ktab.start_ip && _Uia64_get_kernel_table (&ui->edi.ktab) < 0)
return -UNW_ENOINFO;
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_generic.c b/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_generic.c
new file mode 100644
index 00000000000..19945d728a7
--- /dev/null
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_generic.c
@@ -0,0 +1,34 @@
+/**
+ * Extract filemap info from a coredump (generic)
+ */
+/*
+ This file is part of libunwind.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+#include "_UCD_internal.h"
+
+
+int
+_UCD_get_mapinfo(struct UCD_info *ui, coredump_phdr_t *phdrs, unsigned phdr_size)
+{
+ int ret = UNW_ESUCCESS; /* it's OK if there are no file mappings */
+
+ return ret;
+}
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_linux.c b/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_linux.c
new file mode 100644
index 00000000000..0df2107fb31
--- /dev/null
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_get_mapinfo_linux.c
@@ -0,0 +1,134 @@
+/**
+ * Extract filemap info from a coredump (Linux and similar)
+ */
+/*
+ This file is part of libunwind.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+#include "_UCD_internal.h"
+
+
+/**
+ * The format of the NT_FILE note is not well documented, but it goes something
+ * like this.
+ *
+ * The note has a header containing the @i count of the number of file maps, plus a
+ * value of the size of the offset field in each map. Since we don;t care about
+ * the offset field in a core file, there is no further information available on
+ * exactly what the means.
+ *
+ * Following the header are @count mapinfo structures. The mapinfo structure consists of
+ * a start address, and end address, and some wacky offset thing. The start and
+ * end address are the virtual addresses of a LOAD segment that was mapped from
+ * the named file.
+ *
+ * Following the array of mapinfo structures is a block of null-terminated C strings
+ * containing the mapped file names. They are ordered correspondingly to each
+ * entry in the map structure array.
+ */
+typedef struct {
+ unsigned long count;
+ unsigned long pagesz;
+} linux_mapinfo_hdr_t;
+
+typedef struct {
+ unsigned long start;
+ unsigned long end;
+ unsigned long offset;
+} linux_mapinfo_t;
+
+
+/**
+ * Map a file note to program headers
+ *
+ * If a NT_FILE note is recognized, parse it and add the resulting backing files
+ * to the program header list.
+ *
+ * Any file names that end in the string "(deleted)" are ignored.
+ */
+static int
+_handle_file_note(uint32_t n_namesz, uint32_t n_descsz, uint32_t n_type, char *name, uint8_t *desc, void *arg)
+{
+ struct UCD_info *ui = (struct UCD_info *)arg;
+#ifdef NT_FILE
+ if (n_type == NT_FILE)
+ {
+ Debug(0, "found a PT_FILE note\n");
+ static const char * deleted = "(deleted)";
+ size_t deleted_len = strlen(deleted);
+ static const size_t mapinfo_offset = sizeof(linux_mapinfo_hdr_t);
+
+ linux_mapinfo_hdr_t *mapinfo = (linux_mapinfo_hdr_t *)desc;
+ linux_mapinfo_t *maps = (linux_mapinfo_t *)(desc + mapinfo_offset);
+ char *strings = (char *)(desc + mapinfo_offset + sizeof(linux_mapinfo_t)*mapinfo->count);
+ for (unsigned long i = 0; i < mapinfo->count; ++i)
+ {
+ size_t len = strlen(strings);
+ for (unsigned p = 0; p < ui->phdrs_count; ++p)
+ {
+ if (ui->phdrs[p].p_type == PT_LOAD
+ && maps[i].start >= ui->phdrs[p].p_vaddr
+ && maps[i].end <= ui->phdrs[p].p_vaddr + ui->phdrs[p].p_filesz)
+ {
+ if (len > deleted_len && memcmp(strings + len - deleted_len, deleted, deleted_len))
+ {
+ _UCD_add_backing_file_at_segment(ui, p, strings);
+ }
+ break;
+ }
+ }
+ strings += (len + 1);
+ }
+ }
+#endif
+ return UNW_ESUCCESS;
+}
+
+
+/**
+ * Get filemap info from core file (Linux and similar)
+ *
+ * If there is a mapinfo not in the core file, map its contents to the phdrs.
+ *
+ * Since there may or may not be any mapinfo notes it's OK for this function to
+ * fail.
+ */
+int
+_UCD_get_mapinfo(struct UCD_info *ui, coredump_phdr_t *phdrs, unsigned phdr_size)
+{
+ int ret = UNW_ESUCCESS; /* it's OK if there are no file mappings */
+
+ for (unsigned i = 0; i < phdr_size; ++i)
+ {
+ if (phdrs[i].p_type == PT_NOTE)
+ {
+ uint8_t *segment;
+ size_t segment_size;
+ ret = _UCD_elf_read_segment(ui, &phdrs[i], &segment, &segment_size);
+ if (ret == UNW_ESUCCESS)
+ {
+ _UCD_elf_visit_notes(segment, segment_size, _handle_file_note, ui);
+ free(segment);
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_get_proc_name.c b/src/third_party/unwind/dist/src/coredump/_UCD_get_proc_name.c
index 3a4c9b8213c..cd5ee892232 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_get_proc_name.c
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_get_proc_name.c
@@ -64,9 +64,9 @@ _UCD_get_proc_name (unw_addr_space_t as, unw_word_t ip,
{
struct UCD_info *ui = arg;
-#if ELF_CLASS == ELFCLASS64
+#if UNW_ELF_CLASS == UNW_ELFCLASS64
return _Uelf64_CD_get_proc_name (ui, as, ip, buf, buf_len, offp);
-#elif ELF_CLASS == ELFCLASS32
+#elif UNW_ELF_CLASS == UNW_ELFCLASS32
return _Uelf32_CD_get_proc_name (ui, as, ip, buf, buf_len, offp);
#else
return -UNW_ENOINFO;
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_get_threadinfo_prstatus.c b/src/third_party/unwind/dist/src/coredump/_UCD_get_threadinfo_prstatus.c
new file mode 100644
index 00000000000..455525661c5
--- /dev/null
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_get_threadinfo_prstatus.c
@@ -0,0 +1,121 @@
+/**
+ * Extract threadinfo from a coredump (targets with NT_PRSTATUS)
+ */
+/*
+ This file is part of libunwind.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+*/
+#include "_UCD_internal.h"
+
+#if defined(HAVE_ELF_H)
+# include <elf.h>
+#elif defined(HAVE_SYS_ELF_H)
+# include <sys/elf.h>
+#endif
+
+
+/**
+ * Accumulate a count of the number of thread notes
+ *
+ * This _UCD_elf_visit_notes() callback just increments a count for each
+ * NT_PRSTATUS note seen.
+ */
+static int
+_count_thread_notes(uint32_t n_namesz, uint32_t n_descsz, uint32_t n_type, char *name, uint8_t *desc, void *arg)
+{
+ size_t *thread_count = (size_t *)arg;
+ if (n_type == NT_PRSTATUS)
+ {
+ ++*thread_count;
+ }
+ return UNW_ESUCCESS;
+}
+
+
+/**
+ * Save a thread note to the unwind-coredump context
+ *
+ * This _UCD_elf_visit_notes() callback just copies the actual data structure
+ * from any NT_PRSTATUS note seen into an array of such structures and
+ * increments the count.
+ */
+static int
+_save_thread_notes(uint32_t n_namesz, uint32_t n_descsz, uint32_t n_type, char *name, uint8_t *desc, void *arg)
+{
+ struct UCD_info *ui = (struct UCD_info *)arg;
+ if (n_type == NT_PRSTATUS)
+ {
+ memcpy(&ui->threads[ui->n_threads], desc, sizeof(struct PRSTATUS_STRUCT));
+ ++ui->n_threads;
+ }
+ return UNW_ESUCCESS;
+}
+
+
+/**
+ * Get thread info from core file
+ *
+ * On Linux threads are emulated by cloned processes sharing an address space
+ * and the process information is described by a note in the core file of type
+ * NT_PRSTATUS. In fact, on Linux, the state of a thread is described by a
+ * CPU-dependent group of notes but right now we're only going to care about the
+ * one process-status note. This statement is also true for FreeBSD.
+ *
+ * Depending on how the core file is created, there may be one PT_NOTE segment
+ * with multiple NT_PRSTATUS notes in it, or multiple PT_NOTE segments. Just to
+ * be safe, it's better to assume there are multiple PT_NOTE segments each with
+ * multiple NT_PRSTATUS notes, as that covers all the cases.
+ */
+int
+_UCD_get_threadinfo(struct UCD_info *ui, coredump_phdr_t *phdrs, unsigned phdr_size)
+{
+ int ret = -UNW_ENOINFO;
+
+ for (unsigned i = 0; i < phdr_size; ++i)
+ {
+ Debug(8, "phdr[%03d]: type:%d", i, phdrs[i].p_type);
+ if (phdrs[i].p_type == PT_NOTE)
+ {
+ size_t thread_count = 0;
+ uint8_t *segment;
+ size_t segment_size;
+ ret = _UCD_elf_read_segment(ui, &phdrs[i], &segment, &segment_size);
+ if (ret == UNW_ESUCCESS)
+ {
+ _UCD_elf_visit_notes(segment, segment_size, _count_thread_notes, &thread_count);
+ Debug(2, "found %zu threads\n", thread_count);
+
+ size_t new_size = sizeof(struct PRSTATUS_STRUCT) * (ui->n_threads + thread_count);
+ ui->threads = realloc(ui->threads, new_size);
+ if (ui->threads == NULL)
+ {
+ Debug(0, "error allocating %zu bytes of memory \n", new_size);
+ free(segment);
+ return -UNW_EUNSPEC;
+ }
+ _UCD_elf_visit_notes(segment, segment_size, _save_thread_notes, ui);
+
+ free(segment);
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/src/third_party/unwind/dist/src/coredump/_UCD_internal.h b/src/third_party/unwind/dist/src/coredump/_UCD_internal.h
index 3c95a2a0038..f5150205294 100644
--- a/src/third_party/unwind/dist/src/coredump/_UCD_internal.h
+++ b/src/third_party/unwind/dist/src/coredump/_UCD_internal.h
@@ -92,14 +92,20 @@ struct UCD_info
void *note_phdr; /* allocated or NULL */
struct PRSTATUS_STRUCT *prstatus; /* points inside note_phdr */
int n_threads;
- struct PRSTATUS_STRUCT **threads;
-
+ struct PRSTATUS_STRUCT *threads;
struct elf_dyn_info edi;
};
-extern coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip);
-#define STRUCT_MEMBER_P(struct_p, struct_offset) ((void *) ((char*) (struct_p) + (long) (struct_offset)))
-#define STRUCT_MEMBER(member_type, struct_p, struct_offset) (*(member_type*) STRUCT_MEMBER_P ((struct_p), (struct_offset)))
+typedef int (*note_visitor_t)(uint32_t, uint32_t, uint32_t, char *, uint8_t *, void *);
+
+
+coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip);
+
+int _UCD_elf_read_segment(struct UCD_info *ui, coredump_phdr_t *phdr, uint8_t **segment, size_t *segment_size);
+int _UCD_elf_visit_notes(uint8_t *segment, size_t segment_size, note_visitor_t visit, void *arg);
+int _UCD_get_threadinfo(struct UCD_info *ui, coredump_phdr_t *phdrs, unsigned phdr_size);
+int _UCD_get_mapinfo(struct UCD_info *ui, coredump_phdr_t *phdrs, unsigned phdr_size);
+
#endif
diff --git a/src/third_party/unwind/dist/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/third_party/unwind/dist/src/coredump/_UPT_get_dyn_info_list_addr.c
index 739ed0569b9..7548d63320f 100644
--- a/src/third_party/unwind/dist/src/coredump/_UPT_get_dyn_info_list_addr.c
+++ b/src/third_party/unwind/dist/src/coredump/_UPT_get_dyn_info_list_addr.c
@@ -26,9 +26,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "_UCD_lib.h"
#include "_UCD_internal.h"
-#if UNW_TARGET_IA64 && defined(__linux)
+#if UNW_TARGET_IA64 && defined(__linux__)
# include "elf64.h"
# include "os-linux.h"
+# include "../ptrace/_UPT_internal.h"
static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
@@ -38,28 +39,26 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
struct UPT_info *ui = arg;
struct map_iterator mi;
char path[PATH_MAX];
- unw_dyn_info_t *di;
unw_word_t res;
int count = 0;
maps_init (&mi, ui->pid);
- while (maps_next (&mi, &lo, &hi, &off))
+ while (maps_next (&mi, &lo, &hi, &off, NULL))
{
if (off)
continue;
- invalidate_edi (&ui->edi);
+ invalidate_edi(&ui->edi);
- if (elf_map_image (&ui->ei, path) < 0)
+ if (elf_map_image (&ui->edi.ei, path) < 0)
/* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
continue;
Debug (16, "checking object %s\n", path);
- di = tdep_find_unwind_table (&ui->edi, as, path, lo, off);
- if (di)
+ if (tdep_find_unwind_table (&ui->edi, as, path, lo, off, 0) > 0)
{
- res = _Uia64_find_dyn_list (as, di, arg);
+ res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg);
if (res && count++ == 0)
{
Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res);
diff --git a/src/third_party/unwind/dist/src/dl-iterate-phdr.c b/src/third_party/unwind/dist/src/dl-iterate-phdr.c
new file mode 100644
index 00000000000..b14b765d9bf
--- /dev/null
+++ b/src/third_party/unwind/dist/src/dl-iterate-phdr.c
@@ -0,0 +1,95 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if defined(__ANDROID__) && __ANDROID_API__ < 21
+
+#include <dlfcn.h>
+#include <link.h>
+
+#include "libunwind_i.h"
+#include "os-linux.h"
+
+#ifndef IS_ELF
+/* Copied from NDK header. */
+#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
+ (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
+ (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
+ (ehdr).e_ident[EI_MAG3] == ELFMAG3)
+#endif
+
+typedef int (*unw_iterate_phdr_impl) (int (*callback) (
+ struct dl_phdr_info *info,
+ size_t size, void *data),
+ void *data);
+
+HIDDEN int
+dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data),
+ void *data)
+{
+ static int initialized = 0;
+ static unw_iterate_phdr_impl libc_impl;
+ int rc = 0;
+ struct map_iterator mi;
+ unsigned long start, end, offset, flags;
+
+ if (!initialized)
+ {
+ libc_impl = dlsym (RTLD_NEXT, "dl_iterate_phdr");
+ initialized = 1;
+ }
+
+ if (libc_impl != NULL)
+ return libc_impl (callback, data);
+
+ if (maps_init (&mi, getpid()) < 0)
+ return -1;
+
+ while (maps_next (&mi, &start, &end, &offset, &flags))
+ {
+ Elf_W(Ehdr) *ehdr = (Elf_W(Ehdr) *) start;
+ Dl_info canonical_info;
+
+ if (mi.path[0] != '\0' && (flags & PROT_READ) != 0 && IS_ELF (*ehdr)
+ && dladdr (ehdr, &canonical_info) != 0
+ && ehdr == canonical_info.dli_fbase)
+ {
+ struct dl_phdr_info info;
+ Elf_W(Phdr) *phdr = (Elf_W(Phdr) *) (start + ehdr->e_phoff);
+
+ info.dlpi_addr = start;
+ info.dlpi_name = canonical_info.dli_fname;
+ info.dlpi_phdr = phdr;
+ info.dlpi_phnum = ehdr->e_phnum;
+
+ rc = callback (&info, sizeof (info), data);
+ }
+ }
+
+ maps_close (&mi);
+
+ return rc;
+}
+
+#endif
diff --git a/src/third_party/unwind/dist/src/dwarf/Gexpr.c b/src/third_party/unwind/dist/src/dwarf/Gexpr.c
index 2af454332dd..963a064def0 100644
--- a/src/third_party/unwind/dist/src/dwarf/Gexpr.c
+++ b/src/third_party/unwind/dist/src/dwarf/Gexpr.c
@@ -251,18 +251,26 @@ dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t stack_val, unw_word_t *addr,
uint32_t u32;
uint64_t u64;
int ret;
+ unw_word_t stackerror = 0;
+
+// pop() is either followed by a semicolon or
+// used in a push() macro
+// In either case we can sneak in an extra statement
# define pop() \
-({ \
- if ((tos - 1) >= MAX_EXPR_STACK_SIZE) \
- { \
- Debug (1, "Stack underflow\n"); \
- return -UNW_EINVAL; \
- } \
- stack[--tos]; \
-})
+(((tos - 1) >= MAX_EXPR_STACK_SIZE) ? \
+ stackerror++ : stack[--tos]); \
+if (stackerror) \
+ { \
+ Debug (1, "Stack underflow\n"); \
+ return -UNW_EINVAL; \
+ }
+
+// Removed the parentheses on the asignment
+// to allow the extra stack error check
+// when x is evaluated
# define push(x) \
do { \
- unw_word_t _x = (x); \
+ unw_word_t _x = x; \
if (tos >= MAX_EXPR_STACK_SIZE) \
{ \
Debug (1, "Stack overflow\n"); \
@@ -270,16 +278,17 @@ do { \
} \
stack[tos++] = _x; \
} while (0)
+
+// Pick is always used in a push() macro
+// In either case we can sneak in an extra statement
# define pick(n) \
-({ \
- unsigned int _index = tos - 1 - (n); \
- if (_index >= MAX_EXPR_STACK_SIZE) \
- { \
- Debug (1, "Out-of-stack pick\n"); \
- return -UNW_EINVAL; \
- } \
- stack[_index]; \
-})
+(((tos - 1 - (n)) >= MAX_EXPR_STACK_SIZE) ? \
+ stackerror++ : stack[tos - 1 - (n)]); \
+if (stackerror) \
+ { \
+ Debug (1, "Out-of-stack pick\n"); \
+ return -UNW_EINVAL; \
+ }
as = c->as;
arg = c->as_arg;
diff --git a/src/third_party/unwind/dist/src/dwarf/Gfde.c b/src/third_party/unwind/dist/src/dwarf/Gfde.c
index 9250b895eab..3d3edaac1b8 100644
--- a/src/third_party/unwind/dist/src/dwarf/Gfde.c
+++ b/src/third_party/unwind/dist/src/dwarf/Gfde.c
@@ -48,6 +48,7 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr,
int is_debug_frame, void *arg)
{
uint8_t version, ch, augstr[5], fde_encoding, handler_encoding;
+ uint8_t address_size, segment_size;
unw_word_t len, cie_end_addr, aug_size;
uint32_t u32val;
uint64_t u64val;
@@ -138,6 +139,15 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr,
augstr[i++] = ch;
}
+ if (version > 3)
+ {
+ if((ret = dwarf_readu8(as, a, &addr, &address_size, arg)) < 0)
+ return ret;
+
+ if((ret = dwarf_readu8(as, a, &addr, &segment_size, arg)) < 0)
+ return ret;
+ }
+
if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->code_align, arg)) < 0
|| (ret = dwarf_read_sleb128 (as, a, &addr, &dci->data_align, arg)) < 0)
return ret;
diff --git a/src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c b/src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c
index 7ab60a3f911..35bb2df0593 100644
--- a/src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c
+++ b/src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c
@@ -46,7 +46,7 @@ struct table_entry
#ifndef UNW_REMOTE_ONLY
-#ifdef __linux
+#ifdef __linux__
#include "os-linux.h"
#endif
@@ -107,13 +107,18 @@ linear_search (unw_addr_space_t as, unw_word_t ip,
/* XXX: Could use mmap; but elf_map_image keeps tons mapped in. */
static int
-load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
+load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local,
+ unw_word_t segbase, unw_word_t *load_offset)
{
struct elf_image ei;
+ Elf_W (Ehdr) *ehdr;
+ Elf_W (Phdr) *phdr;
Elf_W (Shdr) *shdr;
+ int i;
int ret;
ei.image = NULL;
+ *load_offset = 0;
ret = elf_w (load_debuglink) (file, &ei, is_local);
if (ret != 0)
@@ -136,7 +141,15 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
if (chdr->ch_type == ELFCOMPRESS_ZLIB)
{
*bufsize = destSize = chdr->ch_size;
- GET_MEMORY(*buf, *bufsize);
+
+ GET_MEMORY (*buf, *bufsize);
+ if (!*buf)
+ {
+ Debug (2, "failed to allocate zlib .debug_frame buffer, skipping\n");
+ munmap(ei.image, ei.size);
+ return 1;
+ }
+
ret = uncompress((unsigned char *)*buf, &destSize,
shdr->sh_offset + ei.image + sizeof(*chdr),
shdr->sh_size - sizeof(*chdr));
@@ -164,7 +177,14 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
{
#endif
*bufsize = shdr->sh_size;
- GET_MEMORY(*buf, *bufsize);
+
+ GET_MEMORY (*buf, *bufsize);
+ if (!*buf)
+ {
+ Debug (2, "failed to allocate .debug_frame buffer, skipping\n");
+ munmap(ei.image, ei.size);
+ return 1;
+ }
memcpy(*buf, shdr->sh_offset + ei.image, *bufsize);
@@ -173,6 +193,20 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
#if defined(SHF_COMPRESSED)
}
#endif
+
+ ehdr = ei.image;
+ phdr = (Elf_W (Phdr) *) ((char *) ei.image + ehdr->e_phoff);
+
+ for (i = 0; i < ehdr->e_phnum; ++i)
+ if (phdr[i].p_type == PT_LOAD)
+ {
+ *load_offset = segbase - phdr[i].p_vaddr;
+
+ Debug (4, "%s load offset is 0x%zx\n", file, *load_offset);
+
+ break;
+ }
+
munmap(ei.image, ei.size);
return 0;
}
@@ -184,7 +218,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
static int
find_binary_for_address (unw_word_t ip, char *name, size_t name_size)
{
-#if defined(__linux) && (!UNW_REMOTE_ONLY)
+#if defined(__linux__) && (!UNW_REMOTE_ONLY)
struct map_iterator mi;
int found = 0;
int pid = getpid ();
@@ -193,7 +227,7 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size)
if (maps_init (&mi, pid) != 0)
return 1;
- while (maps_next (&mi, &segbase, &hi, &mapoff))
+ while (maps_next (&mi, &segbase, &hi, &mapoff, NULL))
if (ip >= segbase && ip < hi)
{
size_t len = strlen (mi.path);
@@ -216,8 +250,8 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size)
pointer to debug frame descriptor, or zero if not found. */
static struct unw_debug_frame_list *
-locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname,
- unw_word_t start, unw_word_t end)
+locate_debug_info (unw_addr_space_t as, unw_word_t addr, unw_word_t segbase,
+ const char *dlname, unw_word_t start, unw_word_t end)
{
struct unw_debug_frame_list *w, *fdesc = 0;
char path[PATH_MAX];
@@ -225,6 +259,7 @@ locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname,
int err;
char *buf;
size_t bufsize;
+ unw_word_t load_offset;
/* First, see if we loaded this frame already. */
@@ -251,14 +286,21 @@ locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname,
else
name = (char*) dlname;
- err = load_debug_frame (name, &buf, &bufsize, as == unw_local_addr_space);
+ err = load_debug_frame (name, &buf, &bufsize, as == unw_local_addr_space,
+ segbase, &load_offset);
if (!err)
{
- GET_MEMORY(fdesc, sizeof (struct unw_debug_frame_list));
+ GET_MEMORY (fdesc, sizeof (struct unw_debug_frame_list));
+ if (!fdesc)
+ {
+ Debug (2, "failed to allocate frame list entry\n");
+ return 0;
+ }
fdesc->start = start;
fdesc->end = end;
+ fdesc->load_offset = load_offset;
fdesc->debug_frame = buf;
fdesc->debug_frame_size = bufsize;
fdesc->index = NULL;
@@ -396,7 +438,8 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip,
Debug (15, "Trying to find .debug_frame for %s\n", obj_name);
- fdesc = locate_debug_info (unw_local_addr_space, ip, obj_name, start, end);
+ fdesc = locate_debug_info (unw_local_addr_space, ip, segbase, obj_name, start,
+ end);
if (!fdesc)
{
@@ -454,6 +497,7 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip,
di->format = UNW_INFO_FORMAT_TABLE;
di->start_ip = fdesc->start;
di->end_ip = fdesc->end;
+ di->load_offset = fdesc->load_offset;
di->u.ti.name_ptr = (unw_word_t) (uintptr_t) obj_name;
di->u.ti.table_data = (unw_word_t *) fdesc;
di->u.ti.table_len = sizeof (*fdesc) / sizeof (unw_word_t);
@@ -916,12 +960,14 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
ip_base = segbase;
}
+ Debug (6, "lookup IP 0x%lx\n", (long) (ip - ip_base - di->load_offset));
+
#ifndef UNW_REMOTE_ONLY
if (as == unw_local_addr_space)
{
- e = lookup (table, table_len, ip - ip_base);
- if (e && &e[1] < &table[table_len])
- last_ip = e[1].start_ip_offset + ip_base;
+ e = lookup (table, table_len, ip - ip_base - di->load_offset);
+ if (e && &e[1] < &table[table_len / sizeof (unw_word_t)])
+ last_ip = e[1].start_ip_offset + ip_base + di->load_offset;
else
last_ip = di->end_ip;
}
@@ -929,7 +975,7 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
#endif
{
#ifndef UNW_LOCAL_ONLY
- int32_t last_ip_offset = di->end_ip - ip_base;
+ int32_t last_ip_offset = di->end_ip - ip_base - di->load_offset;
segbase = di->u.rti.segbase;
if ((ret = remote_lookup (as, (uintptr_t) table, table_len,
ip - ip_base, &ent, &last_ip_offset, arg)) < 0)
@@ -937,7 +983,7 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
if (ret)
{
e = &ent;
- last_ip = last_ip_offset + ip_base;
+ last_ip = last_ip_offset + ip_base + di->load_offset;
}
else
e = NULL; /* no info found */
@@ -951,8 +997,8 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
unwind info. */
return -UNW_ENOINFO;
}
- Debug (15, "ip=0x%lx, start_ip=0x%lx\n",
- (long) ip, (long) (e->start_ip_offset));
+ Debug (15, "ip=0x%lx, load_offset=0x%lx, start_ip=0x%lx\n",
+ (long) ip, (long) di->load_offset, (long) (e->start_ip_offset));
if (debug_frame_base)
fde_addr = e->fde_offset + debug_frame_base;
else
@@ -976,6 +1022,9 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
pi->flags = UNW_PI_FLAG_DEBUG_FRAME;
}
+ pi->start_ip += di->load_offset;
+ pi->end_ip += di->load_offset;
+
#if defined(NEED_LAST_IP)
pi->last_ip = last_ip;
#else
diff --git a/src/third_party/unwind/dist/src/dwarf/Gfind_unwind_table.c b/src/third_party/unwind/dist/src/dwarf/Gfind_unwind_table.c
index f5f7ad06c3b..a6198ad2f31 100644
--- a/src/third_party/unwind/dist/src/dwarf/Gfind_unwind_table.c
+++ b/src/third_party/unwind/dist/src/dwarf/Gfind_unwind_table.c
@@ -193,6 +193,7 @@ dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
edi->di_cache.start_ip = start_ip;
edi->di_cache.end_ip = end_ip;
+ edi->di_cache.load_offset = 0;
edi->di_cache.format = UNW_INFO_FORMAT_REMOTE_TABLE;
edi->di_cache.u.rti.name_ptr = 0;
/* two 32-bit values (ip_offset/fde_offset) per table-entry: */
diff --git a/src/third_party/unwind/dist/src/dwarf/Gparser.c b/src/third_party/unwind/dist/src/dwarf/Gparser.c
index 28fd73c6b0f..70a62c50573 100644
--- a/src/third_party/unwind/dist/src/dwarf/Gparser.c
+++ b/src/third_party/unwind/dist/src/dwarf/Gparser.c
@@ -508,6 +508,9 @@ setup_fde (struct dwarf_cursor *c, dwarf_state_record_t *sr)
for (i = 0; i < DWARF_NUM_PRESERVED_REGS + 2; ++i)
set_reg (sr, i, DWARF_WHERE_SAME, 0);
+ // SP defaults to CFA (but is overridable)
+ set_reg (sr, TDEP_DWARF_SP, DWARF_WHERE_CFA, 0);
+
struct dwarf_cie_info *dci = c->pi.unwind_info;
sr->rs_current.ret_addr_column = dci->ret_addr_column;
unw_word_t addr = dci->cie_instr_start;
@@ -601,10 +604,10 @@ get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
if (caching == UNW_CACHE_NONE)
return NULL;
-#if defined(HAVE___THREAD) && HAVE___THREAD
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
if (likely (caching == UNW_CACHE_PER_THREAD))
{
- static __thread struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec")));
+ static _Thread_local struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec")));
Debug (16, "using TLS cache\n");
cache = &tls_cache;
}
@@ -617,14 +620,14 @@ get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
lock_acquire (&cache->lock, *saved_maskp);
}
- if ((atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
+ if ((atomic_load (&as->cache_generation) != atomic_load (&cache->generation))
|| !cache->hash)
{
/* cache_size is only set in the global_cache, copy it over before flushing */
cache->log_size = as->global_cache.log_size;
if (dwarf_flush_rs_cache (cache) < 0)
return NULL;
- cache->generation = as->cache_generation;
+ atomic_store (&cache->generation, atomic_load (&as->cache_generation));
}
return cache;
@@ -792,14 +795,14 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
/* As a special-case, if the stack-pointer is the CFA and the
stack-pointer wasn't saved, popping the CFA implicitly pops
the stack-pointer as well. */
- if ((rs->reg.val[DWARF_CFA_REG_COLUMN] == UNW_TDEP_SP)
- && (UNW_TDEP_SP < ARRAY_SIZE(rs->reg.val))
- && (rs->reg.where[UNW_TDEP_SP] == DWARF_WHERE_SAME))
+ if ((rs->reg.val[DWARF_CFA_REG_COLUMN] == TDEP_DWARF_SP)
+ && (TDEP_DWARF_SP < ARRAY_SIZE(rs->reg.val))
+ && (DWARF_IS_NULL_LOC(c->loc[TDEP_DWARF_SP])))
cfa = c->cfa;
else
{
regnum = dwarf_to_unw_regnum (rs->reg.val[DWARF_CFA_REG_COLUMN]);
- if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0)
+ if ((ret = unw_get_reg (dwarf_to_cursor(c), regnum, &cfa)) < 0)
return ret;
}
cfa += rs->reg.val[DWARF_CFA_OFF_COLUMN];
@@ -836,6 +839,10 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
case DWARF_WHERE_SAME:
break;
+ case DWARF_WHERE_CFA:
+ new_loc[i] = DWARF_VAL_LOC (c, cfa);
+ break;
+
case DWARF_WHERE_CFAREL:
new_loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg.val[i]);
break;
diff --git a/src/third_party/unwind/dist/src/elf32.h b/src/third_party/unwind/dist/src/elf32.h
index 2c7bca4c9dc..9747630a3d7 100644
--- a/src/third_party/unwind/dist/src/elf32.h
+++ b/src/third_party/unwind/dist/src/elf32.h
@@ -1,8 +1,8 @@
#ifndef elf32_h
#define elf32_h
-#ifndef ELF_CLASS
-#define ELF_CLASS ELFCLASS32
+#ifndef UNW_ELF_CLASS
+# define UNW_ELF_CLASS UNW_ELFCLASS32
#endif
#include "elfxx.h"
diff --git a/src/third_party/unwind/dist/src/elf64.h b/src/third_party/unwind/dist/src/elf64.h
index 091fba8e1f8..1956c73c979 100644
--- a/src/third_party/unwind/dist/src/elf64.h
+++ b/src/third_party/unwind/dist/src/elf64.h
@@ -1,8 +1,8 @@
#ifndef elf64_h
#define elf64_h
-#ifndef ELF_CLASS
-#define ELF_CLASS ELFCLASS64
+#ifndef UNW_ELF_CLASS
+# define UNW_ELF_CLASS UNW_ELFCLASS64
#endif
#include "elfxx.h"
diff --git a/src/third_party/unwind/dist/src/elfxx.c b/src/third_party/unwind/dist/src/elfxx.c
index 2589a3d43b6..321cfb979b7 100644
--- a/src/third_party/unwind/dist/src/elfxx.c
+++ b/src/third_party/unwind/dist/src/elfxx.c
@@ -165,14 +165,19 @@ elf_w (get_load_offset) (struct elf_image *ei, unsigned long segbase,
Elf_W (Ehdr) *ehdr;
Elf_W (Phdr) *phdr;
int i;
+ // mapoff is obtained from mmap informations, so is always aligned on a page size.
+ // PT_LOAD program headers p_offset however is not guaranteed to be aligned on a
+ // page size, ld.lld generate libraries where this is not the case. So we must
+ // make sure we compare both values with the same alignment.
+ unsigned long pagesize_alignment_mask = ~(((unsigned long)getpagesize()) - 1UL);
ehdr = ei->image;
phdr = (Elf_W (Phdr) *) ((char *) ei->image + ehdr->e_phoff);
for (i = 0; i < ehdr->e_phnum; ++i)
- if (phdr[i].p_type == PT_LOAD && phdr[i].p_offset == mapoff)
+ if (phdr[i].p_type == PT_LOAD && (phdr[i].p_offset & pagesize_alignment_mask) == mapoff)
{
- offset = segbase - phdr[i].p_vaddr;
+ offset = segbase - phdr[i].p_vaddr + (phdr[i].p_offset & (~pagesize_alignment_mask));
break;
}
diff --git a/src/third_party/unwind/dist/src/elfxx.h b/src/third_party/unwind/dist/src/elfxx.h
index 830432c2ed1..fe5fcbcdfd4 100644
--- a/src/third_party/unwind/dist/src/elfxx.h
+++ b/src/third_party/unwind/dist/src/elfxx.h
@@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "libunwind_i.h"
-#if ELF_CLASS == ELFCLASS32
+#if UNW_ELF_CLASS == UNW_ELFCLASS32
# define ELF_W(x) ELF32_##x
# define Elf_W(x) Elf32_##x
# define elf_w(x) _Uelf32_##x
@@ -64,7 +64,7 @@ elf_w (valid_object) (struct elf_image *ei)
return 0;
return (memcmp (ei->image, ELFMAG, SELFMAG) == 0
- && ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS
+ && ((uint8_t *) ei->image)[EI_CLASS] == UNW_ELF_CLASS
&& ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE
&& ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT);
}
diff --git a/src/third_party/unwind/dist/src/hppa/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/hppa/Gcreate_addr_space.c
index 8a6cb8b4e67..4e197c4b570 100644
--- a/src/third_party/unwind/dist/src/hppa/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/hppa/Gcreate_addr_space.c
@@ -38,7 +38,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
/*
* hppa supports only big-endian.
*/
- if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order != UNW_BIG_ENDIAN)
return NULL;
as = malloc (sizeof (*as));
diff --git a/src/third_party/unwind/dist/src/hppa/Gglobal.c b/src/third_party/unwind/dist/src/hppa/Gglobal.c
index 351a5015d68..a5935ffbac1 100644
--- a/src/third_party/unwind/dist/src/hppa/Gglobal.c
+++ b/src/third_party/unwind/dist/src/hppa/Gglobal.c
@@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
HIDDEN define_lock (hppa_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
HIDDEN void
tdep_init (void)
@@ -37,7 +37,7 @@ tdep_init (void)
lock_acquire (&hppa_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -48,7 +48,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
hppa_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&hppa_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/hppa/Ginit_local.c b/src/third_party/unwind/dist/src/hppa/Ginit_local.c
index 1fdc7716fd5..73a716d1558 100644
--- a/src/third_party/unwind/dist/src/hppa/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/hppa/Ginit_local.c
@@ -41,7 +41,7 @@ unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_i
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/hppa/Ginit_remote.c b/src/third_party/unwind/dist/src/hppa/Ginit_remote.c
index 71096ce0e61..57691e3f2ab 100644
--- a/src/third_party/unwind/dist/src/hppa/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/hppa/Ginit_remote.c
@@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/hppa/Gresume.c b/src/third_party/unwind/dist/src/hppa/Gresume.c
index 6c11f140364..24f85f23424 100644
--- a/src/third_party/unwind/dist/src/hppa/Gresume.c
+++ b/src/third_party/unwind/dist/src/hppa/Gresume.c
@@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef UNW_REMOTE_ONLY
-#if defined(__linux)
+#if defined(__linux__)
# include <sys/syscall.h>
@@ -48,12 +48,12 @@ my_rt_sigreturn (void *new_sp, int in_syscall)
abort ();
}
-#endif /* __linux */
+#endif /* __linux__ */
HIDDEN inline int
hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
-#if defined(__linux)
+#if defined(__linux__)
struct cursor *c = (struct cursor *) cursor;
ucontext_t *uc = c->dwarf.as_arg;
diff --git a/src/third_party/unwind/dist/src/ia64/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/ia64/Gcreate_addr_space.c
index 7ad29cbbd39..27a8e713cb3 100644
--- a/src/third_party/unwind/dist/src/ia64/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/ia64/Gcreate_addr_space.c
@@ -39,9 +39,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
* IA-64 supports only big or little-endian, not weird stuff like
* PDP_ENDIAN.
*/
- if (byte_order != 0
- && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -55,9 +53,9 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
if (byte_order == 0)
/* use host default: */
- as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ as->big_endian = target_is_big_endian();
else
- as->big_endian = (byte_order == __BIG_ENDIAN);
+ as->big_endian = byte_order_is_big_endian(byte_order);
return as;
#endif
}
diff --git a/src/third_party/unwind/dist/src/ia64/Gglobal.c b/src/third_party/unwind/dist/src/ia64/Gglobal.c
index 5c6156f0e22..43dc1dcca53 100644
--- a/src/third_party/unwind/dist/src/ia64/Gglobal.c
+++ b/src/third_party/unwind/dist/src/ia64/Gglobal.c
@@ -72,7 +72,7 @@ tdep_init (void)
lock_acquire (&unw.lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -115,7 +115,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
ia64_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&unw.lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/ia64/Ginit.c b/src/third_party/unwind/dist/src/ia64/Ginit.c
index 8601bb3ca88..4c70a33ccd8 100644
--- a/src/third_party/unwind/dist/src/ia64/Ginit.c
+++ b/src/third_party/unwind/dist/src/ia64/Ginit.c
@@ -356,8 +356,8 @@ HIDDEN void
ia64_local_addr_space_init (void)
{
memset (&local_addr_space, 0, sizeof (local_addr_space));
- local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
-#if defined(__linux)
+ local_addr_space.big_endian = target_is_big_endian();
+#if defined(__linux__)
local_addr_space.abi = ABI_LINUX;
#elif defined(__hpux)
local_addr_space.abi = ABI_HPUX;
@@ -407,7 +407,7 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp,
become possible at some point in the future, the
copy-in/copy-out needs to be adjusted to do byte-swapping if
necessary. */
- assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));
+ assert (c->as->big_endian == target_is_big_endian());
dst = (unw_word_t *) ucp;
for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8)
@@ -475,7 +475,7 @@ ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp,
become possible at some point in the future, the
copy-in/copy-out needs to be adjusted to do byte-swapping if
necessary. */
- assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));
+ assert (c->as->big_endian == target_is_big_endian());
dst = (unw_word_t *) ucp;
for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8)
diff --git a/src/third_party/unwind/dist/src/ia64/Ginit_local.c b/src/third_party/unwind/dist/src/ia64/Ginit_local.c
index 8fe1c679b29..2455dd285e5 100644
--- a/src/third_party/unwind/dist/src/ia64/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/ia64/Ginit_local.c
@@ -39,7 +39,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
static inline void
set_as_arg (struct cursor *c, unw_context_t *uc)
{
-#if defined(__linux) && defined(__KERNEL__)
+#if defined(__linux__) && defined(__KERNEL__)
c->task = current;
c->as_arg = &uc->sw;
#else
@@ -51,7 +51,7 @@ static inline int
get_initial_stack_pointers (struct cursor *c, unw_context_t *uc,
unw_word_t *sp, unw_word_t *bsp)
{
-#if defined(__linux)
+#if defined(__linux__)
unw_word_t sol, bspstore;
#ifdef __KERNEL__
@@ -83,7 +83,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
unw_word_t sp, bsp;
int ret;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/ia64/Ginit_remote.c b/src/third_party/unwind/dist/src/ia64/Ginit_remote.c
index b570c7eab39..8894a08666d 100644
--- a/src/third_party/unwind/dist/src/ia64/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/ia64/Ginit_remote.c
@@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
unw_word_t sp, bsp;
int ret;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/ia64/Gregs.c b/src/third_party/unwind/dist/src/ia64/Gregs.c
index ac6f738a6cd..f2fd0fd846d 100644
--- a/src/third_party/unwind/dist/src/ia64/Gregs.c
+++ b/src/third_party/unwind/dist/src/ia64/Gregs.c
@@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
static inline ia64_loc_t
linux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr)
{
-#if !defined(UNW_LOCAL_ONLY) || defined(__linux)
+#if !defined(UNW_LOCAL_ONLY) || defined(__linux__)
unw_word_t addr = c->sigcontext_addr, flags, tmp_addr;
int i;
diff --git a/src/third_party/unwind/dist/src/ia64/Gresume.c b/src/third_party/unwind/dist/src/ia64/Gresume.c
index 68fe8a659ef..9fc6bc7ad70 100644
--- a/src/third_party/unwind/dist/src/ia64/Gresume.c
+++ b/src/third_party/unwind/dist/src/ia64/Gresume.c
@@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
static inline int
local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
-#if defined(__linux)
+#if defined(__linux__)
unw_word_t dirty_partition[2048]; /* AR.RSC.LOADRS is a 14-bit field */
unw_word_t val, sol, sof, pri_unat, n, pfs, bspstore, dirty_rnat;
struct cursor *c = (struct cursor *) cursor;
@@ -184,7 +184,7 @@ remote_install_cursor (struct cursor *c)
unw_word_t val;
int reg;
-#if defined(__linux) && !defined(UNW_REMOTE_ONLY)
+#if defined(__linux__) && !defined(UNW_REMOTE_ONLY)
if (c->as == unw_local_addr_space)
{
/* Take a short-cut: we directly resume out of the cursor and
@@ -233,7 +233,7 @@ remote_install_cursor (struct cursor *c)
MEMIFY (IA64_REG_F31, UNW_IA64_FR + 31);
}
else
-#endif /* __linux && !UNW_REMOTE_ONLY */
+#endif /* __linux__ && !UNW_REMOTE_ONLY */
{
access_reg = c->as->acc.access_reg;
access_fpreg = c->as->acc.access_fpreg;
diff --git a/src/third_party/unwind/dist/src/ia64/Gscript.c b/src/third_party/unwind/dist/src/ia64/Gscript.c
index 526aeaf299e..ea5ac15f53e 100644
--- a/src/third_party/unwind/dist/src/ia64/Gscript.c
+++ b/src/third_party/unwind/dist/src/ia64/Gscript.c
@@ -26,6 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "offsets.h"
#include "regs.h"
#include "unwind_i.h"
+#include <stdatomic.h>
enum ia64_script_insn_opcode
{
@@ -45,14 +46,10 @@ enum ia64_script_insn_opcode
IA64_INSN_MOVE_SCRATCH_NO_NAT /* like above, but clear NaT info */
};
-#if defined(HAVE___THREAD) && HAVE___THREAD
-static __thread struct ia64_script_cache ia64_per_thread_cache =
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
+static _Thread_local struct ia64_script_cache ia64_per_thread_cache =
{
-#ifdef HAVE_ATOMIC_OPS_H
- .busy = AO_TS_INITIALIZER
-#else
- .lock = PTHREAD_MUTEX_INITIALIZER
-#endif
+ .busy = ATOMIC_FLAG_INIT
};
#endif
@@ -101,30 +98,18 @@ get_script_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
if (caching == UNW_CACHE_NONE)
return NULL;
-#ifdef HAVE_ATOMIC_H
- if (!spin_trylock_irqsave (&cache->busy, *saved_maskp))
- return NULL;
-#else
-# if defined(HAVE___THREAD) && HAVE___THREAD
+# if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
if (as->caching_policy == UNW_CACHE_PER_THREAD)
cache = &ia64_per_thread_cache;
+ else
# endif
-# ifdef HAVE_ATOMIC_OPS_H
- if (AO_test_and_set (&cache->busy) == AO_TS_SET)
+ if (atomic_flag_test_and_set(&cache->busy))
return NULL;
-# else
- if (likely (caching == UNW_CACHE_GLOBAL))
- {
- Debug (16, "acquiring lock\n");
- lock_acquire (&cache->lock, *saved_maskp);
- }
-# endif
-#endif
- if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
+ if (atomic_load (&as->cache_generation) != atomic_load (&cache->generation))
{
flush_script_cache (cache);
- cache->generation = as->cache_generation;
+ atomic_store(&cache->generation, atomic_load (&as->cache_generation));
}
return cache;
}
@@ -136,16 +121,7 @@ put_script_cache (unw_addr_space_t as, struct ia64_script_cache *cache,
assert (as->caching_policy != UNW_CACHE_NONE);
Debug (16, "unmasking signals/interrupts and releasing lock\n");
-#ifdef HAVE_ATOMIC_H
- spin_unlock_irqrestore (&cache->busy, *saved_maskp);
-#else
-# ifdef HAVE_ATOMIC_OPS_H
- AO_CLEAR (&cache->busy);
-# else
- if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
- lock_release (&cache->lock, *saved_maskp);
-# endif
-#endif
+ atomic_flag_clear(&cache->busy);
}
static struct ia64_script *
diff --git a/src/third_party/unwind/dist/src/ia64/Gstep.c b/src/third_party/unwind/dist/src/ia64/Gstep.c
index df4ecb8796c..70455e3ae20 100644
--- a/src/third_party/unwind/dist/src/ia64/Gstep.c
+++ b/src/third_party/unwind/dist/src/ia64/Gstep.c
@@ -30,7 +30,7 @@ static inline int
linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc,
unw_word_t *num_regsp)
{
-#if defined(UNW_LOCAL_ONLY) && !defined(__linux)
+#if defined(UNW_LOCAL_ONLY) && !defined(__linux__)
return -UNW_EINVAL;
#else
unw_word_t sc_addr;
@@ -64,7 +64,7 @@ static inline int
linux_interrupt (struct cursor *c, ia64_loc_t prev_cfm_loc,
unw_word_t *num_regsp, int marker)
{
-#if defined(UNW_LOCAL_ONLY) && !(defined(__linux) && defined(__KERNEL__))
+#if defined(UNW_LOCAL_ONLY) && !(defined(__linux__) && defined(__KERNEL__))
return -UNW_EINVAL;
#else
unw_word_t sc_addr, num_regs;
diff --git a/src/third_party/unwind/dist/src/ia64/dyn_info_list.S b/src/third_party/unwind/dist/src/ia64/dyn_info_list.S
index 31265f66a06..125a9efdb47 100644
--- a/src/third_party/unwind/dist/src/ia64/dyn_info_list.S
+++ b/src/third_party/unwind/dist/src/ia64/dyn_info_list.S
@@ -16,7 +16,7 @@
string "dyn-list" /* lsda */
data8 @gprel(_U_dyn_info_list)
- .section .IA_64.unwind, "a", "progbits"
+ .section .IA_64.unwind, "ao", "unwind"
data8 0, 0, @segrel(.info)
#endif
diff --git a/src/third_party/unwind/dist/src/ia64/mk_Gcursor_i.c b/src/third_party/unwind/dist/src/ia64/mk_Gcursor_i.c
new file mode 100644
index 00000000000..67b14d52ba3
--- /dev/null
+++ b/src/third_party/unwind/dist/src/ia64/mk_Gcursor_i.c
@@ -0,0 +1,65 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Utility to generate cursor_i.h. */
+
+#include "libunwind_i.h"
+
+#ifdef offsetof
+# undef offsetof
+#endif
+
+#define offsetof(type,field) ((char *) &((type *) 0)->field - (char *) 0)
+
+#define OFFSET(sym, offset) \
+ asm volatile("\n->" #sym " %0" : : "i" (offset))
+
+int
+main (void)
+{
+ OFFSET("IP_OFF", offsetof (struct cursor, ip));
+ OFFSET("PR_OFF", offsetof (struct cursor, pr));
+ OFFSET("BSP_OFF", offsetof (struct cursor, bsp));
+ OFFSET("PSP_OFF", offsetof (struct cursor, psp));
+ OFFSET("PFS_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_PFS]));
+ OFFSET("RNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_RNAT]));
+ OFFSET("UNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_UNAT]));
+ OFFSET("LC_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_LC]));
+ OFFSET("FPSR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_FPSR]));
+ OFFSET("B1_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B1]));
+ OFFSET("B2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B2]));
+ OFFSET("B3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B3]));
+ OFFSET("B4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B4]));
+ OFFSET("B5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B5]));
+ OFFSET("F2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F2]));
+ OFFSET("F3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F3]));
+ OFFSET("F4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F4]));
+ OFFSET("F5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F5]));
+ OFFSET("FR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F16]));
+ OFFSET("LOC_SIZE",
+ (offsetof (struct cursor, loc[1]) - offsetof (struct cursor, loc[0])));
+ OFFSET("SIGCONTEXT_ADDR_OFF", offsetof (struct cursor, sigcontext_addr));
+ return 0;
+}
diff --git a/src/third_party/unwind/dist/src/ia64/mk_Lcursor_i.c b/src/third_party/unwind/dist/src/ia64/mk_Lcursor_i.c
new file mode 100644
index 00000000000..aee2e7eeb8d
--- /dev/null
+++ b/src/third_party/unwind/dist/src/ia64/mk_Lcursor_i.c
@@ -0,0 +1,2 @@
+#define UNW_LOCAL_ONLY
+#include "mk_Gcursor_i.c"
diff --git a/src/third_party/unwind/dist/src/ia64/mk_cursor_i b/src/third_party/unwind/dist/src/ia64/mk_cursor_i
new file mode 100755
index 00000000000..9211f91bbbb
--- /dev/null
+++ b/src/third_party/unwind/dist/src/ia64/mk_cursor_i
@@ -0,0 +1,7 @@
+#!/bin/sh
+test -z "$1" && exit 1
+echo "/* GENERATED */"
+echo "#ifndef cursor_i_h"
+echo "#define cursor_i_h"
+sed -ne 's/^->"\(\S*\)" \(\d*\)/#define \1 \2/p' < $1 || exit $?
+echo "#endif"
diff --git a/src/third_party/unwind/dist/src/ia64/unwind_i.h b/src/third_party/unwind/dist/src/ia64/unwind_i.h
index 8ccbb46c930..f92fe89c55e 100644
--- a/src/third_party/unwind/dist/src/ia64/unwind_i.h
+++ b/src/third_party/unwind/dist/src/ia64/unwind_i.h
@@ -61,7 +61,7 @@ inlined_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr)
case UNW_IA64_NAT + 0: addr = &unw.read_only.r0; break;
case UNW_IA64_FR + 0: addr = &unw.read_only.f0; break;
case UNW_IA64_FR + 1:
- if (__BYTE_ORDER == __BIG_ENDIAN)
+ if (target_is_big_endian())
addr = &unw.read_only.f1_be;
else
addr = &unw.read_only.f1_le;
diff --git a/src/third_party/unwind/dist/src/mi/Gget_accessors.c b/src/third_party/unwind/dist/src/mi/Gget_accessors.c
index 31a6fbaf02f..8b8a72ea3d9 100644
--- a/src/third_party/unwind/dist/src/mi/Gget_accessors.c
+++ b/src/third_party/unwind/dist/src/mi/Gget_accessors.c
@@ -24,6 +24,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "libunwind_i.h"
+#include <stdatomic.h>
HIDDEN ALIAS(unw_get_accessors) unw_accessors_t *
unw_get_accessors_int (unw_addr_space_t as);
@@ -31,7 +32,7 @@ unw_get_accessors_int (unw_addr_space_t as);
unw_accessors_t *
unw_get_accessors (unw_addr_space_t as)
{
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
return &as->acc;
}
diff --git a/src/third_party/unwind/dist/src/mi/Gset_cache_size.c b/src/third_party/unwind/dist/src/mi/Gset_cache_size.c
index 07b282e2c1d..014576a1be6 100644
--- a/src/third_party/unwind/dist/src/mi/Gset_cache_size.c
+++ b/src/third_party/unwind/dist/src/mi/Gset_cache_size.c
@@ -32,7 +32,7 @@ unw_set_cache_size (unw_addr_space_t as, size_t size, int flag)
size_t power = 1;
unsigned short log_size = 0;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
if (flag != 0)
diff --git a/src/third_party/unwind/dist/src/mi/Gset_caching_policy.c b/src/third_party/unwind/dist/src/mi/Gset_caching_policy.c
index aa3d237146e..8fe08298362 100644
--- a/src/third_party/unwind/dist/src/mi/Gset_caching_policy.c
+++ b/src/third_party/unwind/dist/src/mi/Gset_caching_policy.c
@@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
int
unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy)
{
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
#if !(defined(HAVE___THREAD) && HAVE___THREAD)
diff --git a/src/third_party/unwind/dist/src/mi/flush_cache.c b/src/third_party/unwind/dist/src/mi/flush_cache.c
index f2b01158a0e..55ee8a3305e 100644
--- a/src/third_party/unwind/dist/src/mi/flush_cache.c
+++ b/src/third_party/unwind/dist/src/mi/flush_cache.c
@@ -24,6 +24,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "libunwind_i.h"
+#include <stdatomic.h>
void
unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi)
@@ -52,11 +53,5 @@ unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi)
ignores the flush range arguments (lo-hi). This is OK because
unw_flush_cache() is allowed to flush more than the requested
range. */
-
-#ifdef HAVE_FETCH_AND_ADD
- fetch_and_add1 (&as->cache_generation);
-#else
-# warning unw_flush_cache(): need a way to atomically increment an integer.
- ++as->cache_generation;
-#endif
+ atomic_fetch_add (&as->cache_generation, 1);
}
diff --git a/src/third_party/unwind/dist/src/mi/init.c b/src/third_party/unwind/dist/src/mi/init.c
index 60a48c58928..aa9319981d5 100644
--- a/src/third_party/unwind/dist/src/mi/init.c
+++ b/src/third_party/unwind/dist/src/mi/init.c
@@ -39,6 +39,30 @@ static const char rcsid[] UNUSED =
long unwi_debug_level;
#endif /* UNW_DEBUG */
+long unw_page_size;
+static void
+unw_init_page_size ()
+{
+ errno = 0;
+ long result = sysconf (_SC_PAGESIZE);
+ if (result == -1)
+ {
+ if (errno != 0)
+ {
+ print_error ("Failed to get _SC_PAGESIZE: ");
+ print_error (strerror(errno));
+ print_error ("\n");
+ }
+ else
+ print_error ("Failed to get _SC_PAGESIZE, errno was not set.\n");
+
+ unw_page_size = 4096;
+ }
+ else
+ {
+ unw_page_size = result;
+ }
+}
HIDDEN void
mi_init (void)
@@ -55,6 +79,6 @@ mi_init (void)
setbuf (stderr, NULL);
}
#endif
-
- assert (sizeof (struct cursor) <= sizeof (unw_cursor_t));
+ unw_init_page_size();
+ assert(sizeof(struct cursor) <= sizeof(unw_cursor_t));
}
diff --git a/src/third_party/unwind/dist/src/mi/mempool.c b/src/third_party/unwind/dist/src/mi/mempool.c
index 536b64e8157..7c5d27d0c2c 100644
--- a/src/third_party/unwind/dist/src/mi/mempool.c
+++ b/src/third_party/unwind/dist/src/mi/mempool.c
@@ -25,6 +25,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "libunwind_i.h"
+#include <stdalign.h>
+#include <stdatomic.h>
/* From GCC docs: ``Gcc also provides a target specific macro
* __BIGGEST_ALIGNMENT__, which is the largest alignment ever used for any data
@@ -39,8 +41,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define MAX_ALIGN MAX_ALIGN_(sizeof (long double))
#endif
-static char sos_memory[SOS_MEMORY_SIZE] ALIGNED(MAX_ALIGN);
-static size_t sos_memory_freepos;
+static alignas(MAX_ALIGN) char sos_memory[SOS_MEMORY_SIZE];
+static _Atomic size_t sos_memory_freepos = 0;
static size_t pg_size;
HIDDEN void *
@@ -50,29 +52,10 @@ sos_alloc (size_t size)
size = UNW_ALIGN(size, MAX_ALIGN);
-#if defined(__GNUC__) && defined(HAVE_FETCH_AND_ADD)
/* Assume `sos_memory' is suitably aligned. */
assert(((uintptr_t) &sos_memory[0] & (MAX_ALIGN-1)) == 0);
- pos = fetch_and_add (&sos_memory_freepos, size);
-#else
- static define_lock (sos_lock);
- intrmask_t saved_mask;
-
- lock_acquire (&sos_lock, saved_mask);
- {
- /* No assumptions about `sos_memory' alignment. */
- if (sos_memory_freepos == 0)
- {
- unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN)
- - (uintptr_t) &sos_memory[0];
- sos_memory_freepos = align;
- }
- pos = sos_memory_freepos;
- sos_memory_freepos += size;
- }
- lock_release (&sos_lock, saved_mask);
-#endif
+ pos = atomic_fetch_add (&sos_memory_freepos, size);
assert (((uintptr_t) &sos_memory[pos] & (MAX_ALIGN-1)) == 0);
assert ((pos+size) <= SOS_MEMORY_SIZE);
diff --git a/src/third_party/unwind/dist/src/mips/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/mips/Gcreate_addr_space.c
index 24e0d3b1536..acc6cf0fb8a 100644
--- a/src/third_party/unwind/dist/src/mips/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/mips/Gcreate_addr_space.c
@@ -38,9 +38,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
* MIPS supports only big or little-endian, not weird stuff like
* PDP_ENDIAN.
*/
- if (byte_order != 0
- && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -53,9 +51,9 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
if (byte_order == 0)
/* use host default: */
- as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ as->big_endian = target_is_big_endian();
else
- as->big_endian = (byte_order == __BIG_ENDIAN);
+ as->big_endian = (byte_order == UNW_BIG_ENDIAN);
/* FIXME! There is no way to specify the ABI. */
#if _MIPS_SIM == _ABIO32
diff --git a/src/third_party/unwind/dist/src/mips/Gglobal.c b/src/third_party/unwind/dist/src/mips/Gglobal.c
index fa9478eebe7..535fe990c7b 100644
--- a/src/third_party/unwind/dist/src/mips/Gglobal.c
+++ b/src/third_party/unwind/dist/src/mips/Gglobal.c
@@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (mips_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
HIDDEN void
tdep_init (void)
@@ -37,7 +37,7 @@ tdep_init (void)
lock_acquire (&mips_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -48,7 +48,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
mips_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&mips_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/mips/Ginit.c b/src/third_party/unwind/dist/src/mips/Ginit.c
index bf7a8f5a8f4..84a34352016 100644
--- a/src/third_party/unwind/dist/src/mips/Ginit.c
+++ b/src/third_party/unwind/dist/src/mips/Ginit.c
@@ -183,7 +183,7 @@ HIDDEN void
mips_local_addr_space_init (void)
{
memset (&local_addr_space, 0, sizeof (local_addr_space));
- local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ local_addr_space.big_endian = target_is_big_endian();
#if _MIPS_SIM == _ABIO32
local_addr_space.abi = UNW_MIPS_ABI_O32;
#elif _MIPS_SIM == _ABIN32
diff --git a/src/third_party/unwind/dist/src/mips/Ginit_local.c b/src/third_party/unwind/dist/src/mips/Ginit_local.c
index f3153b5ba03..61af39ee904 100644
--- a/src/third_party/unwind/dist/src/mips/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/mips/Ginit_local.c
@@ -40,7 +40,7 @@ unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_in
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/mips/Ginit_remote.c b/src/third_party/unwind/dist/src/mips/Ginit_remote.c
index 9b8ba5b89de..26d11ba942b 100644
--- a/src/third_party/unwind/dist/src/mips/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/mips/Ginit_remote.c
@@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/mips/Gstep.c b/src/third_party/unwind/dist/src/mips/Gstep.c
index 0235d523f03..79fea71f4de 100644
--- a/src/third_party/unwind/dist/src/mips/Gstep.c
+++ b/src/third_party/unwind/dist/src/mips/Gstep.c
@@ -214,11 +214,14 @@ unw_step (unw_cursor_t *cursor)
if (unlikely (ret == -UNW_ESTOPUNWIND))
return ret;
-#if _MIPS_SIM == _ABI64
if (unlikely (ret < 0))
{
+#if _MIPS_SIM == _ABI64
return _step_n64(c);
- }
+#else
+ return ret;
#endif
+ }
+
return (c->dwarf.ip == 0) ? 0 : 1;
}
diff --git a/src/third_party/unwind/dist/src/os-linux.c b/src/third_party/unwind/dist/src/os-linux.c
index 8a00669fb3c..c42d2c5fcfc 100644
--- a/src/third_party/unwind/dist/src/os-linux.c
+++ b/src/third_party/unwind/dist/src/os-linux.c
@@ -25,6 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <limits.h>
#include <stdio.h>
+#include <sys/stat.h>
#include "libunwind_i.h"
#include "os-linux.h"
@@ -37,11 +38,15 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
struct map_iterator mi;
int found = 0, rc;
unsigned long hi;
+ char root[sizeof ("/proc/0123456789/root")], *cp;
+ char *full_path;
+ struct stat st;
+
if (maps_init (&mi, pid) < 0)
return -1;
- while (maps_next (&mi, segbase, &hi, mapoff))
+ while (maps_next (&mi, segbase, &hi, mapoff, NULL))
if (ip >= *segbase && ip < hi)
{
found = 1;
@@ -53,11 +58,36 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
maps_close (&mi);
return -1;
}
+
+ full_path = mi.path;
+
+ /* Get process root */
+ memcpy (root, "/proc/", 6);
+ cp = unw_ltoa (root + 6, pid);
+ assert (cp + 6 < root + sizeof (root));
+ memcpy (cp, "/root", 6);
+
+ if (!stat(root, &st) && S_ISDIR(st.st_mode))
+ {
+ full_path = (char*) malloc (strlen (root) + strlen (mi.path) + 1);
+ if (!full_path)
+ full_path = mi.path;
+ else
+ {
+ strcpy (full_path, root);
+ strcat (full_path, mi.path);
+ }
+ }
+
if (path)
{
- strncpy(path, mi.path, pathlen);
+ strncpy(path, full_path, pathlen);
}
- rc = elf_map_image (ei, mi.path);
+ rc = elf_map_image (ei, full_path);
+
+ if (full_path && full_path != mi.path)
+ free (full_path);
+
maps_close (&mi);
return rc;
}
diff --git a/src/third_party/unwind/dist/src/os-linux.h b/src/third_party/unwind/dist/src/os-linux.h
index 3976b38cc29..29aab5cf40a 100644
--- a/src/third_party/unwind/dist/src/os-linux.h
+++ b/src/third_party/unwind/dist/src/os-linux.h
@@ -38,7 +38,7 @@ struct map_iterator
};
static inline char *
-ltoa (char *buf, long val)
+unw_ltoa (char *buf, long val)
{
char *cp = buf, tmp;
ssize_t i, len;
@@ -68,7 +68,7 @@ maps_init (struct map_iterator *mi, pid_t pid)
char path[sizeof ("/proc/0123456789/maps")], *cp;
memcpy (path, "/proc/", 6);
- cp = ltoa (path + 6, pid);
+ cp = unw_ltoa (path + 6, pid);
assert (cp + 6 < path + sizeof (path));
memcpy (cp, "/maps", 6);
@@ -201,7 +201,8 @@ scan_string (char *cp, char *valp, size_t buf_size)
static inline int
maps_next (struct map_iterator *mi,
- unsigned long *low, unsigned long *high, unsigned long *offset)
+ unsigned long *low, unsigned long *high, unsigned long *offset,
+ unsigned long *flags)
{
char perm[16], dash = 0, colon = 0, *cp;
unsigned long major, minor, inum;
@@ -275,6 +276,22 @@ maps_next (struct map_iterator *mi,
cp = scan_string (cp, NULL, 0);
if (dash != '-' || colon != ':')
continue; /* skip line with unknown or bad format */
+ if (flags)
+ {
+ *flags = 0;
+ if (perm[0] == 'r')
+ {
+ *flags |= PROT_READ;
+ }
+ if (perm[1] == 'w')
+ {
+ *flags |= PROT_WRITE;
+ }
+ if (perm[2] == 'x')
+ {
+ *flags |= PROT_EXEC;
+ }
+ }
return 1;
}
return 0;
diff --git a/src/third_party/unwind/dist/src/os-solaris.c b/src/third_party/unwind/dist/src/os-solaris.c
index 3c140ef29c9..f0210db1f2b 100644
--- a/src/third_party/unwind/dist/src/os-solaris.c
+++ b/src/third_party/unwind/dist/src/os-solaris.c
@@ -41,7 +41,7 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
if (maps_init (&mi, pid) < 0)
return -1;
- while (maps_next (&mi, segbase, &hi, mapoff))
+ while (maps_next (&mi, segbase, &hi, mapoff, NULL))
if (ip >= *segbase && ip < hi)
{
found = 1;
diff --git a/src/third_party/unwind/dist/src/ppc/Ginit_local.c b/src/third_party/unwind/dist/src/ppc/Ginit_local.c
index 366cf5bdaf3..02632f9ca50 100644
--- a/src/third_party/unwind/dist/src/ppc/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/ppc/Ginit_local.c
@@ -48,7 +48,7 @@ unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_in
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/ppc/Ginit_remote.c b/src/third_party/unwind/dist/src/ppc/Ginit_remote.c
index ed85be8971f..fbca91857d2 100644
--- a/src/third_party/unwind/dist/src/ppc/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/ppc/Ginit_remote.c
@@ -41,7 +41,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/ppc32/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/ppc32/Gcreate_addr_space.c
index aaa68bb3543..0418f18f088 100644
--- a/src/third_party/unwind/dist/src/ppc32/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/ppc32/Gcreate_addr_space.c
@@ -40,7 +40,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
/*
* We support only big-endian on Linux ppc32.
*/
- if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order != UNW_BIG_ENDIAN)
return NULL;
as = malloc (sizeof (*as));
diff --git a/src/third_party/unwind/dist/src/ppc32/Gglobal.c b/src/third_party/unwind/dist/src/ppc32/Gglobal.c
index a0f80beec6d..e0a2d55114c 100644
--- a/src/third_party/unwind/dist/src/ppc32/Gglobal.c
+++ b/src/third_party/unwind/dist/src/ppc32/Gglobal.c
@@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (ppc32_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */
@@ -117,7 +117,7 @@ tdep_init (void)
lock_acquire (&ppc32_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -128,7 +128,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
ppc32_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&ppc32_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/ppc32/Gresume.c b/src/third_party/unwind/dist/src/ppc32/Gresume.c
index c0f95837b33..b0f04fa00ab 100644
--- a/src/third_party/unwind/dist/src/ppc32/Gresume.c
+++ b/src/third_party/unwind/dist/src/ppc32/Gresume.c
@@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef UNW_REMOTE_ONLY
-#include <sys/syscall.h>
-
/* sigreturn() is a no-op on x86_64 glibc. */
static NORETURN inline long
diff --git a/src/third_party/unwind/dist/src/ppc32/unwind_i.h b/src/third_party/unwind/dist/src/ppc32/unwind_i.h
index ad32d056544..defce9741ef 100644
--- a/src/third_party/unwind/dist/src/ppc32/unwind_i.h
+++ b/src/third_party/unwind/dist/src/ppc32/unwind_i.h
@@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <libunwind-ppc32.h>
#include <libunwind_i.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
#define ppc32_lock UNW_OBJ(lock)
#define ppc32_local_resume UNW_OBJ(local_resume)
diff --git a/src/third_party/unwind/dist/src/ppc64/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/ppc64/Gcreate_addr_space.c
index bd48555d4e8..9e409309a65 100644
--- a/src/third_party/unwind/dist/src/ppc64/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/ppc64/Gcreate_addr_space.c
@@ -40,9 +40,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
/*
* We support both big- and little-endian on Linux ppc64.
*/
- if (byte_order != 0
- && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -55,16 +53,21 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
if (byte_order == 0)
/* use host default: */
- as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ as->big_endian = target_is_big_endian();
else
- as->big_endian = (byte_order == __BIG_ENDIAN);
+ as->big_endian = byte_order_is_big_endian(byte_order);
+/* FreeBSD 13 and up are always ELFv2. */
+#if defined(__FreeBSD__) && __FreeBSD__ >= 13
+ as->abi = UNW_PPC64_ABI_ELFv2;
+#else
/* FIXME! There is no way to specify the ABI.
Default to ELFv1 on big-endian and ELFv2 on little-endian. */
if (as->big_endian)
as->abi = UNW_PPC64_ABI_ELFv1;
else
as->abi = UNW_PPC64_ABI_ELFv2;
+#endif
return as;
#endif
diff --git a/src/third_party/unwind/dist/src/ppc64/Gglobal.c b/src/third_party/unwind/dist/src/ppc64/Gglobal.c
index 9d0b0f55a6c..fd3a53b524e 100644
--- a/src/third_party/unwind/dist/src/ppc64/Gglobal.c
+++ b/src/third_party/unwind/dist/src/ppc64/Gglobal.c
@@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (ppc64_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */
@@ -164,7 +164,7 @@ tdep_init (void)
lock_acquire (&ppc64_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -175,7 +175,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
ppc64_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&ppc64_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/ppc64/Ginit.c b/src/third_party/unwind/dist/src/ppc64/Ginit.c
index 7bfb395a792..b9683ae2dd6 100644
--- a/src/third_party/unwind/dist/src/ppc64/Ginit.c
+++ b/src/third_party/unwind/dist/src/ppc64/Ginit.c
@@ -48,13 +48,25 @@ uc_addr (ucontext_t *uc, int reg)
void *addr;
if ((unsigned) (reg - UNW_PPC64_R0) < 32)
+#if defined(__linux__)
addr = &uc->uc_mcontext.gp_regs[reg - UNW_PPC64_R0];
+#elif defined(__FreeBSD__)
+ addr = &uc->uc_mcontext.mc_gpr[reg - UNW_PPC64_R0];
+#endif
else if ((unsigned) (reg - UNW_PPC64_F0) < 32)
+#if defined(__linux__)
addr = &uc->uc_mcontext.fp_regs[reg - UNW_PPC64_F0];
+#elif defined(__FreeBSD__)
+ addr = &uc->uc_mcontext.mc_fpreg[reg - UNW_PPC64_F0];
+#endif
else if ((unsigned) (reg - UNW_PPC64_V0) < 32)
+#if defined(__linux__)
addr = (uc->uc_mcontext.v_regs == 0) ? NULL : &uc->uc_mcontext.v_regs->vrregs[reg - UNW_PPC64_V0][0];
+#elif defined(__FreeBSD__)
+ addr = &uc->uc_mcontext.mc_avec[(reg - UNW_PPC64_V0)*2];
+#endif
else
{
@@ -80,7 +92,11 @@ uc_addr (ucontext_t *uc, int reg)
default:
return NULL;
}
+#if defined(__linux__)
addr = &uc->uc_mcontext.gp_regs[gregs_idx];
+#elif defined(__FreeBSD__)
+ addr = &uc->uc_mcontext.mc_gpr[gregs_idx];
+#endif
}
return addr;
}
@@ -211,7 +227,7 @@ HIDDEN void
ppc64_local_addr_space_init (void)
{
memset (&local_addr_space, 0, sizeof (local_addr_space));
- local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ local_addr_space.big_endian = target_is_big_endian();
#if _CALL_ELF == 2
local_addr_space.abi = UNW_PPC64_ABI_ELFv2;
#else
diff --git a/src/third_party/unwind/dist/src/ppc64/Gresume.c b/src/third_party/unwind/dist/src/ppc64/Gresume.c
index 0d832d0d97b..f9455ef85f2 100644
--- a/src/third_party/unwind/dist/src/ppc64/Gresume.c
+++ b/src/third_party/unwind/dist/src/ppc64/Gresume.c
@@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef UNW_REMOTE_ONLY
-#include <sys/syscall.h>
-
/* sigreturn() is a no-op on x86_64 glibc. */
static NORETURN inline long
diff --git a/src/third_party/unwind/dist/src/ppc64/Gstep.c b/src/third_party/unwind/dist/src/ppc64/Gstep.c
index f44e9591054..27c8bebc644 100644
--- a/src/third_party/unwind/dist/src/ppc64/Gstep.c
+++ b/src/third_party/unwind/dist/src/ppc64/Gstep.c
@@ -139,8 +139,8 @@ unw_step (unw_cursor_t * cursor)
c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
c->sigcontext_addr = ucontext;
- sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
- ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
+ sp_loc = DWARF_LOC ((ucontext + UC_MCONTEXT_GREGS_R1), 0);
+ ip_loc = DWARF_LOC ((ucontext + UC_MCONTEXT_GREGS_NIP), 0);
ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
if (ret < 0)
@@ -311,8 +311,15 @@ unw_step (unw_cursor_t * cursor)
/* Note that there is no .eh_section register column for the
FPSCR register. I don't know why this is. */
+#if defined(__linux__)
v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0);
ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr);
+#elif defined(__FreeBSD__)
+ /* Offset into main structure. */
+ v_regs_ptr = (ucontext + UC_MCONTEXT_V_REGS);
+ ret = 0;
+#endif
+
if (ret < 0)
{
Debug (2, "returning %d\n", ret);
diff --git a/src/third_party/unwind/dist/src/ppc64/ucontext_i.h b/src/third_party/unwind/dist/src/ppc64/ucontext_i.h
index 2ddfdb865a7..c6a1aa4789c 100644
--- a/src/third_party/unwind/dist/src/ppc64/ucontext_i.h
+++ b/src/third_party/unwind/dist/src/ppc64/ucontext_i.h
@@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <ucontext.h>
+#if defined(__linux__)
/* These values were derived by reading
/usr/src/linux-2.6.18-1.8/arch/um/include/sysdep-ppc/ptrace.h and
/usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h
@@ -49,125 +50,177 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define VSCR_IDX 32
#define VRSAVE_IDX 33
+#define UC_MCONTEXT_V_REGS ( ((void *)&dmy_ctxt.uc_mcontext.v_regs - (void *)&dmy_ctxt) )
+
+#define _UC_MCONTEXT_GPR(x) ( ((void *)&dmy_ctxt.uc_mcontext.gp_regs[x] - (void *)&dmy_ctxt) )
+#define _UC_MCONTEXT_FPR(x) ( ((void *)&dmy_ctxt.uc_mcontext.fp_regs[x] - (void *)&dmy_ctxt) )
+#define _UC_MCONTEXT_VR(x) ( ((void *)&dmy_vrregset.vrregs[x] - (void *)&dmy_vrregset) )
+
/* These are dummy structures used only for obtaining the offsets of the
various structure members. */
static ucontext_t dmy_ctxt;
static vrregset_t dmy_vrregset;
-#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[0] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[1] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[2] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[3] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[4] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[5] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[6] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[7] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[8] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[9] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[10] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[11] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[12] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[13] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[14] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[15] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[16] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[17] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[18] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[19] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[20] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[21] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[22] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[23] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[24] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[25] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[26] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[27] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[28] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[29] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[30] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[31] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_NIP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[NIP_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[MSR_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CTR_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.gp_regs[LINK_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.gp_regs[XER_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CCR_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.gp_regs[SOFTE_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[TRAP_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DAR_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DSISR_IDX] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.gp_regs[RESULT_IDX] - (void *)&dmy_ctxt)
-
-#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[0] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[1] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[2] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[3] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[4] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[5] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[6] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[7] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[8] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[9] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[10] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[11] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[12] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[13] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[14] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[15] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[16] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[17] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[18] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[19] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[20] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[21] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[22] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[23] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[24] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[25] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[26] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[27] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[28] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[29] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[30] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[31] - (void *)&dmy_ctxt)
-#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.fp_regs[32] - (void *)&dmy_ctxt)
-
-#define UC_MCONTEXT_V_REGS ((void *)&dmy_ctxt.uc_mcontext.v_regs - (void *)&dmy_ctxt)
-
-#define UC_MCONTEXT_VREGS_R0 ((void *)&dmy_vrregset.vrregs[0] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R1 ((void *)&dmy_vrregset.vrregs[1] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R2 ((void *)&dmy_vrregset.vrregs[2] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R3 ((void *)&dmy_vrregset.vrregs[3] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R4 ((void *)&dmy_vrregset.vrregs[4] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R5 ((void *)&dmy_vrregset.vrregs[5] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R6 ((void *)&dmy_vrregset.vrregs[6] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R7 ((void *)&dmy_vrregset.vrregs[7] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R8 ((void *)&dmy_vrregset.vrregs[8] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R9 ((void *)&dmy_vrregset.vrregs[9] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R10 ((void *)&dmy_vrregset.vrregs[10] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R11 ((void *)&dmy_vrregset.vrregs[11] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R12 ((void *)&dmy_vrregset.vrregs[12] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R13 ((void *)&dmy_vrregset.vrregs[13] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R14 ((void *)&dmy_vrregset.vrregs[14] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R15 ((void *)&dmy_vrregset.vrregs[15] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R16 ((void *)&dmy_vrregset.vrregs[16] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R17 ((void *)&dmy_vrregset.vrregs[17] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R18 ((void *)&dmy_vrregset.vrregs[18] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R19 ((void *)&dmy_vrregset.vrregs[19] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R20 ((void *)&dmy_vrregset.vrregs[20] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R21 ((void *)&dmy_vrregset.vrregs[21] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R22 ((void *)&dmy_vrregset.vrregs[22] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R23 ((void *)&dmy_vrregset.vrregs[23] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R24 ((void *)&dmy_vrregset.vrregs[24] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R25 ((void *)&dmy_vrregset.vrregs[25] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R26 ((void *)&dmy_vrregset.vrregs[26] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R27 ((void *)&dmy_vrregset.vrregs[27] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R28 ((void *)&dmy_vrregset.vrregs[28] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R29 ((void *)&dmy_vrregset.vrregs[29] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R30 ((void *)&dmy_vrregset.vrregs[30] - (void *)&dmy_vrregset)
-#define UC_MCONTEXT_VREGS_R31 ((void *)&dmy_vrregset.vrregs[31] - (void *)&dmy_vrregset)
+#elif defined(__FreeBSD__)
+/* See /usr/src/sys/powerpc/include/ucontext.h.
+ FreeBSD uses a different structure than Linux.
+*/
+
+#define NIP_IDX 36
+#define MSR_IDX 37
+//#define ORIG_GPR3_IDX
+#define CTR_IDX 35
+#define LINK_IDX 32
+#define XER_IDX 34
+#define CCR_IDX 33
+//#define SOFTE_IDX
+//#define TRAP_IDX
+#define DAR_IDX 39
+#define DSISR_IDX 40
+//#define RESULT_IDX
+
+#define UC_MCONTEXT_V_REGS (((void *)&dmy_ctxt.mc_avec - (void *)&dmy_ctxt))
+
+#define _UC_MCONTEXT_GPR(_x) ( ((void *)&dmy_ctxt.mc_gpr[_x] - (void *)&dmy_ctxt) )
+#define _UC_MCONTEXT_FPR(_x) ( ((void *)&dmy_ctxt.mc_fpreg[_x] - (void *)&dmy_ctxt) )
+#define _UC_MCONTEXT_VR(_x) ( ((void *)&dmy_ctxt.mc_avec[_x] - (void *)&dmy_ctxt.mc_avec) )
+
+/* These are dummy structures used only for obtaining the offsets of the
+ various structure members. */
+static struct __mcontext dmy_ctxt;
+
+#else
+#error "Not implemented!"
+#endif
+
+#define UC_MCONTEXT_GREGS_R0 _UC_MCONTEXT_GPR(0)
+#define UC_MCONTEXT_GREGS_R1 _UC_MCONTEXT_GPR(1)
+#define UC_MCONTEXT_GREGS_R2 _UC_MCONTEXT_GPR(2)
+#define UC_MCONTEXT_GREGS_R3 _UC_MCONTEXT_GPR(3)
+#define UC_MCONTEXT_GREGS_R4 _UC_MCONTEXT_GPR(4)
+#define UC_MCONTEXT_GREGS_R5 _UC_MCONTEXT_GPR(5)
+#define UC_MCONTEXT_GREGS_R6 _UC_MCONTEXT_GPR(6)
+#define UC_MCONTEXT_GREGS_R7 _UC_MCONTEXT_GPR(7)
+#define UC_MCONTEXT_GREGS_R8 _UC_MCONTEXT_GPR(8)
+#define UC_MCONTEXT_GREGS_R9 _UC_MCONTEXT_GPR(9)
+#define UC_MCONTEXT_GREGS_R10 _UC_MCONTEXT_GPR(10)
+#define UC_MCONTEXT_GREGS_R11 _UC_MCONTEXT_GPR(11)
+#define UC_MCONTEXT_GREGS_R12 _UC_MCONTEXT_GPR(12)
+#define UC_MCONTEXT_GREGS_R13 _UC_MCONTEXT_GPR(13)
+#define UC_MCONTEXT_GREGS_R14 _UC_MCONTEXT_GPR(14)
+#define UC_MCONTEXT_GREGS_R15 _UC_MCONTEXT_GPR(15)
+#define UC_MCONTEXT_GREGS_R16 _UC_MCONTEXT_GPR(16)
+#define UC_MCONTEXT_GREGS_R17 _UC_MCONTEXT_GPR(17)
+#define UC_MCONTEXT_GREGS_R18 _UC_MCONTEXT_GPR(18)
+#define UC_MCONTEXT_GREGS_R19 _UC_MCONTEXT_GPR(19)
+#define UC_MCONTEXT_GREGS_R20 _UC_MCONTEXT_GPR(20)
+#define UC_MCONTEXT_GREGS_R21 _UC_MCONTEXT_GPR(21)
+#define UC_MCONTEXT_GREGS_R22 _UC_MCONTEXT_GPR(22)
+#define UC_MCONTEXT_GREGS_R23 _UC_MCONTEXT_GPR(23)
+#define UC_MCONTEXT_GREGS_R24 _UC_MCONTEXT_GPR(24)
+#define UC_MCONTEXT_GREGS_R25 _UC_MCONTEXT_GPR(25)
+#define UC_MCONTEXT_GREGS_R26 _UC_MCONTEXT_GPR(26)
+#define UC_MCONTEXT_GREGS_R27 _UC_MCONTEXT_GPR(27)
+#define UC_MCONTEXT_GREGS_R28 _UC_MCONTEXT_GPR(28)
+#define UC_MCONTEXT_GREGS_R29 _UC_MCONTEXT_GPR(29)
+#define UC_MCONTEXT_GREGS_R30 _UC_MCONTEXT_GPR(30)
+#define UC_MCONTEXT_GREGS_R31 _UC_MCONTEXT_GPR(31)
+#define UC_MCONTEXT_GREGS_NIP _UC_MCONTEXT_GPR(NIP_IDX)
+#define UC_MCONTEXT_GREGS_MSR _UC_MCONTEXT_GPR(MSR_IDX)
+#ifdef ORIG_GPR3_IDX
+#define UC_MCONTEXT_GREGS_ORIG_GPR3 _UC_MCONTEXT_GPR(ORIG_GPR3_IDX)
+#endif
+#define UC_MCONTEXT_GREGS_CTR _UC_MCONTEXT_GPR(CTR_IDX)
+#define UC_MCONTEXT_GREGS_LINK _UC_MCONTEXT_GPR(LINK_IDX)
+#define UC_MCONTEXT_GREGS_XER _UC_MCONTEXT_GPR(XER_IDX)
+#define UC_MCONTEXT_GREGS_CCR _UC_MCONTEXT_GPR(CCR_IDX)
+#ifdef SOFTE_IDX
+#define UC_MCONTEXT_GREGS_SOFTE _UC_MCONTEXT_GPR(SOFTE_IDX)
+#endif
+#ifdef TRAP_IDX
+#define UC_MCONTEXT_GREGS_TRAP _UC_MCONTEXT_GPR(TRAP_IDX)
+#endif
+#define UC_MCONTEXT_GREGS_DAR _UC_MCONTEXT_GPR(DAR_IDX)
+#define UC_MCONTEXT_GREGS_DSISR _UC_MCONTEXT_GPR(DSISR_IDX)
+#ifdef RESULT_IDX
+#define UC_MCONTEXT_GREGS_RESULT _UC_MCONTEXT_GPR(RESULT_IDX)
+#endif
+
+#define UC_MCONTEXT_FREGS_R0 _UC_MCONTEXT_FPR(0)
+#define UC_MCONTEXT_FREGS_R1 _UC_MCONTEXT_FPR(1)
+#define UC_MCONTEXT_FREGS_R2 _UC_MCONTEXT_FPR(2)
+#define UC_MCONTEXT_FREGS_R3 _UC_MCONTEXT_FPR(3)
+#define UC_MCONTEXT_FREGS_R4 _UC_MCONTEXT_FPR(4)
+#define UC_MCONTEXT_FREGS_R5 _UC_MCONTEXT_FPR(5)
+#define UC_MCONTEXT_FREGS_R6 _UC_MCONTEXT_FPR(6)
+#define UC_MCONTEXT_FREGS_R7 _UC_MCONTEXT_FPR(7)
+#define UC_MCONTEXT_FREGS_R8 _UC_MCONTEXT_FPR(8)
+#define UC_MCONTEXT_FREGS_R9 _UC_MCONTEXT_FPR(9)
+#define UC_MCONTEXT_FREGS_R10 _UC_MCONTEXT_FPR(10)
+#define UC_MCONTEXT_FREGS_R11 _UC_MCONTEXT_FPR(11)
+#define UC_MCONTEXT_FREGS_R12 _UC_MCONTEXT_FPR(12)
+#define UC_MCONTEXT_FREGS_R13 _UC_MCONTEXT_FPR(13)
+#define UC_MCONTEXT_FREGS_R14 _UC_MCONTEXT_FPR(14)
+#define UC_MCONTEXT_FREGS_R15 _UC_MCONTEXT_FPR(15)
+#define UC_MCONTEXT_FREGS_R16 _UC_MCONTEXT_FPR(16)
+#define UC_MCONTEXT_FREGS_R17 _UC_MCONTEXT_FPR(17)
+#define UC_MCONTEXT_FREGS_R18 _UC_MCONTEXT_FPR(18)
+#define UC_MCONTEXT_FREGS_R19 _UC_MCONTEXT_FPR(19)
+#define UC_MCONTEXT_FREGS_R20 _UC_MCONTEXT_FPR(20)
+#define UC_MCONTEXT_FREGS_R21 _UC_MCONTEXT_FPR(21)
+#define UC_MCONTEXT_FREGS_R22 _UC_MCONTEXT_FPR(22)
+#define UC_MCONTEXT_FREGS_R23 _UC_MCONTEXT_FPR(23)
+#define UC_MCONTEXT_FREGS_R24 _UC_MCONTEXT_FPR(24)
+#define UC_MCONTEXT_FREGS_R25 _UC_MCONTEXT_FPR(25)
+#define UC_MCONTEXT_FREGS_R26 _UC_MCONTEXT_FPR(26)
+#define UC_MCONTEXT_FREGS_R27 _UC_MCONTEXT_FPR(27)
+#define UC_MCONTEXT_FREGS_R28 _UC_MCONTEXT_FPR(28)
+#define UC_MCONTEXT_FREGS_R29 _UC_MCONTEXT_FPR(29)
+#define UC_MCONTEXT_FREGS_R30 _UC_MCONTEXT_FPR(30)
+#define UC_MCONTEXT_FREGS_R31 _UC_MCONTEXT_FPR(31)
+#define UC_MCONTEXT_FREGS_FPSCR _UC_MCONTEXT_FPR(32)
+
+
+#define UC_MCONTEXT_VREGS_R0 _UC_MCONTEXT_VR(0)
+#define UC_MCONTEXT_VREGS_R1 _UC_MCONTEXT_VR(1)
+#define UC_MCONTEXT_VREGS_R2 _UC_MCONTEXT_VR(2)
+#define UC_MCONTEXT_VREGS_R3 _UC_MCONTEXT_VR(3)
+#define UC_MCONTEXT_VREGS_R4 _UC_MCONTEXT_VR(4)
+#define UC_MCONTEXT_VREGS_R5 _UC_MCONTEXT_VR(5)
+#define UC_MCONTEXT_VREGS_R6 _UC_MCONTEXT_VR(6)
+#define UC_MCONTEXT_VREGS_R7 _UC_MCONTEXT_VR(7)
+#define UC_MCONTEXT_VREGS_R8 _UC_MCONTEXT_VR(8)
+#define UC_MCONTEXT_VREGS_R9 _UC_MCONTEXT_VR(9)
+#define UC_MCONTEXT_VREGS_R10 _UC_MCONTEXT_VR(10)
+#define UC_MCONTEXT_VREGS_R11 _UC_MCONTEXT_VR(11)
+#define UC_MCONTEXT_VREGS_R12 _UC_MCONTEXT_VR(12)
+#define UC_MCONTEXT_VREGS_R13 _UC_MCONTEXT_VR(13)
+#define UC_MCONTEXT_VREGS_R14 _UC_MCONTEXT_VR(14)
+#define UC_MCONTEXT_VREGS_R15 _UC_MCONTEXT_VR(15)
+#define UC_MCONTEXT_VREGS_R16 _UC_MCONTEXT_VR(16)
+#define UC_MCONTEXT_VREGS_R17 _UC_MCONTEXT_VR(17)
+#define UC_MCONTEXT_VREGS_R18 _UC_MCONTEXT_VR(18)
+#define UC_MCONTEXT_VREGS_R19 _UC_MCONTEXT_VR(19)
+#define UC_MCONTEXT_VREGS_R20 _UC_MCONTEXT_VR(20)
+#define UC_MCONTEXT_VREGS_R21 _UC_MCONTEXT_VR(21)
+#define UC_MCONTEXT_VREGS_R22 _UC_MCONTEXT_VR(22)
+#define UC_MCONTEXT_VREGS_R23 _UC_MCONTEXT_VR(23)
+#define UC_MCONTEXT_VREGS_R24 _UC_MCONTEXT_VR(24)
+#define UC_MCONTEXT_VREGS_R25 _UC_MCONTEXT_VR(25)
+#define UC_MCONTEXT_VREGS_R26 _UC_MCONTEXT_VR(26)
+#define UC_MCONTEXT_VREGS_R27 _UC_MCONTEXT_VR(27)
+#define UC_MCONTEXT_VREGS_R28 _UC_MCONTEXT_VR(28)
+#define UC_MCONTEXT_VREGS_R29 _UC_MCONTEXT_VR(29)
+#define UC_MCONTEXT_VREGS_R30 _UC_MCONTEXT_VR(30)
+#define UC_MCONTEXT_VREGS_R31 _UC_MCONTEXT_VR(31)
+#if defined(__linux__)
#define UC_MCONTEXT_VREGS_VSCR ((void *)&dmy_vrregset.vscr - (void *)&dmy_vrregset)
#define UC_MCONTEXT_VREGS_VRSAVE ((void *)&dmy_vrregset.vrsave - (void *)&dmy_vrregset)
+#elif defined(__FreeBSD__)
+#define UC_MCONTEXT_VREGS_VSCR ((void *)&dmy_ctxt.mc_av[0] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_VREGS_VRSAVE ((void *)&dmy_ctxt.mc_av[1] - (void *)&dmy_ctxt)
+#else
+#error "Not implemented!"
+#endif
#endif
diff --git a/src/third_party/unwind/dist/src/ppc64/unwind_i.h b/src/third_party/unwind/dist/src/ppc64/unwind_i.h
index 26bbc2df83a..96c279a5d9e 100644
--- a/src/third_party/unwind/dist/src/ppc64/unwind_i.h
+++ b/src/third_party/unwind/dist/src/ppc64/unwind_i.h
@@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <libunwind-ppc64.h>
#include <libunwind_i.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
#define ppc64_lock UNW_OBJ(lock)
#define ppc64_local_resume UNW_OBJ(local_resume)
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_access_fpreg.c b/src/third_party/unwind/dist/src/ptrace/_UPT_access_fpreg.c
index 37cd4ffe1c2..bae34383393 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_access_fpreg.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_access_fpreg.c
@@ -87,6 +87,9 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
#elif defined(__aarch64__)
if ((unsigned) reg < UNW_AARCH64_V0 || (unsigned) reg > UNW_AARCH64_V31)
return -UNW_EBADREG;
+#elif defined(__powerpc64__)
+ if ((unsigned) reg < UNW_PPC64_F0 || (unsigned) reg > UNW_PPC64_F31)
+ return -UNW_EBADREG;
#else
#error Fix me
#endif
@@ -104,6 +107,8 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
memcpy(&fpreg.fpr[reg], val, sizeof(unw_fpreg_t));
#elif defined(__aarch64__)
memcpy(&fpreg.fp_q[reg], val, sizeof(unw_fpreg_t));
+#elif defined(__powerpc64__)
+ memcpy(&fpreg.fpreg[reg], val, sizeof(unw_fpreg_t));
#else
#error Fix me
#endif
@@ -118,6 +123,8 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
memcpy(val, &fpreg.fpr[reg], sizeof(unw_fpreg_t));
#elif defined(__aarch64__)
memcpy(val, &fpreg.fp_q[reg], sizeof(unw_fpreg_t));
+#elif defined(__powerpc64__)
+ memcpy(val, &fpreg.fpreg[reg], sizeof(unw_fpreg_t));
#else
#error Fix me
#endif
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c b/src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c
index ce25c783b04..0e247053f13 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_access_reg.c
@@ -268,6 +268,16 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
}
#endif /* End of IA64 */
+#if UNW_TARGET_RISCV
+ if (reg == UNW_RISCV_X0) {
+ if (write)
+ goto badreg;
+
+ *val = 0;
+ return 0;
+ }
+#endif /* End of RISCV */
+
if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
{
#if UNW_DEBUG
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_find_proc_info.c b/src/third_party/unwind/dist/src/ptrace/_UPT_find_proc_info.c
index b3209f451ea..0450b0847b4 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_find_proc_info.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_find_proc_info.c
@@ -38,7 +38,7 @@ get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_w
unsigned long segbase, mapoff;
char path[PATH_MAX];
-#if UNW_TARGET_IA64 && defined(__linux)
+#if UNW_TARGET_IA64 && defined(__linux__)
if (!edi->ktab.start_ip && _Uia64_get_kernel_table (&edi->ktab) < 0)
return -UNW_ENOINFO;
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/third_party/unwind/dist/src/ptrace/_UPT_get_dyn_info_list_addr.c
index 16671d453e1..a71f80d3dbd 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_get_dyn_info_list_addr.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_get_dyn_info_list_addr.c
@@ -25,7 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "_UPT_internal.h"
-#if UNW_TARGET_IA64 && defined(__linux)
+#if UNW_TARGET_IA64 && defined(__linux__)
# include "elf64.h"
# include "os-linux.h"
@@ -41,7 +41,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
int count = 0;
maps_init (&mi, ui->pid);
- while (maps_next (&mi, &lo, &hi, &off))
+ while (maps_next (&mi, &lo, &hi, &off, NULL))
{
if (off)
continue;
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_get_proc_name.c b/src/third_party/unwind/dist/src/ptrace/_UPT_get_proc_name.c
index 79c1f38e256..4fc93e74771 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_get_proc_name.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_get_proc_name.c
@@ -32,9 +32,9 @@ _UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip,
{
struct UPT_info *ui = arg;
-#if ELF_CLASS == ELFCLASS64
+#if UNW_ELF_CLASS == UNW_ELFCLASS64
return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp);
-#elif ELF_CLASS == ELFCLASS32
+#elif UNW_ELF_CLASS == UNW_ELFCLASS32
return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp);
#else
return -UNW_ENOINFO;
diff --git a/src/third_party/unwind/dist/src/ptrace/_UPT_reg_offset.c b/src/third_party/unwind/dist/src/ptrace/_UPT_reg_offset.c
index 52be799980d..b7dd3b79a8a 100644
--- a/src/third_party/unwind/dist/src/ptrace/_UPT_reg_offset.c
+++ b/src/third_party/unwind/dist/src/ptrace/_UPT_reg_offset.c
@@ -28,10 +28,57 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stddef.h>
+#ifdef HAVE_ASM_PTRACE_H
+# include <asm/ptrace.h>
+#endif
+
#ifdef HAVE_ASM_PTRACE_OFFSETS_H
# include <asm/ptrace_offsets.h>
#endif
+#if defined(__powerpc64__) && defined(__FreeBSD__)
+#define PT_R0 0
+#define PT_R1 1
+#define PT_R2 2
+#define PT_R3 3
+#define PT_R4 4
+#define PT_R5 5
+#define PT_R6 6
+#define PT_R7 7
+#define PT_R8 8
+#define PT_R9 9
+#define PT_R10 10
+#define PT_R11 11
+#define PT_R12 12
+#define PT_R13 13
+#define PT_R14 14
+#define PT_R15 15
+#define PT_R16 16
+#define PT_R17 17
+#define PT_R18 18
+#define PT_R19 19
+#define PT_R20 20
+#define PT_R21 21
+#define PT_R22 22
+#define PT_R23 23
+#define PT_R24 24
+#define PT_R25 25
+#define PT_R26 26
+#define PT_R27 27
+#define PT_R28 28
+#define PT_R29 29
+#define PT_R30 30
+#define PT_R31 31
+#define PT_NIP 32
+#define PT_CTR 35
+#define PT_LNK 36
+#define PT_XER 37
+#define PT_FPR0 48
+#define PT_VR0 82
+#define PT_VSCR (PT_VR0 + 32*2 + 1)
+#define PT_VRSAVE (PT_VR0 + 33*2)
+#endif
+
const int _UPT_reg_offset[UNW_REG_LAST + 1] =
{
#ifdef HAVE_ASM_PTRACE_OFFSETS_H
@@ -666,6 +713,47 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] =
[UNW_S390X_F14] = 0x150,
[UNW_S390X_F15] = 0x150,
[UNW_S390X_IP] = 0x08
+#elif defined(UNW_TARGET_RISCV)
+
+#if __riscv_xlen == 64
+# define RISCV_REG_OFFSET(x) (8*x)
+#elif __riscv_xlen == 32
+# define RISCV_REG_OFFSET(x) (4*x)
+#else
+# error "Unsupported address size"
+#endif
+ [UNW_RISCV_PC] = RISCV_REG_OFFSET(0),
+ [UNW_RISCV_X1] = RISCV_REG_OFFSET(1),
+ [UNW_RISCV_X2] = RISCV_REG_OFFSET(2),
+ [UNW_RISCV_X3] = RISCV_REG_OFFSET(3),
+ [UNW_RISCV_X4] = RISCV_REG_OFFSET(4),
+ [UNW_RISCV_X5] = RISCV_REG_OFFSET(5),
+ [UNW_RISCV_X6] = RISCV_REG_OFFSET(6),
+ [UNW_RISCV_X7] = RISCV_REG_OFFSET(7),
+ [UNW_RISCV_X8] = RISCV_REG_OFFSET(8),
+ [UNW_RISCV_X9] = RISCV_REG_OFFSET(9),
+ [UNW_RISCV_X10] = RISCV_REG_OFFSET(10),
+ [UNW_RISCV_X11] = RISCV_REG_OFFSET(11),
+ [UNW_RISCV_X12] = RISCV_REG_OFFSET(12),
+ [UNW_RISCV_X13] = RISCV_REG_OFFSET(13),
+ [UNW_RISCV_X14] = RISCV_REG_OFFSET(14),
+ [UNW_RISCV_X15] = RISCV_REG_OFFSET(15),
+ [UNW_RISCV_X16] = RISCV_REG_OFFSET(16),
+ [UNW_RISCV_X17] = RISCV_REG_OFFSET(17),
+ [UNW_RISCV_X18] = RISCV_REG_OFFSET(18),
+ [UNW_RISCV_X19] = RISCV_REG_OFFSET(19),
+ [UNW_RISCV_X20] = RISCV_REG_OFFSET(20),
+ [UNW_RISCV_X21] = RISCV_REG_OFFSET(21),
+ [UNW_RISCV_X22] = RISCV_REG_OFFSET(22),
+ [UNW_RISCV_X23] = RISCV_REG_OFFSET(23),
+ [UNW_RISCV_X24] = RISCV_REG_OFFSET(24),
+ [UNW_RISCV_X25] = RISCV_REG_OFFSET(25),
+ [UNW_RISCV_X26] = RISCV_REG_OFFSET(26),
+ [UNW_RISCV_X27] = RISCV_REG_OFFSET(27),
+ [UNW_RISCV_X28] = RISCV_REG_OFFSET(28),
+ [UNW_RISCV_X29] = RISCV_REG_OFFSET(29),
+ [UNW_RISCV_X30] = RISCV_REG_OFFSET(30),
+ [UNW_RISCV_X31] = RISCV_REG_OFFSET(31),
#else
# error Fix me.
#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Gapply_reg_state.c b/src/third_party/unwind/dist/src/riscv/Gapply_reg_state.c
new file mode 100644
index 00000000000..09299ac5852
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gapply_reg_state.c
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (c) 2004 Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/riscv/Gcreate_addr_space.c
new file mode 100644
index 00000000000..5cf016417db
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gcreate_addr_space.c
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * We only support little-endian for now.
+ */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ return as;
+#endif
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gget_proc_info.c b/src/third_party/unwind/dist/src/riscv/Gget_proc_info.c
new file mode 100644
index 00000000000..ff11c59bdad
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gget_proc_info.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = dwarf_make_proc_info (&c->dwarf);
+
+ if (ret < 0) {
+ /* No DWARF info? */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 1;
+ return 0;
+ }
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gget_save_loc.c b/src/third_party/unwind/dist/src/riscv/Gget_save_loc.c
new file mode 100644
index 00000000000..342f8654fbc
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gget_save_loc.c
@@ -0,0 +1,97 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ switch (reg)
+ {
+ case UNW_RISCV_X1:
+ case UNW_RISCV_X2:
+ case UNW_RISCV_X3:
+ case UNW_RISCV_X4:
+ case UNW_RISCV_X5:
+ case UNW_RISCV_X6:
+ case UNW_RISCV_X7:
+ case UNW_RISCV_X8:
+ case UNW_RISCV_X9:
+ case UNW_RISCV_X10:
+ case UNW_RISCV_X11:
+ case UNW_RISCV_X12:
+ case UNW_RISCV_X13:
+ case UNW_RISCV_X14:
+ case UNW_RISCV_X15:
+ case UNW_RISCV_X16:
+ case UNW_RISCV_X17:
+ case UNW_RISCV_X18:
+ case UNW_RISCV_X19:
+ case UNW_RISCV_X20:
+ case UNW_RISCV_X21:
+ case UNW_RISCV_X22:
+ case UNW_RISCV_X23:
+ case UNW_RISCV_X24:
+ case UNW_RISCV_X25:
+ case UNW_RISCV_X26:
+ case UNW_RISCV_X27:
+ case UNW_RISCV_X28:
+ case UNW_RISCV_X29:
+ case UNW_RISCV_X30:
+ case UNW_RISCV_X31:
+ case UNW_RISCV_PC:
+ loc = c->dwarf.loc[reg - UNW_RISCV_X0];
+ break;
+
+ default:
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gglobal.c b/src/third_party/unwind/dist/src/riscv/Gglobal.c
new file mode 100644
index 00000000000..65f11b35368
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gglobal.c
@@ -0,0 +1,127 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (riscv_lock);
+HIDDEN atomic_bool tdep_init_done = 0;
+
+/* Our ordering is already consistent with
+ https://github.com/riscv/riscv-elf-psabi-doc/blob/74ecf07bcebd0cb4bf3c39f3f9d96946cd6aba61/riscv-elf.md#dwarf-register-numbers- */
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[] =
+ {
+ UNW_RISCV_X0,
+ UNW_RISCV_X1,
+ UNW_RISCV_X2,
+ UNW_RISCV_X3,
+ UNW_RISCV_X4,
+ UNW_RISCV_X5,
+ UNW_RISCV_X6,
+ UNW_RISCV_X7,
+ UNW_RISCV_X8,
+ UNW_RISCV_X9,
+ UNW_RISCV_X10,
+ UNW_RISCV_X11,
+ UNW_RISCV_X12,
+ UNW_RISCV_X13,
+ UNW_RISCV_X14,
+ UNW_RISCV_X15,
+ UNW_RISCV_X16,
+ UNW_RISCV_X17,
+ UNW_RISCV_X18,
+ UNW_RISCV_X19,
+ UNW_RISCV_X20,
+ UNW_RISCV_X21,
+ UNW_RISCV_X22,
+ UNW_RISCV_X23,
+ UNW_RISCV_X24,
+ UNW_RISCV_X25,
+ UNW_RISCV_X26,
+ UNW_RISCV_X27,
+ UNW_RISCV_X28,
+ UNW_RISCV_X29,
+ UNW_RISCV_X30,
+ UNW_RISCV_X31,
+
+ UNW_RISCV_F0,
+ UNW_RISCV_F1,
+ UNW_RISCV_F2,
+ UNW_RISCV_F3,
+ UNW_RISCV_F4,
+ UNW_RISCV_F5,
+ UNW_RISCV_F6,
+ UNW_RISCV_F7,
+ UNW_RISCV_F8,
+ UNW_RISCV_F9,
+ UNW_RISCV_F10,
+ UNW_RISCV_F11,
+ UNW_RISCV_F12,
+ UNW_RISCV_F13,
+ UNW_RISCV_F14,
+ UNW_RISCV_F15,
+ UNW_RISCV_F16,
+ UNW_RISCV_F17,
+ UNW_RISCV_F18,
+ UNW_RISCV_F19,
+ UNW_RISCV_F20,
+ UNW_RISCV_F21,
+ UNW_RISCV_F22,
+ UNW_RISCV_F23,
+ UNW_RISCV_F24,
+ UNW_RISCV_F25,
+ UNW_RISCV_F26,
+ UNW_RISCV_F27,
+ UNW_RISCV_F28,
+ UNW_RISCV_F29,
+ UNW_RISCV_F30,
+ UNW_RISCV_F31,
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&riscv_lock, saved_mask);
+
+ if (atomic_load(&tdep_init_done))
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+ dwarf_init ();
+ tdep_init_mem_validate ();
+
+#ifndef UNW_REMOTE_ONLY
+ riscv_local_addr_space_init ();
+#endif
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
+
+ out:
+ lock_release (&riscv_lock, saved_mask);
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Ginit.c b/src/third_party/unwind/dist/src/riscv/Ginit.c
new file mode 100644
index 00000000000..4faeecbfd89
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Ginit.c
@@ -0,0 +1,442 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+/*
+ NB: as_arg is the cursor (see Ginit_local.c)
+*/
+
+static inline void *
+uc_addr (unw_context_t *uc, int reg)
+{
+ /* FIXME: Floating-point? */
+
+ unw_word_t *regs = (unw_word_t*)&uc->uc_mcontext;
+ if (reg >= UNW_RISCV_X1 && reg <= UNW_RISCV_X31)
+ return &regs[reg];
+ else if (reg >= UNW_RISCV_F0 && reg <= UNW_RISCV_F31)
+ {
+ unw_fpreg_t *fpregs = (unw_fpreg_t*)(regs + 32);
+ return &fpregs[reg - UNW_RISCV_F0];
+ }
+ else if (reg == UNW_RISCV_PC)
+ return &regs[0];
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (unw_context_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
+ return 0;
+}
+
+// Memory validation routines are from aarch64
+
+static int mem_validate_pipe[2] = {-1, -1};
+
+#ifdef HAVE_PIPE2
+static inline void
+do_pipe2 (int pipefd[2])
+{
+ pipe2 (pipefd, O_CLOEXEC | O_NONBLOCK);
+}
+#else
+static inline void
+set_pipe_flags (int fd)
+{
+ int fd_flags = fcntl (fd, F_GETFD, 0);
+ int status_flags = fcntl (fd, F_GETFL, 0);
+
+ fd_flags |= FD_CLOEXEC;
+ fcntl (fd, F_SETFD, fd_flags);
+
+ status_flags |= O_NONBLOCK;
+ fcntl (fd, F_SETFL, status_flags);
+}
+
+static inline void
+do_pipe2 (int pipefd[2])
+{
+ pipe (pipefd);
+ set_pipe_flags(pipefd[0]);
+ set_pipe_flags(pipefd[1]);
+}
+#endif
+
+static inline void
+open_pipe (void)
+{
+ if (mem_validate_pipe[0] != -1)
+ close (mem_validate_pipe[0]);
+ if (mem_validate_pipe[1] != -1)
+ close (mem_validate_pipe[1]);
+
+ do_pipe2 (mem_validate_pipe);
+}
+
+ALWAYS_INLINE
+static int
+write_validate (void *addr)
+{
+ int ret = -1;
+ ssize_t bytes = 0;
+
+ do
+ {
+ char buf;
+ bytes = read (mem_validate_pipe[0], &buf, 1);
+ }
+ while ( errno == EINTR );
+
+ int valid_read = (bytes > 0 || errno == EAGAIN || errno == EWOULDBLOCK);
+ if (!valid_read)
+ {
+ // re-open closed pipe
+ open_pipe ();
+ }
+
+ do
+ {
+ ret = write (mem_validate_pipe[1], addr, 1);
+ }
+ while ( errno == EINTR );
+
+ return ret;
+}
+
+static int (*mem_validate_func) (void *addr, size_t len);
+static int msync_validate (void *addr, size_t len)
+{
+ if (msync (addr, len, MS_ASYNC) != 0)
+ {
+ return -1;
+ }
+
+ return write_validate (addr);
+}
+
+#ifdef HAVE_MINCORE
+static int mincore_validate (void *addr, size_t len)
+{
+ unsigned char mvec[2]; /* Unaligned access may cross page boundary */
+
+ /* mincore could fail with EAGAIN but we conservatively return -1
+ instead of looping. */
+ if (mincore (addr, len, (unsigned char *)mvec) != 0)
+ {
+ return -1;
+ }
+
+ return write_validate (addr);
+}
+#endif
+
+/* Initialise memory validation method. On linux kernels <2.6.21,
+ mincore() returns incorrect value for MAP_PRIVATE mappings,
+ such as stacks. If mincore() was available at compile time,
+ check if we can actually use it. If not, use msync() instead. */
+HIDDEN void
+tdep_init_mem_validate (void)
+{
+ open_pipe ();
+
+#ifdef HAVE_MINCORE
+ unsigned char present = 1;
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
+ unsigned char mvec[1];
+ int ret;
+ while ((ret = mincore((void *)addr, len, (unsigned char *)mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
+ if (ret == 0)
+ {
+ Debug(1, "using mincore to validate memory\n");
+ mem_validate_func = mincore_validate;
+ }
+ else
+#endif
+ {
+ Debug(1, "using msync to validate memory\n");
+ mem_validate_func = msync_validate;
+ }
+}
+
+/* Cache of already validated addresses */
+#define NLGA 4
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
+// thread-local variant
+static _Thread_local unw_word_t last_good_addr[NLGA];
+static _Thread_local int lga_victim;
+
+static int
+is_cached_valid_mem(unw_word_t addr)
+{
+ int i;
+ for (i = 0; i < NLGA; i++)
+ {
+ if (addr == last_good_addr[i])
+ return 1;
+ }
+ return 0;
+}
+
+static void
+cache_valid_mem(unw_word_t addr)
+{
+ int i, victim;
+ victim = lga_victim;
+ for (i = 0; i < NLGA; i++) {
+ if (last_good_addr[victim] == 0) {
+ last_good_addr[victim] = addr;
+ return;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ last_good_addr[victim] = addr;
+ victim = (victim + 1) % NLGA;
+ lga_victim = victim;
+}
+
+#else
+// global, thread safe variant
+static _Atomic unw_word_t last_good_addr[NLGA];
+static _Atomic int lga_victim;
+
+static int
+is_cached_valid_mem(unw_word_t addr)
+{
+ int i;
+ for (i = 0; i < NLGA; i++)
+ {
+ if (addr == atomic_load(&last_good_addr[i]))
+ return 1;
+ }
+ return 0;
+}
+
+static void
+cache_valid_mem(unw_word_t addr)
+{
+ int i, victim;
+ victim = atomic_load(&lga_victim);
+ unw_word_t zero = 0;
+ for (i = 0; i < NLGA; i++) {
+ if (atomic_compare_exchange_strong(&last_good_addr[victim], &zero, addr)) {
+ return;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ atomic_store(&last_good_addr[victim], addr);
+ victim = (victim + 1) % NLGA;
+ atomic_store(&lga_victim, victim);
+}
+#endif
+
+static int
+validate_mem (unw_word_t addr)
+{
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
+
+ if (addr == 0)
+ return -1;
+
+ if (is_cached_valid_mem(addr))
+ return 0;
+
+ if (mem_validate_func ((void *) addr, len) == -1)
+ return -1;
+
+ cache_valid_mem(addr);
+
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (16, "mem[%p] <- %lx\n", addr, *val);
+ *(unw_word_t *) (intptr_t) addr = *val;
+ }
+ else
+ {
+ /* validate address */
+ const struct cursor *c = (const struct cursor *)arg;
+
+ if (likely (c != NULL) && unlikely (c->validate)
+ && unlikely (validate_mem (addr))) {
+ Debug (16, "mem[%016lx] -> invalid\n", addr);
+ return -1;
+ }
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ unw_tdep_context_t *uc = ((struct cursor *)arg)->uc;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ Debug (16, "reg = %s\n", unw_regname (reg));
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *addr = *val;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *fpval, int write,
+ void *arg)
+{
+ struct cursor *c = (struct cursor *)arg;
+
+ unw_fpreg_t *addr;
+ unw_context_t *uc = c->uc;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ Debug (16, "reg = %s\n", unw_regname (reg));
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *addr = *fpval;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *fpval);
+ }
+ else
+ {
+ *fpval = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *fpval);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+riscv_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.addr_size = sizeof (void *);
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = riscv_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ local_addr_space.big_endian = target_is_big_endian();
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/dist/src/riscv/Ginit_local.c b/src/third_party/unwind/dist/src/riscv/Ginit_local.c
new file mode 100644
index 00000000000..255e75a2bf5
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Ginit_local.c
@@ -0,0 +1,81 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!atomic_load(&tdep_init_done))
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = cursor;
+ c->uc = uc;
+ c->validate = 1;
+
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, unw_context_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/third_party/unwind/dist/src/riscv/Ginit_remote.c b/src/third_party/unwind/dist/src/riscv/Ginit_remote.c
new file mode 100644
index 00000000000..08f5f158249
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Ginit_remote.c
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!atomic_load(&tdep_init_done))
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ if (as == unw_local_addr_space)
+ {
+ c->dwarf.as_arg = c;
+ c->uc = as_arg;
+ }
+ else
+ {
+ c->dwarf.as_arg = as_arg;
+ c->uc = 0;
+ }
+
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gis_signal_frame.c b/src/third_party/unwind/dist/src/riscv/Gis_signal_frame.c
new file mode 100644
index 00000000000..923563431c8
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gis_signal_frame.c
@@ -0,0 +1,79 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+#ifdef __linux__
+
+/*
+ The stub looks like:
+
+ addi x17, zero, 139 0x08b00893
+ ecall 0x00000073
+
+ See <https://github.com/torvalds/linux/blob/44db63d1ad8d71c6932cbe007eb41f31c434d140/arch/riscv/kernel/vdso/rt_sigreturn.S>.
+*/
+#define SIGRETURN_I0 0x08b00893
+#define SIGRETURN_I1 0x00000073
+
+#endif /* __linux__ */
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor*) cursor;
+ unw_word_t i0, i1, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ if (!ip || !a->access_mem || (ip & (sizeof(unw_word_t) - 1)))
+ return 0;
+
+ if ((ret = (*a->access_mem) (as, ip, &i0, 0, arg)) < 0)
+ return ret;
+
+ if ((ret = (*a->access_mem) (as, ip + 4, &i1, 0, arg)) < 0)
+ return ret;
+
+ if ((i0 & 0xffffffff) == SIGRETURN_I0 && (i1 & 0xffffffff) == SIGRETURN_I1)
+ {
+ Debug (8, "cursor at signal frame\n");
+ return 1;
+ }
+
+ return 0;
+#else
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Greg_states_iterate.c b/src/third_party/unwind/dist/src/riscv/Greg_states_iterate.c
new file mode 100644
index 00000000000..b436370cfbc
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Greg_states_iterate.c
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (c) 2004 Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gregs.c b/src/third_party/unwind/dist/src/riscv/Gregs.c
new file mode 100644
index 00000000000..61db986813f
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gregs.c
@@ -0,0 +1,95 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc;
+
+ if (reg >= UNW_RISCV_F0 && reg <= UNW_RISCV_F31)
+ return -UNW_EBADREG;
+
+ switch (reg)
+ {
+ case UNW_RISCV_X0:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = 0;
+ return 0;
+ case UNW_TDEP_IP:
+ if (write)
+ {
+ Debug (16, "pc is now 0x%lx\n", *valp);
+ c->dwarf.ip = *valp;
+ }
+
+ /* We store PC in place of the hard-wired X0 */
+ loc = c->dwarf.loc[0];
+
+ /* FIXME: Is IP valid? */
+ break;
+ case UNW_TDEP_SP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+ default:
+ loc = c->dwarf.loc[reg];
+ break;
+ }
+
+ if (write)
+ {
+ return dwarf_put (&c->dwarf, loc, *valp);
+ }
+ else
+ {
+ return dwarf_get (&c->dwarf, loc, valp);
+ }
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ dwarf_loc_t loc;
+
+ if (reg < UNW_RISCV_F0 || reg > UNW_RISCV_F31)
+ return -UNW_EBADREG;
+
+ loc = c->dwarf.loc[reg];
+
+ if (write)
+ {
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ }
+ else
+ {
+ return dwarf_getfp (&c->dwarf, loc, valp);
+ }
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gresume.c b/src/third_party/unwind/dist/src/riscv/Gresume.c
new file mode 100644
index 00000000000..c157ea6eb40
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gresume.c
@@ -0,0 +1,122 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+
+#include "unwind_i.h"
+#include "offsets.h"
+#include <ucontext.h>
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+riscv_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->uc;
+
+ unw_word_t *mcontext = (unw_word_t*) &uc->uc_mcontext;
+ mcontext[0] = c->dwarf.ip;
+
+ if (c->sigcontext_format == RISCV_SCF_NONE)
+ {
+ /* Restore PC in RA */
+ mcontext[1] = c->dwarf.ip;
+
+ Debug (8, "resuming at ip=0x%lx via setcontext()\n", c->dwarf.ip);
+
+ setcontext(uc);
+ }
+ else
+ {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+ unw_word_t *regs = (unw_word_t*)sc;
+
+ regs[0] = c->dwarf.ip;
+ for (int i = UNW_RISCV_X1; i <= UNW_RISCV_F31; ++i) {
+ regs[i] = mcontext[i];
+ }
+
+ Debug (8, "resuming at ip=0x%lx via sigreturn() (trampoline @ 0x%lx, sp @ 0x%lx)\n", c->dwarf.ip, c->sigcontext_pc, c->sigcontext_sp);
+
+ // Jump back to the trampoline
+ __asm__ __volatile__ (
+ "mv sp, %0\n"
+ "jr %1 \n"
+ : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc)
+ );
+ }
+
+ unreachable();
+#else
+# warning Implement me
+#endif
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = UNW_RISCV_X1; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ as->acc.access_fpreg (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *)c,
+ c->dwarf.as_arg);
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Gstep.c b/src/third_party/unwind/dist/src/riscv/Gstep.c
new file mode 100644
index 00000000000..5126b0efd7d
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Gstep.c
@@ -0,0 +1,130 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+static int
+riscv_handle_signal_frame (unw_cursor_t *cursor)
+{
+ int ret, i;
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+
+ if (!unw_is_signal_frame (cursor))
+ return -UNW_EUNSPEC;
+
+#ifdef __linux__
+ /* rt_sigframe contains the siginfo structure, the ucontext, and then
+ the trampoline. We store the mcontext inside ucontext as sigcontext_addr.
+ */
+ c->sigcontext_format = RISCV_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = sp_addr + sizeof (siginfo_t) + UC_MCONTEXT_REGS_OFF;
+ c->sigcontext_sp = sp_addr;
+ c->sigcontext_pc = c->dwarf.ip;
+#else
+ /* Not making any assumption at all - You need to implement this */
+ return -UNW_EUNSPEC;
+#endif
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+
+#define SC_REG_OFFSET(X) (8 * X)
+
+ /* The PC is stored in place of X0 in sigcontext */
+ c->dwarf.loc[UNW_TDEP_IP] = DWARF_LOC (c->sigcontext_addr + SC_REG_OFFSET(UNW_RISCV_X0), 0);
+
+ for (i = UNW_RISCV_X1; i <= UNW_RISCV_F31; i++)
+ {
+ c->dwarf.loc[i] = DWARF_LOC (c->sigcontext_addr + SC_REG_OFFSET(i), 0);
+ }
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_TDEP_SP], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_TDEP_IP], &c->dwarf.ip);
+
+ return 1;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int validate = c->validate;
+ int ret;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx, sp=0x%016lx)\n",
+ c, c->dwarf.ip, c->dwarf.cfa);
+
+ /* Validate all addresses before dereferencing. */
+ c->validate = 1;
+
+ /* Special handling the signal frame. */
+ if (unw_is_signal_frame (cursor) > 0)
+ return riscv_handle_signal_frame (cursor);
+
+ /* Restore default memory validation state */
+ c->validate = validate;
+
+ /* Try DWARF-based unwinding... */
+ ret = dwarf_step (&c->dwarf);
+
+ if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ /* DWARF unwinding didn't work, let's tread carefully here */
+ if (unlikely (ret < 0))
+ {
+ Debug (1, "DWARF unwinding failed (cursor=%p, ip=0x%016lx, sp=0x%016lx)\n", c, c->dwarf.ip, c->dwarf.cfa);
+
+ /* Try RA/X1? */
+ c->dwarf.loc[UNW_RISCV_PC] = c->dwarf.loc[UNW_RISCV_X1];
+ c->dwarf.loc[UNW_RISCV_X1] = DWARF_NULL_LOC;
+ if (!DWARF_IS_NULL_LOC (c->dwarf.loc[UNW_RISCV_PC]))
+ {
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_RISCV_PC], &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "Failed to get PC from return address: %d\n", ret);
+ return ret;
+ }
+
+ Debug (2, "ra= 0x%016lx\n", c->dwarf.ip);
+ ret = 1;
+ }
+ else
+ {
+ c->dwarf.ip = 0;
+ }
+ }
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
diff --git a/src/third_party/unwind/dist/src/riscv/Lapply_reg_state.c b/src/third_party/unwind/dist/src/riscv/Lapply_reg_state.c
new file mode 100644
index 00000000000..7ebada480e5
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lcreate_addr_space.c b/src/third_party/unwind/dist/src/riscv/Lcreate_addr_space.c
new file mode 100644
index 00000000000..0f2dc6be901
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lget_proc_info.c b/src/third_party/unwind/dist/src/riscv/Lget_proc_info.c
new file mode 100644
index 00000000000..69028b019fc
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lget_save_loc.c b/src/third_party/unwind/dist/src/riscv/Lget_save_loc.c
new file mode 100644
index 00000000000..9ea048a9076
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lglobal.c b/src/third_party/unwind/dist/src/riscv/Lglobal.c
new file mode 100644
index 00000000000..6d7b489e14b
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Linit.c b/src/third_party/unwind/dist/src/riscv/Linit.c
new file mode 100644
index 00000000000..e9abfdd46a3
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Linit_local.c b/src/third_party/unwind/dist/src/riscv/Linit_local.c
new file mode 100644
index 00000000000..68a1687e854
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Linit_remote.c b/src/third_party/unwind/dist/src/riscv/Linit_remote.c
new file mode 100644
index 00000000000..58cb04ab7cd
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lis_signal_frame.c b/src/third_party/unwind/dist/src/riscv/Lis_signal_frame.c
new file mode 100644
index 00000000000..b9a7c4f51ad
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lreg_states_iterate.c b/src/third_party/unwind/dist/src/riscv/Lreg_states_iterate.c
new file mode 100644
index 00000000000..f1eb1e79dcd
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lregs.c b/src/third_party/unwind/dist/src/riscv/Lregs.c
new file mode 100644
index 00000000000..2c9c75cd7d9
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lresume.c b/src/third_party/unwind/dist/src/riscv/Lresume.c
new file mode 100644
index 00000000000..41a8cf003de
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/Lstep.c b/src/third_party/unwind/dist/src/riscv/Lstep.c
new file mode 100644
index 00000000000..c1ac3c7547f
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/asm.h b/src/third_party/unwind/dist/src/riscv/asm.h
new file mode 100644
index 00000000000..7f7b444f931
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/asm.h
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if __riscv_xlen == 32
+# define STORE sw
+# define LOAD lw
+# define SZREG 4
+#elif __riscv_xlen == 64
+# define STORE sd
+# define LOAD ld
+# define SZREG 8
+#endif
+
+#if __riscv_flen == 64
+# define SZFREG 8
+# define STORE_FP fsd
+# define LOAD_FP fld
+#elif __riscv_flen == 32
+# define SZFREG 4
+# define STORE_FP fsw
+# define LOAD_FP flw
+#else
+# error "Unsupported RISC-V floating-point length"
+#endif
+
diff --git a/src/third_party/unwind/dist/src/riscv/getcontext.S b/src/third_party/unwind/dist/src/riscv/getcontext.S
new file mode 100644
index 00000000000..9c24888b861
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/getcontext.S
@@ -0,0 +1,87 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "asm.h"
+
+#define REG(X) (UC_MCONTEXT_REGS_OFF + SZREG * X)(a0)
+#define FREG(X) (UC_MCONTEXT_REGS_OFF + SZREG * 32 + SZFREG * X)(a0)
+
+ .text
+ .global _Uriscv_getcontext
+ .type _Uriscv_getcontext, @function
+_Uriscv_getcontext:
+ .cfi_startproc
+
+ STORE ra, REG(0)
+ STORE ra, REG(1)
+ STORE sp, REG(2)
+ STORE s0, REG(8)
+ STORE s1, REG(9)
+ STORE x0, REG(10) /* Write 0 to a0 */
+ STORE a1, REG(11)
+ STORE a2, REG(12)
+ STORE a3, REG(13)
+ STORE a4, REG(14)
+ STORE a5, REG(15)
+ STORE a6, REG(16)
+ STORE a7, REG(17)
+ STORE s2, REG(18)
+ STORE s3, REG(19)
+ STORE s4, REG(20)
+ STORE s5, REG(21)
+ STORE s6, REG(22)
+ STORE s7, REG(23)
+ STORE s8, REG(24)
+ STORE s9, REG(25)
+ STORE s10, REG(26)
+ STORE s11, REG(27)
+
+#ifdef STORE_FP
+ /* The FCSR is always 32-bits and comes after all registers */
+ frcsr a1
+ sw a1, FREG(32)
+
+ STORE_FP fs0, FREG(8)
+ STORE_FP fs1, FREG(9)
+ STORE_FP fs2, FREG(18)
+ STORE_FP fs3, FREG(19)
+ STORE_FP fs4, FREG(20)
+ STORE_FP fs5, FREG(21)
+ STORE_FP fs6, FREG(22)
+ STORE_FP fs7, FREG(23)
+ STORE_FP fs8, FREG(24)
+ STORE_FP fs9, FREG(25)
+ STORE_FP fs10, FREG(26)
+ STORE_FP fs11, FREG(27)
+#endif
+
+ li a0, 0
+ ret
+
+ .cfi_endproc
+ .size _Uriscv_getcontext, . - _Uriscv_getcontext
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/third_party/unwind/dist/src/riscv/init.h b/src/third_party/unwind/dist/src/riscv/init.h
new file mode 100644
index 00000000000..163ddb42765
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/init.h
@@ -0,0 +1,65 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ for (i = 0; i < 32; i++)
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, UNW_RISCV_X0 + i);
+
+ for (i = 32; i < DWARF_NUM_PRESERVED_REGS; i++)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ c->dwarf.loc[UNW_RISCV_PC] = DWARF_REG_LOC (&c->dwarf, UNW_RISCV_PC);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_RISCV_PC], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_TDEP_SP),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = RISCV_SCF_NONE;
+ c->sigcontext_addr = 0;
+ c->sigcontext_sp = 0;
+ c->sigcontext_pc = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/third_party/unwind/dist/src/riscv/is_fpreg.c b/src/third_party/unwind/dist/src/riscv/is_fpreg.c
new file mode 100644
index 00000000000..f5a6dc4e31a
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/is_fpreg.c
@@ -0,0 +1,31 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ return (regnum >= UNW_RISCV_F0 && regnum <= UNW_RISCV_F31);
+}
diff --git a/src/third_party/unwind/dist/src/riscv/offsets.h b/src/third_party/unwind/dist/src/riscv/offsets.h
new file mode 100644
index 00000000000..66a2eef62a9
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/offsets.h
@@ -0,0 +1,13 @@
+#ifdef __linux__
+
+/* Linux-specific definitions: */
+
+/* The RISC-V ucontext has the following structure:
+
+ https://github.com/torvalds/linux/blob/44db63d1ad8d71c6932cbe007eb41f31c434d140/arch/riscv/include/uapi/asm/ucontext.h
+*/
+#define UC_MCONTEXT_REGS_OFF 176
+
+#else
+# error "Unsupported OS"
+#endif
diff --git a/src/third_party/unwind/dist/src/riscv/regname.c b/src/third_party/unwind/dist/src/riscv/regname.c
new file mode 100644
index 00000000000..370383ac69d
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/regname.c
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ /* 0. */
+ "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2",
+ /* 8. */
+ "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5",
+ /* 16. */
+ "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7",
+ /* 24. */
+ "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6",
+
+ /* 0. */
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ /* 8. */
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ /* 16. */
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ /* 24. */
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
+
+ /* pc */
+ "pc"
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/third_party/unwind/dist/src/riscv/setcontext.S b/src/third_party/unwind/dist/src/riscv/setcontext.S
new file mode 100644
index 00000000000..43f0b929060
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/setcontext.S
@@ -0,0 +1,87 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2021 Zhaofeng Li
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "asm.h"
+
+#define REG(X) (UC_MCONTEXT_REGS_OFF + SZREG * X)(a0)
+#define FREG(X) (UC_MCONTEXT_REGS_OFF + SZREG * 32 + SZFREG * X)(a0)
+
+ .text
+ .global _Uriscv_setcontext
+ .type _Uriscv_setcontext, @function
+_Uriscv_setcontext:
+ .cfi_startproc
+
+#ifdef LOAD_FP
+ /* The FCSR is always 32-bits and comes after all registers */
+ lw a1, FREG(32)
+ fscsr a1
+
+ LOAD_FP fs0, FREG(8)
+ LOAD_FP fs1, FREG(9)
+ LOAD_FP fs2, FREG(18)
+ LOAD_FP fs3, FREG(19)
+ LOAD_FP fs4, FREG(20)
+ LOAD_FP fs5, FREG(21)
+ LOAD_FP fs6, FREG(22)
+ LOAD_FP fs7, FREG(23)
+ LOAD_FP fs8, FREG(24)
+ LOAD_FP fs9, FREG(25)
+ LOAD_FP fs10, FREG(26)
+ LOAD_FP fs11, FREG(27)
+#endif
+
+ LOAD t1, REG(0)
+ LOAD ra, REG(1)
+ LOAD sp, REG(2)
+ LOAD s0, REG(8)
+ LOAD s1, REG(9)
+ LOAD a1, REG(11)
+ LOAD a2, REG(12)
+ LOAD a3, REG(13)
+ LOAD a4, REG(14)
+ LOAD a5, REG(15)
+ LOAD a6, REG(16)
+ LOAD a7, REG(17)
+ LOAD s2, REG(18)
+ LOAD s3, REG(19)
+ LOAD s4, REG(20)
+ LOAD s5, REG(21)
+ LOAD s6, REG(22)
+ LOAD s7, REG(23)
+ LOAD s8, REG(24)
+ LOAD s9, REG(25)
+ LOAD s10, REG(26)
+ LOAD s11, REG(27)
+
+ LOAD a0, REG(10)
+
+ jr t1
+
+ .cfi_endproc
+ .size _Uriscv_setcontext, . - _Uriscv_setcontext
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/third_party/unwind/dist/src/riscv/siglongjmp.S b/src/third_party/unwind/dist/src/riscv/siglongjmp.S
new file mode 100644
index 00000000000..9960691d996
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/siglongjmp.S
@@ -0,0 +1,7 @@
+ /* Dummy implementation for now. */
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ ret
diff --git a/src/third_party/unwind/dist/src/riscv/unwind_i.h b/src/third_party/unwind/dist/src/riscv/unwind_i.h
new file mode 100644
index 00000000000..3a045da0ace
--- /dev/null
+++ b/src/third_party/unwind/dist/src/riscv/unwind_i.h
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <memory.h>
+#include <stdint.h>
+
+#include <libunwind-riscv.h>
+
+#include "libunwind_i.h"
+
+#define riscv_lock UNW_OBJ(lock)
+#define riscv_local_resume UNW_OBJ(local_resume)
+#define riscv_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#define setcontext UNW_ARCH_OBJ (setcontext)
+
+extern void riscv_local_addr_space_init (void);
+extern int riscv_local_resume (unw_addr_space_t as,
+ unw_cursor_t *cursor,
+ void *arg);
+extern int setcontext (const ucontext_t *ucp);
+
+#endif /* unwind_i_h */
diff --git a/src/third_party/unwind/dist/src/s390x/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/s390x/Gcreate_addr_space.c
index d411454932b..094e6cad05f 100644
--- a/src/third_party/unwind/dist/src/s390x/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/s390x/Gcreate_addr_space.c
@@ -31,10 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
-#if defined(_BIG_ENDIAN) && !defined(__BIG_ENDIAN)
-#define __BIG_ENDIAN _BIG_ENDIAN
-#endif
-
unw_addr_space_t
unw_create_addr_space (unw_accessors_t *a, int byte_order)
{
@@ -46,7 +42,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
/*
* s390x supports only big-endian.
*/
- if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order != UNW_BIG_ENDIAN)
return NULL;
as = malloc (sizeof (*as));
diff --git a/src/third_party/unwind/dist/src/s390x/Gglobal.c b/src/third_party/unwind/dist/src/s390x/Gglobal.c
index e2abe89d307..be49c3f6822 100644
--- a/src/third_party/unwind/dist/src/s390x/Gglobal.c
+++ b/src/third_party/unwind/dist/src/s390x/Gglobal.c
@@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (s390x_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */
@@ -81,7 +81,7 @@ tdep_init (void)
lock_acquire (&s390x_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -94,7 +94,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
s390x_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&s390x_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/s390x/Ginit.c b/src/third_party/unwind/dist/src/s390x/Ginit.c
index db01743c062..2bce2f4b687 100644
--- a/src/third_party/unwind/dist/src/s390x/Ginit.c
+++ b/src/third_party/unwind/dist/src/s390x/Ginit.c
@@ -27,6 +27,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -93,9 +94,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
static int mem_validate_pipe[2] = {-1, -1};
static inline void
@@ -163,7 +161,7 @@ static int mincore_validate (void *addr, size_t len)
return -1;
}
- for (i = 0; i < (len + PAGE_SIZE - 1) / PAGE_SIZE; i++)
+ for (i = 0; i < (len + unw_page_size - 1) / unw_page_size; i++)
{
if (!(mvec[i] & 1)) return -1;
}
@@ -183,11 +181,14 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, mvec)) == -1 &&
- errno == EAGAIN) {}
+ while ((ret = mincore((void *)addr, len, mvec)) == -1 &&
+ errno == EAGAIN)
+ {
+ }
if (ret == 0 && (mvec[0] & 1))
{
Debug(1, "using mincore to validate memory\n");
@@ -210,14 +211,8 @@ static int
validate_mem (unw_word_t addr)
{
int i, victim;
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/third_party/unwind/dist/src/s390x/Ginit_local.c b/src/third_party/unwind/dist/src/s390x/Ginit_local.c
index 5eaead0f840..06a7c497415 100644
--- a/src/third_party/unwind/dist/src/s390x/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/s390x/Ginit_local.c
@@ -43,7 +43,7 @@ unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_i
{
struct cursor *c = (struct cursor *) cursor;
- if (unlikely (!tdep_init_done))
+ if (unlikely (!atomic_load(&tdep_init_done)))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/s390x/Ginit_remote.c b/src/third_party/unwind/dist/src/s390x/Ginit_remote.c
index efd61d64d4b..9ab1d6df11f 100644
--- a/src/third_party/unwind/dist/src/s390x/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/s390x/Ginit_remote.c
@@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/s390x/Gresume.c b/src/third_party/unwind/dist/src/s390x/Gresume.c
index fd9d13027e2..bfc4d5cab4e 100644
--- a/src/third_party/unwind/dist/src/s390x/Gresume.c
+++ b/src/third_party/unwind/dist/src/s390x/Gresume.c
@@ -68,7 +68,7 @@ s390x_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
sp = c->sigcontext_sp;
ip = c->sigcontext_pc;
__asm__ __volatile__ (
- "lgr 15, %[sp]\n"
+ "lgr %%r15, %[sp]\n"
"br %[ip]\n"
: : [sp] "r" (sp), [ip] "r" (ip)
);
@@ -86,7 +86,7 @@ s390x_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
sp = c->sigcontext_sp;
ip = c->sigcontext_pc;
__asm__ __volatile__ (
- "lgr 15, %[sp]\n"
+ "lgr %%r15, %[sp]\n"
"br %[ip]\n"
: : [sp] "r" (sp), [ip] "r" (ip)
);
diff --git a/src/third_party/unwind/dist/src/sh/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/sh/Gcreate_addr_space.c
index 6ca3a384da0..cc6bf6584ee 100644
--- a/src/third_party/unwind/dist/src/sh/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/sh/Gcreate_addr_space.c
@@ -36,8 +36,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
unw_addr_space_t as;
/* SH supports little-endian and big-endian. */
- if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
return NULL;
as = malloc (sizeof (*as));
@@ -49,7 +48,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
as->acc = *a;
/* Default to little-endian for SH. */
- if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ if (byte_order == 0 || byte_order == UNW_LITTLE_ENDIAN)
as->big_endian = 0;
else
as->big_endian = 1;
diff --git a/src/third_party/unwind/dist/src/sh/Gglobal.c b/src/third_party/unwind/dist/src/sh/Gglobal.c
index ed273339768..5fc546f70d3 100644
--- a/src/third_party/unwind/dist/src/sh/Gglobal.c
+++ b/src/third_party/unwind/dist/src/sh/Gglobal.c
@@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (sh_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
HIDDEN void
tdep_init (void)
@@ -38,7 +38,7 @@ tdep_init (void)
lock_acquire (&sh_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -49,7 +49,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
sh_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&sh_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/sh/Ginit_local.c b/src/third_party/unwind/dist/src/sh/Ginit_local.c
index 45631306bcd..76b64e73ba2 100644
--- a/src/third_party/unwind/dist/src/sh/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/sh/Ginit_local.c
@@ -41,7 +41,7 @@ unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_pre
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/sh/Ginit_remote.c b/src/third_party/unwind/dist/src/sh/Ginit_remote.c
index 9b8ba5b89de..26d11ba942b 100644
--- a/src/third_party/unwind/dist/src/sh/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/sh/Ginit_remote.c
@@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/tilegx/Gcreate_addr_space.c b/src/third_party/unwind/dist/src/tilegx/Gcreate_addr_space.c
index 39acdc2c3d3..a37c1282f61 100644
--- a/src/third_party/unwind/dist/src/tilegx/Gcreate_addr_space.c
+++ b/src/third_party/unwind/dist/src/tilegx/Gcreate_addr_space.c
@@ -33,8 +33,14 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
#ifdef UNW_LOCAL_ONLY
return NULL;
#else
- unw_addr_space_t as = malloc (sizeof (*as));
+ /*
+ * Tilegx supports only big or little-endian, not weird stuff like
+ * PDP_ENDIAN.
+ */
+ if (byte_order != 0 && byte_order_is_valid(byte_order) == 0)
+ return NULL;
+ unw_addr_space_t as = malloc (sizeof (*as));
if (!as)
return NULL;
@@ -42,20 +48,11 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
as->acc = *a;
- /*
- * Tilegx supports only big or little-endian, not weird stuff like
- * PDP_ENDIAN.
- */
- if (byte_order != 0
- && byte_order != __LITTLE_ENDIAN
- && byte_order != __BIG_ENDIAN)
- return NULL;
-
if (byte_order == 0)
/* use host default: */
- as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ as->big_endian = target_is_big_endian();
else
- as->big_endian = (byte_order == __BIG_ENDIAN);
+ as->big_endian = (byte_order == UNW_BIG_ENDIAN);
as->abi = UNW_TILEGX_ABI_N64;
as->addr_size = 8;
diff --git a/src/third_party/unwind/dist/src/tilegx/Gglobal.c b/src/third_party/unwind/dist/src/tilegx/Gglobal.c
index e18f50a50f3..5232d41c23b 100644
--- a/src/third_party/unwind/dist/src/tilegx/Gglobal.c
+++ b/src/third_party/unwind/dist/src/tilegx/Gglobal.c
@@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
__attribute__((weak))
pthread_mutex_t tilegx_lock = PTHREAD_MUTEX_INITIALIZER;
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
HIDDEN const uint8_t dwarf_to_unw_regnum_map[] =
{
@@ -47,7 +47,7 @@ tdep_init (void)
lock_acquire (&tilegx_lock, saved_mask);
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -57,7 +57,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
tilegx_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
out:
lock_release (&tilegx_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/tilegx/Ginit.c b/src/third_party/unwind/dist/src/tilegx/Ginit.c
index 925e6413246..9d6c92ad4f9 100644
--- a/src/third_party/unwind/dist/src/tilegx/Ginit.c
+++ b/src/third_party/unwind/dist/src/tilegx/Ginit.c
@@ -147,7 +147,7 @@ __attribute__((weak)) void
tilegx_local_addr_space_init (void)
{
memset (&local_addr_space, 0, sizeof (local_addr_space));
- local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ local_addr_space.big_endian = target_is_big_endian();
local_addr_space.abi = UNW_TILEGX_ABI_N64;
local_addr_space.addr_size = sizeof (void *);
diff --git a/src/third_party/unwind/dist/src/tilegx/Ginit_local.c b/src/third_party/unwind/dist/src/tilegx/Ginit_local.c
index 31a716df348..029558675fd 100644
--- a/src/third_party/unwind/dist/src/tilegx/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/tilegx/Ginit_local.c
@@ -41,7 +41,7 @@ unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_in
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
memset(c, 0, sizeof(unw_cursor_t));
diff --git a/src/third_party/unwind/dist/src/tilegx/Ginit_remote.c b/src/third_party/unwind/dist/src/tilegx/Ginit_remote.c
index 2a31b18aaef..d6a874c13e8 100644
--- a/src/third_party/unwind/dist/src/tilegx/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/tilegx/Ginit_remote.c
@@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/x86/Gglobal.c b/src/third_party/unwind/dist/src/x86/Gglobal.c
index 132b8249944..f1d11d18f5b 100644
--- a/src/third_party/unwind/dist/src/x86/Gglobal.c
+++ b/src/third_party/unwind/dist/src/x86/Gglobal.c
@@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
HIDDEN define_lock (x86_lock);
-HIDDEN int tdep_init_done;
+HIDDEN atomic_bool tdep_init_done = 0;
/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
@@ -49,7 +49,7 @@ tdep_init (void)
lock_acquire (&x86_lock, saved_mask);
{
- if (tdep_init_done)
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -60,7 +60,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY
x86_local_addr_space_init ();
#endif
- tdep_init_done = 1; /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
lock_release (&x86_lock, saved_mask);
diff --git a/src/third_party/unwind/dist/src/x86/Ginit.c b/src/third_party/unwind/dist/src/x86/Ginit.c
index 3cec74a216b..4261fb5235a 100644
--- a/src/third_party/unwind/dist/src/x86/Ginit.c
+++ b/src/third_party/unwind/dist/src/x86/Ginit.c
@@ -74,9 +74,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
/* Cache of already validated addresses */
#define NLGA 4
static unw_word_t last_good_addr[NLGA];
@@ -89,14 +86,8 @@ validate_mem (unw_word_t addr)
#ifdef HAVE_MINCORE
unsigned char mvec[2]; /* Unaligned access may cross page boundary */
#endif
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
diff --git a/src/third_party/unwind/dist/src/x86/Ginit_local.c b/src/third_party/unwind/dist/src/x86/Ginit_local.c
index bff068704de..0342315d822 100644
--- a/src/third_party/unwind/dist/src/x86/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/x86/Ginit_local.c
@@ -41,7 +41,7 @@ unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_in
{
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/x86/Ginit_remote.c b/src/third_party/unwind/dist/src/x86/Ginit_remote.c
index 7c15096e4f7..18c46624bc2 100644
--- a/src/third_party/unwind/dist/src/x86/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/x86/Ginit_remote.c
@@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!tdep_init_done)
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
diff --git a/src/third_party/unwind/dist/src/x86/Gos-freebsd.c b/src/third_party/unwind/dist/src/x86/Gos-freebsd.c
index 7dd01404638..1b251d027fb 100644
--- a/src/third_party/unwind/dist/src/x86/Gos-freebsd.c
+++ b/src/third_party/unwind/dist/src/x86/Gos-freebsd.c
@@ -138,6 +138,7 @@ x86_handle_signal_frame (unw_cursor_t *cursor)
c->dwarf.loc[ST0] = DWARF_NULL_LOC;
} else if (c->sigcontext_format == X86_SCF_FREEBSD_SYSCALL) {
c->dwarf.loc[EIP] = DWARF_LOC (c->dwarf.cfa, 0);
+ c->dwarf.loc[ESP] = DWARF_VAL_LOC (c, c->dwarf.cfa + 4);
c->dwarf.loc[EAX] = DWARF_NULL_LOC;
c->dwarf.cfa += 4;
c->dwarf.use_prev_instr = 1;
diff --git a/src/third_party/unwind/dist/src/x86/Gos-linux.c b/src/third_party/unwind/dist/src/x86/Gos-linux.c
index fb9a5e34612..d448dce7357 100644
--- a/src/third_party/unwind/dist/src/x86/Gos-linux.c
+++ b/src/third_party/unwind/dist/src/x86/Gos-linux.c
@@ -298,12 +298,16 @@ x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
+#if !defined(__ANDROID__)
x86_sigreturn (sc);
+#endif
}
else
{
Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
+#if !defined(__ANDROID__)
setcontext (uc);
+#endif
}
return -UNW_EINVAL;
}
diff --git a/src/third_party/unwind/dist/src/x86/Gregs.c b/src/third_party/unwind/dist/src/x86/Gregs.c
index 4a9592617d0..9446d6c62c6 100644
--- a/src/third_party/unwind/dist/src/x86/Gregs.c
+++ b/src/third_party/unwind/dist/src/x86/Gregs.c
@@ -53,7 +53,6 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
break;
case UNW_X86_CFA:
- case UNW_X86_ESP:
if (write)
return -UNW_EREADONLYREG;
*valp = c->dwarf.cfa;
@@ -81,6 +80,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break;
case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break;
+ case UNW_X86_ESP: loc = c->dwarf.loc[ESP]; break;
case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break;
case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break;
case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break;
diff --git a/src/third_party/unwind/dist/src/x86/Gstep.c b/src/third_party/unwind/dist/src/x86/Gstep.c
index 129b739a3e7..061dcbaaa28 100644
--- a/src/third_party/unwind/dist/src/x86/Gstep.c
+++ b/src/third_party/unwind/dist/src/x86/Gstep.c
@@ -47,7 +47,7 @@ unw_step (unw_cursor_t *cursor)
{
/* DWARF failed, let's see if we can follow the frame-chain
or skip over the signal trampoline. */
- struct dwarf_loc ebp_loc, eip_loc;
+ struct dwarf_loc ebp_loc, eip_loc, esp_loc;
/* We could get here because of missing/bad unwind information.
Validate all addresses before dereferencing. */
@@ -77,6 +77,7 @@ unw_step (unw_cursor_t *cursor)
c->dwarf.cfa);
ebp_loc = DWARF_LOC (c->dwarf.cfa, 0);
+ esp_loc = DWARF_VAL_LOC (c, c->dwarf.cfa + 8);
eip_loc = DWARF_LOC (c->dwarf.cfa + 4, 0);
c->dwarf.cfa += 8;
@@ -87,6 +88,7 @@ unw_step (unw_cursor_t *cursor)
c->dwarf.loc[i] = DWARF_NULL_LOC;
c->dwarf.loc[EBP] = ebp_loc;
+ c->dwarf.loc[ESP] = esp_loc;
c->dwarf.loc[EIP] = eip_loc;
c->dwarf.use_prev_instr = 1;
}
diff --git a/src/third_party/unwind/dist/src/x86_64/Gglobal.c b/src/third_party/unwind/dist/src/x86_64/Gglobal.c
index 9a7b1957eb8..812cfb54298 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gglobal.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gglobal.c
@@ -28,13 +28,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "config.h"
#include "unwind_i.h"
#include "dwarf_i.h"
+#include <stdatomic.h>
HIDDEN define_lock (x86_64_lock);
-#ifdef HAVE_ATOMIC_OPS_H
- HIDDEN AO_t tdep_init_done;
-#else
- HIDDEN int tdep_init_done;
-#endif
+HIDDEN atomic_bool tdep_init_done = 0;
/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
@@ -87,7 +84,7 @@ tdep_init (void)
SIGPROCMASK (SIG_SETMASK, &full_mask, &saved_mask);
mutex_lock (&x86_64_lock);
{
- if (atomic_read(&tdep_init_done))
+ if (atomic_load(&tdep_init_done))
/* another thread else beat us to it... */
goto out;
@@ -96,12 +93,12 @@ tdep_init (void)
dwarf_init ();
+#ifndef UNW_REMOTE_ONLY
tdep_init_mem_validate ();
-#ifndef UNW_REMOTE_ONLY
x86_64_local_addr_space_init ();
#endif
- fetch_and_add1(&tdep_init_done); /* signal that we're initialized... */
+ atomic_store(&tdep_init_done, 1); /* signal that we're initialized... */
}
out:
mutex_unlock(&x86_64_lock);
diff --git a/src/third_party/unwind/dist/src/x86_64/Ginit.c b/src/third_party/unwind/dist/src/x86_64/Ginit.c
index fd8d418b1a5..e75f92a5f39 100644
--- a/src/third_party/unwind/dist/src/x86_64/Ginit.c
+++ b/src/third_party/unwind/dist/src/x86_64/Ginit.c
@@ -26,6 +26,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -34,7 +35,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/syscall.h>
+#if defined(HAVE_SYS_SYSCALL_H)
+# include <sys/syscall.h>
+#endif
+#include <stdatomic.h>
#include "unwind_i.h"
@@ -69,9 +73,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
return 0;
}
-#define PAGE_SIZE 4096
-#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
-
static int mem_validate_pipe[2] = {-1, -1};
#ifdef HAVE_PIPE2
@@ -137,8 +138,12 @@ write_validate (void *addr)
do
{
- /* use syscall insteadof write() so that ASAN does not complain */
- ret = syscall (SYS_write, mem_validate_pipe[1], addr, 1);
+#ifdef HAVE_SYS_SYSCALL_H
+ /* use syscall insteadof write() so that ASAN does not complain */
+ ret = syscall (SYS_write, mem_validate_pipe[1], addr, 1);
+#else
+ ret = write (mem_validate_pipe[1], addr, 1);
+#endif
}
while ( errno == EINTR );
@@ -163,7 +168,7 @@ static int mincore_validate (void *addr, size_t len)
/* mincore could fail with EAGAIN but we conservatively return -1
instead of looping. */
- if (mincore (addr, len, (char *)mvec) != 0)
+ if (mincore (addr, len, (unsigned char *)mvec) != 0)
{
return -1;
}
@@ -183,10 +188,11 @@ tdep_init_mem_validate (void)
#ifdef HAVE_MINCORE
unsigned char present = 1;
- unw_word_t addr = PAGE_START((unw_word_t)&present);
+ size_t len = unw_page_size;
+ unw_word_t addr = uwn_page_start((unw_word_t)&present);
unsigned char mvec[1];
int ret;
- while ((ret = mincore ((void*)addr, PAGE_SIZE, (char *)mvec)) == -1 &&
+ while ((ret = mincore ((void*)addr, len, (unsigned char *)mvec)) == -1 &&
errno == EAGAIN) {}
if (ret == 0)
{
@@ -203,10 +209,10 @@ tdep_init_mem_validate (void)
/* Cache of already validated addresses */
#define NLGA 4
-#if defined(HAVE___THREAD) && HAVE___THREAD
+#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
// thread-local variant
-static __thread unw_word_t last_good_addr[NLGA];
-static __thread int lga_victim;
+static _Thread_local unw_word_t last_good_addr[NLGA];
+static _Thread_local int lga_victim;
static int
is_cached_valid_mem(unw_word_t addr)
@@ -239,10 +245,10 @@ cache_valid_mem(unw_word_t addr)
lga_victim = victim;
}
-#elif HAVE_ATOMIC_OPS_H
+#else
// global, thread safe variant
-static AO_T last_good_addr[NLGA];
-static AO_T lga_victim;
+static _Atomic unw_word_t last_good_addr[NLGA];
+static _Atomic int lga_victim;
static int
is_cached_valid_mem(unw_word_t addr)
@@ -250,7 +256,7 @@ is_cached_valid_mem(unw_word_t addr)
int i;
for (i = 0; i < NLGA; i++)
{
- if (addr == AO_load(&last_good_addr[i]))
+ if (addr == atomic_load(&last_good_addr[i]))
return 1;
}
return 0;
@@ -260,44 +266,27 @@ static void
cache_valid_mem(unw_word_t addr)
{
int i, victim;
- victim = AO_load(&lga_victim);
+ victim = atomic_load(&lga_victim);
+ unw_word_t zero = 0;
for (i = 0; i < NLGA; i++) {
- if (AO_compare_and_swap(&last_good_addr[victim], 0, addr)) {
+ if (atomic_compare_exchange_strong(&last_good_addr[victim], &zero, addr)) {
return;
}
victim = (victim + 1) % NLGA;
}
/* All slots full. Evict the victim. */
- AO_store(&last_good_addr[victim], addr);
+ atomic_store(&last_good_addr[victim], addr);
victim = (victim + 1) % NLGA;
- AO_store(&lga_victim, victim);
-}
-#else
-// disabled, no cache
-static int
-is_cached_valid_mem(unw_word_t addr UNUSED)
-{
- return 0;
-}
-
-static void
-cache_valid_mem(unw_word_t addr UNUSED)
-{
+ atomic_store(&lga_victim, victim);
}
#endif
static int
validate_mem (unw_word_t addr)
{
- size_t len;
-
- if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
- len = PAGE_SIZE;
- else
- len = PAGE_SIZE * 2;
-
- addr = PAGE_START(addr);
+ size_t len = unw_page_size;
+ addr = uwn_page_start(addr);
if (addr == 0)
return -1;
@@ -325,8 +314,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
else
{
/* validate address */
- const struct cursor *c = (const struct cursor *)arg;
- if (likely (c != NULL) && unlikely (c->validate)
+ if (unlikely (AS_ARG_GET_VALIDATE(arg))
&& unlikely (validate_mem (addr))) {
Debug (16, "mem[%016lx] -> invalid\n", addr);
return -1;
@@ -342,7 +330,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
void *arg)
{
unw_word_t *addr;
- ucontext_t *uc = ((struct cursor *)arg)->uc;
+ ucontext_t *uc = AS_ARG_GET_UC_PTR(arg);
if (unw_is_fpreg (reg))
goto badreg;
@@ -371,7 +359,7 @@ static int
access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
int write, void *arg)
{
- ucontext_t *uc = ((struct cursor *)arg)->uc;
+ ucontext_t *uc = AS_ARG_GET_UC_PTR(arg);
unw_fpreg_t *addr;
if (!unw_is_fpreg (reg))
diff --git a/src/third_party/unwind/dist/src/x86_64/Ginit_local.c b/src/third_party/unwind/dist/src/x86_64/Ginit_local.c
index 12a9e3e4c96..bf771de384c 100644
--- a/src/third_party/unwind/dist/src/x86_64/Ginit_local.c
+++ b/src/third_party/unwind/dist/src/x86_64/Ginit_local.c
@@ -25,6 +25,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#include "unwind_i.h"
#include "init.h"
@@ -43,15 +44,13 @@ unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_i
{
struct cursor *c = (struct cursor *) cursor;
- if (unlikely (!atomic_read(&tdep_init_done)))
+ if (unlikely (!atomic_load(&tdep_init_done)))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
c->dwarf.as = unw_local_addr_space;
- c->dwarf.as_arg = c;
- c->uc = uc;
- c->validate = 0;
+ c->dwarf.as_arg = dwarf_build_as_arg(uc, /*validate*/ 0);
return common_init (c, use_prev_instr);
}
diff --git a/src/third_party/unwind/dist/src/x86_64/Ginit_remote.c b/src/third_party/unwind/dist/src/x86_64/Ginit_remote.c
index f411b233317..51761a7102f 100644
--- a/src/third_party/unwind/dist/src/x86_64/Ginit_remote.c
+++ b/src/third_party/unwind/dist/src/x86_64/Ginit_remote.c
@@ -26,6 +26,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "init.h"
+#include "libunwind_i.h"
#include "unwind_i.h"
int
@@ -36,7 +37,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor;
- if (!atomic_read(&tdep_init_done))
+ if (!atomic_load(&tdep_init_done))
tdep_init ();
Debug (1, "(cursor=%p)\n", c);
@@ -44,13 +45,11 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
c->dwarf.as = as;
if (as == unw_local_addr_space)
{
- c->dwarf.as_arg = c;
- c->uc = as_arg;
+ c->dwarf.as_arg = dwarf_build_as_arg(as_arg, /*validate*/ 0);
}
else
{
c->dwarf.as_arg = as_arg;
- c->uc = NULL;
}
return common_init (c, 0);
#endif /* !UNW_LOCAL_ONLY */
diff --git a/src/third_party/unwind/dist/src/x86_64/Gos-freebsd.c b/src/third_party/unwind/dist/src/x86_64/Gos-freebsd.c
index 883025c88dd..aa6a4b439e3 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gos-freebsd.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gos-freebsd.c
@@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "config.h"
#endif
-#include <sys/ucontext.h>
+#include <ucontext.h>
#include <machine/sigframe.h>
#include <signal.h>
#include <stddef.h>
@@ -133,6 +133,7 @@ x86_64_handle_signal_frame (unw_cursor_t *cursor)
c->dwarf.loc[RCX] = c->dwarf.loc[R10];
/* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */
/* rbp_loc = c->dwarf.loc[RBP]; */
+ c->dwarf.loc[RSP] = DWARF_VAL_LOC (c, c->dwarf.cfa + 8);
c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0);
ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n",
@@ -192,23 +193,23 @@ x86_64_sigreturn (unw_cursor_t *cursor)
ucontext_t *uc = (ucontext_t *)(c->sigcontext_addr +
offsetof(struct sigframe, sf_uc));
- uc->uc_mcontext.mc_r8 = c->uc->uc_mcontext.mc_r8;
- uc->uc_mcontext.mc_r9 = c->uc->uc_mcontext.mc_r9;
- uc->uc_mcontext.mc_r10 = c->uc->uc_mcontext.mc_r10;
- uc->uc_mcontext.mc_r11 = c->uc->uc_mcontext.mc_r11;
- uc->uc_mcontext.mc_r12 = c->uc->uc_mcontext.mc_r12;
- uc->uc_mcontext.mc_r13 = c->uc->uc_mcontext.mc_r13;
- uc->uc_mcontext.mc_r14 = c->uc->uc_mcontext.mc_r14;
- uc->uc_mcontext.mc_r15 = c->uc->uc_mcontext.mc_r15;
- uc->uc_mcontext.mc_rdi = c->uc->uc_mcontext.mc_rdi;
- uc->uc_mcontext.mc_rsi = c->uc->uc_mcontext.mc_rsi;
- uc->uc_mcontext.mc_rbp = c->uc->uc_mcontext.mc_rbp;
- uc->uc_mcontext.mc_rbx = c->uc->uc_mcontext.mc_rbx;
- uc->uc_mcontext.mc_rdx = c->uc->uc_mcontext.mc_rdx;
- uc->uc_mcontext.mc_rax = c->uc->uc_mcontext.mc_rax;
- uc->uc_mcontext.mc_rcx = c->uc->uc_mcontext.mc_rcx;
- uc->uc_mcontext.mc_rsp = c->uc->uc_mcontext.mc_rsp;
- uc->uc_mcontext.mc_rip = c->uc->uc_mcontext.mc_rip;
+ uc->uc_mcontext.mc_r8 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r8;
+ uc->uc_mcontext.mc_r9 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r9;
+ uc->uc_mcontext.mc_r10 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r10;
+ uc->uc_mcontext.mc_r11 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r11;
+ uc->uc_mcontext.mc_r12 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r12;
+ uc->uc_mcontext.mc_r13 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r13;
+ uc->uc_mcontext.mc_r14 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r14;
+ uc->uc_mcontext.mc_r15 = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_r15;
+ uc->uc_mcontext.mc_rdi = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rdi;
+ uc->uc_mcontext.mc_rsi = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rsi;
+ uc->uc_mcontext.mc_rbp = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rbp;
+ uc->uc_mcontext.mc_rbx = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rbx;
+ uc->uc_mcontext.mc_rdx = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rdx;
+ uc->uc_mcontext.mc_rax = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rax;
+ uc->uc_mcontext.mc_rcx = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rcx;
+ uc->uc_mcontext.mc_rsp = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rsp;
+ uc->uc_mcontext.mc_rip = dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_rip;
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
(unsigned long long) c->dwarf.ip, uc);
diff --git a/src/third_party/unwind/dist/src/x86_64/Gos-linux.c b/src/third_party/unwind/dist/src/x86_64/Gos-linux.c
index bd142345edd..b4893297b16 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gos-linux.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gos-linux.c
@@ -25,6 +25,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#include "unwind_i.h"
#include "ucontext_i.h"
@@ -140,7 +141,7 @@ x86_64_sigreturn (unw_cursor_t *cursor)
struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
mcontext_t *sc_mcontext = &((ucontext_t*)sc)->uc_mcontext;
/* Copy in saved uc - all preserved regs are at the start of sigcontext */
- memcpy(sc_mcontext, &c->uc->uc_mcontext,
+ memcpy(sc_mcontext, &dwarf_get_uc(&c->dwarf)->uc_mcontext,
DWARF_NUM_PRESERVED_REGS * sizeof(unw_word_t));
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
@@ -148,7 +149,7 @@ x86_64_sigreturn (unw_cursor_t *cursor)
__asm__ __volatile__ ("mov %0, %%rsp;"
"mov %1, %%rax;"
"syscall"
- :: "r"(sc), "i"(SYS_rt_sigreturn)
+ :: "r"((uint64_t)sc), "i"(SYS_rt_sigreturn)
: "memory");
abort();
}
diff --git a/src/third_party/unwind/dist/src/x86_64/Gregs.c b/src/third_party/unwind/dist/src/x86_64/Gregs.c
index baf8a24f0b9..dff5bcbe74b 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gregs.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gregs.c
@@ -79,7 +79,6 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
break;
case UNW_X86_64_CFA:
- case UNW_X86_64_RSP:
if (write)
return -UNW_EREADONLYREG;
*valp = c->dwarf.cfa;
@@ -107,6 +106,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break;
case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break;
+ case UNW_X86_64_RSP: loc = c->dwarf.loc[RSP]; break;
case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break;
case UNW_X86_64_RSI: loc = c->dwarf.loc[RSI]; break;
case UNW_X86_64_RDI: loc = c->dwarf.loc[RDI]; break;
diff --git a/src/third_party/unwind/dist/src/x86_64/Gresume.c b/src/third_party/unwind/dist/src/x86_64/Gresume.c
index 944cdaae192..becb1bd6cd7 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gresume.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gresume.c
@@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
+#include "libunwind_i.h"
#include "offsets.h"
#include "unwind_i.h"
@@ -36,7 +37,7 @@ HIDDEN inline int
x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
struct cursor *c = (struct cursor *) cursor;
- ucontext_t *uc = c->uc;
+ ucontext_t *uc = dwarf_get_uc(&c->dwarf);
/* Ensure c->pi is up-to-date. On x86-64, it's relatively common to
be missing DWARF unwind info. We don't want to fail in that
diff --git a/src/third_party/unwind/dist/src/x86_64/Gstep.c b/src/third_party/unwind/dist/src/x86_64/Gstep.c
index d4831197cb3..fdad298c731 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gstep.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gstep.c
@@ -25,6 +25,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#include "unwind_i.h"
#include <signal.h>
@@ -59,8 +60,11 @@ unw_step (unw_cursor_t *cursor)
int ret, i;
#if CONSERVATIVE_CHECKS
- int val = c->validate;
- c->validate = 1;
+ int val = 0;
+ if (c->dwarf.as == unw_local_addr_space) {
+ val = dwarf_get_validate(&c->dwarf);
+ dwarf_set_validate(&c->dwarf, 1);
+ }
#endif
Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx)\n",
@@ -71,7 +75,9 @@ unw_step (unw_cursor_t *cursor)
ret = dwarf_step (&c->dwarf);
#if CONSERVATIVE_CHECKS
- c->validate = val;
+ if (c->dwarf.as == unw_local_addr_space) {
+ dwarf_set_validate(&c->dwarf, val);
+ }
#endif
if (ret < 0 && ret != -UNW_ENOINFO)
@@ -110,7 +116,9 @@ unw_step (unw_cursor_t *cursor)
/* We could get here because of missing/bad unwind information.
Validate all addresses before dereferencing. */
- c->validate = 1;
+ if (c->dwarf.as == unw_local_addr_space) {
+ dwarf_set_validate(&c->dwarf, 1);
+ }
Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
@@ -215,7 +223,7 @@ unw_step (unw_cursor_t *cursor)
Debug (2, "RIP fixup didn't work, falling back\n");
unw_word_t rbp1 = 0;
rbp_loc = DWARF_LOC(rbp, 0);
- rsp_loc = DWARF_NULL_LOC;
+ rsp_loc = DWARF_VAL_LOC(c, rbp + 16);
rip_loc = DWARF_LOC (rbp + 8, 0);
ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1);
Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n",
diff --git a/src/third_party/unwind/dist/src/x86_64/Gtrace.c b/src/third_party/unwind/dist/src/x86_64/Gtrace.c
index 824527f9bea..963a858f27f 100644
--- a/src/third_party/unwind/dist/src/x86_64/Gtrace.c
+++ b/src/third_party/unwind/dist/src/x86_64/Gtrace.c
@@ -22,6 +22,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include "libunwind_i.h"
#include "unwind_i.h"
#include "ucontext_i.h"
#include <signal.h>
@@ -50,8 +51,8 @@ static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
static sig_atomic_t trace_cache_once_happen;
static pthread_key_t trace_cache_key;
static struct mempool trace_cache_pool;
-static __thread unw_trace_cache_t *tls_cache;
-static __thread int tls_cache_destroyed;
+static _Thread_local unw_trace_cache_t *tls_cache;
+static _Thread_local int tls_cache_destroyed;
/* Free memory for a thread's trace cache. */
static void
@@ -206,10 +207,7 @@ trace_cache_get (void)
RIP using current CFA, RBP and RSP values. Modifies CURSOR to
that location, performs one unw_step(), and fills F with what
was discovered about the location. Returns F.
-
- FIXME: This probably should tell DWARF handling to never evaluate
- or use registers other than RBP, RSP and RIP in case there is
- highly unusual unwind info which uses these creatively. */
+*/
static unw_tdep_frame_t *
trace_init_addr (unw_tdep_frame_t *f,
unw_cursor_t *cursor,
@@ -237,6 +235,9 @@ trace_init_addr (unw_tdep_frame_t *f,
their desired values. Then perform the step. */
d->ip = rip + d->use_prev_instr;
d->cfa = cfa;
+ for(int i = 0; i < DWARF_NUM_PRESERVED_REGS; i++) {
+ d->loc[i] = DWARF_NULL_LOC;
+ }
d->loc[UNW_X86_64_RIP] = DWARF_REG_LOC (d, UNW_X86_64_RIP);
d->loc[UNW_X86_64_RBP] = DWARF_REG_LOC (d, UNW_X86_64_RBP);
d->loc[UNW_X86_64_RSP] = DWARF_REG_LOC (d, UNW_X86_64_RSP);
@@ -403,6 +404,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
int maxdepth = 0;
int depth = 0;
int ret;
+ int validate = 0;
/* Check input parametres. */
if (unlikely(! cursor || ! buffer || ! size || (maxdepth = *size) <= 0))
@@ -473,14 +475,17 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
{
case UNW_X86_64_FRAME_GUESSED:
/* Fall thru to standard processing after forcing validation. */
- c->validate = 1;
+ if (d->as == unw_local_addr_space)
+ dwarf_set_validate(d, 1);
case UNW_X86_64_FRAME_STANDARD:
/* Advance standard traceable frame. */
cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset;
- ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip);
+ if (d->as == unw_local_addr_space)
+ validate = dwarf_get_validate(d);
+ ACCESS_MEM_FAST(ret, validate, d, cfa - 8, rip);
if (likely(ret >= 0) && likely(f->rbp_cfa_offset != -1))
- ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->rbp_cfa_offset, rbp);
+ ACCESS_MEM_FAST(ret, validate, d, cfa + f->rbp_cfa_offset, rbp);
/* Don't bother reading RSP from DWARF, CFA becomes new RSP. */
rsp = cfa;
@@ -492,11 +497,13 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
case UNW_X86_64_FRAME_SIGRETURN:
cfa = cfa + f->cfa_reg_offset; /* cfa now points to ucontext_t. */
- ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RIP, rip);
+ if (d->as == unw_local_addr_space)
+ validate = dwarf_get_validate(d);
+ ACCESS_MEM_FAST(ret, validate, d, cfa + UC_MCONTEXT_GREGS_RIP, rip);
if (likely(ret >= 0))
- ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RBP, rbp);
+ ACCESS_MEM_FAST(ret, validate, d, cfa + UC_MCONTEXT_GREGS_RBP, rbp);
if (likely(ret >= 0))
- ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RSP, rsp);
+ ACCESS_MEM_FAST(ret, validate, d, cfa + UC_MCONTEXT_GREGS_RSP, rsp);
/* Resume stack at signal restoration point. The stack is not
necessarily continuous here, especially with sigaltstack(). */
@@ -510,11 +517,13 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
/* Address of RIP was pushed on the stack via a simple
* def_cfa_expr - result stack offset stored in cfa_reg_offset */
cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset;
- ACCESS_MEM_FAST(ret, c->validate, d, cfa, cfa);
+ if (d->as == unw_local_addr_space)
+ validate = dwarf_get_validate(d);
+ ACCESS_MEM_FAST(ret, validate, d, cfa, cfa);
if (likely(ret >= 0))
- ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip);
+ ACCESS_MEM_FAST(ret, validate, d, cfa - 8, rip);
if (likely(ret >= 0))
- ACCESS_MEM_FAST(ret, c->validate, d, rbp, rbp);
+ ACCESS_MEM_FAST(ret, validate, d, rbp, rbp);
/* Don't bother reading RSP from DWARF, CFA becomes new RSP. */
rsp = cfa;
diff --git a/src/third_party/unwind/dist/src/x86_64/init.h b/src/third_party/unwind/dist/src/x86_64/init.h
index a7a996f1272..f4b7cf5dc4d 100644
--- a/src/third_party/unwind/dist/src/x86_64/init.h
+++ b/src/third_party/unwind/dist/src/x86_64/init.h
@@ -28,13 +28,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
/* Avoid a trip to x86_64_r_uc_addr() for purely local initialisation. */
-#if defined UNW_LOCAL_ONLY && defined __linux
+#if defined UNW_LOCAL_ONLY && defined __linux__
# define REG_INIT_LOC(c, rlc, ruc) \
- DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.gregs[REG_ ## ruc], 0)
+ DWARF_LOC ((unw_word_t) &dwarf_get_uc(&c->dwarf)->uc_mcontext.gregs[REG_ ## ruc], 0)
#elif defined UNW_LOCAL_ONLY && defined __FreeBSD__
# define REG_INIT_LOC(c, rlc, ruc) \
- DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.mc_ ## rlc, 0)
+ DWARF_LOC ((unw_word_t) &dwarf_get_uc(&c->dwarf)->uc_mcontext.mc_ ## rlc, 0)
#else
# define REG_INIT_LOC(c, rlc, ruc) \
diff --git a/src/third_party/unwind/dist/src/x86_64/unwind_i.h b/src/third_party/unwind/dist/src/x86_64/unwind_i.h
index e95a60ff376..49fa078fb21 100644
--- a/src/third_party/unwind/dist/src/x86_64/unwind_i.h
+++ b/src/third_party/unwind/dist/src/x86_64/unwind_i.h
@@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <libunwind-x86_64.h>
#include "libunwind_i.h"
-#include <sys/ucontext.h>
+#include <ucontext.h>
/* DWARF column numbers for x86_64: */
#define RAX 0
diff --git a/src/third_party/unwind/dist/tests/Gia64-test-nat.c b/src/third_party/unwind/dist/tests/Gia64-test-nat.c
index 89df54e0b0e..58099d62167 100644
--- a/src/third_party/unwind/dist/tests/Gia64-test-nat.c
+++ b/src/third_party/unwind/dist/tests/Gia64-test-nat.c
@@ -132,7 +132,7 @@ sighandler (int signal, void *siginfo, void *context)
save_func_t **arg0;
ucontext_t *uc = context;
-#if defined(__linux)
+#if defined(__linux__)
{
long sof;
int sp;
@@ -159,7 +159,7 @@ sighandler (int signal, void *siginfo, void *context)
(*arg0[0]) (arg0 + 1, arg1);
/* skip over the instruction which triggered sighandler() */
-#if defined(__linux)
+#if defined(__linux__)
++uc->uc_mcontext.sc_ip;
#elif defined(HAVE_SYS_UC_ACCESS_H)
{
diff --git a/src/third_party/unwind/dist/tests/Gtest-exc.c b/src/third_party/unwind/dist/tests/Gtest-exc.c
index 1170bdd03fd..29c1993f2de 100644
--- a/src/third_party/unwind/dist/tests/Gtest-exc.c
+++ b/src/third_party/unwind/dist/tests/Gtest-exc.c
@@ -24,6 +24,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* This illustrates the basics of using the unwind interface for
exception handling. */
+#include "compiler.h"
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -54,6 +56,8 @@ raise_exception (void)
unw_cursor_t cursor;
unw_context_t uc;
int i;
+ unw_word_t ip;
+ unw_word_t sp;
unw_getcontext (&uc);
if (unw_init_local (&cursor, &uc) < 0)
@@ -62,6 +66,14 @@ raise_exception (void)
return;
}
+ if (verbose)
+ {
+ printf ("raise_exception(): sp=%p\n", (void*) &sp);
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+ printf ("\t #%-3d ip=%p sp=%p\n", 0, (void*) ip, (void*) sp);
+ }
+
/* unwind to top-most frame a(), skipping over b() and raise_exception(): */
for (i = 0; i < depth + 2; ++i)
if (unw_step (&cursor) < 0)
@@ -69,6 +81,12 @@ raise_exception (void)
panic ("unw_step() failed!\n");
return;
}
+ else if (verbose)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+ printf ("\t #%-3d ip=%p sp=%p\n", i + 1, (void*) ip, (void*) sp);
+ }
unw_resume (&cursor); /* transfer control to exception handler */
}
@@ -86,7 +104,7 @@ get_bsp (void)
#endif
}
-int
+int NOINLINE
a (int n)
{
long stack;
@@ -118,7 +136,7 @@ a (int n)
return result;
}
-void
+void NOINLINE
b (int n)
{
if ((n & 1) == 0)
diff --git a/src/third_party/unwind/dist/tests/Ltest-mem-validate.c b/src/third_party/unwind/dist/tests/Ltest-mem-validate.c
index e5127b90628..251c34ea76d 100644
--- a/src/third_party/unwind/dist/tests/Ltest-mem-validate.c
+++ b/src/third_party/unwind/dist/tests/Ltest-mem-validate.c
@@ -47,8 +47,11 @@ void * stack_start;
void do_backtrace (void)
{
- void* buffer[1024];
- int size = 1024;
+ /*
+ We make the assumption that we are able to rewind far enough
+ (steps > 5) before touching the forbidden region in the stack,
+ at which point the unwinding should stop gracefully.
+ */
mprotect((void*)((uintptr_t)stack_start & ~(PAGE_SIZE - 1)),
PAGE_SIZE, PROT_NONE);
@@ -68,6 +71,7 @@ void do_backtrace (void)
unw_get_reg (&cursor, UNW_REG_SP, &sp);
ret = unw_step (&cursor);
+ printf("ip=%lx, sp=%lx -> %d\n", ip, sp, ret);
if (ret < 0)
{
unw_get_reg (&cursor, UNW_REG_IP, &ip);
@@ -78,14 +82,16 @@ void do_backtrace (void)
if (steps < 5)
{
+ printf("not enough steps: %d, need 5\n", steps);
exit(-1);
}
+ printf("success, steps: %d\n", steps);
mprotect((void*)((uintptr_t)stack_start & ~(PAGE_SIZE - 1)),
PAGE_SIZE, PROT_READ|PROT_WRITE);
}
-void consume_and_run (int depth)
+void NOINLINE consume_and_run (int depth)
{
unw_cursor_t cursor;
unw_context_t uc;
@@ -108,6 +114,14 @@ main (int argc, char **argv UNUSED)
stack_start = &start;
+ /*
+ We need to make the frame at least the size protected by
+ the mprotect call so we are not forbidding access to
+ unrelated regions.
+ */
+ char string[PAGE_SIZE];
+ sprintf (string, "hello\n");
+
// Initialize pipe mem validate check, opens file descriptors
unw_getcontext(&uc);
if (unw_init_local (&cursor, &uc) < 0)
@@ -121,7 +135,7 @@ main (int argc, char **argv UNUSED)
if (!childpid)
{
/* Close fds and make sure we still work */
- int ret = close(i);
+ close(i);
}
int status;
diff --git a/src/third_party/unwind/dist/tests/Makefile.am b/src/third_party/unwind/dist/tests/Makefile.am
index 61d1bf875a8..c783fc312db 100644
--- a/src/third_party/unwind/dist/tests/Makefile.am
+++ b/src/third_party/unwind/dist/tests/Makefile.am
@@ -1,4 +1,5 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CFLAGS = -fno-optimize-sibling-calls
EXTRA_DIST = run-ia64-test-dyn1 run-ptrace-mapper run-ptrace-misc \
run-check-namespace run-coredump-unwind \
@@ -115,6 +116,10 @@ if ARCH_MIPS
XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
endif
+if ARCH_RISCV
+XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+endif
+
if ARCH_ARM
# ARM Linux kernel >=2.6.39 removed PTRACE_SINGLESTEP emulation
XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
@@ -216,6 +221,7 @@ Gperf_trace_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
Ltest_bt_LDADD = $(LIBUNWIND_local)
Ltest_concurrent_LDADD = $(LIBUNWIND_local) -lpthread
+Ltest_cxx_exceptions_LDADD = $(LIBUNWIND_local)
Ltest_dyn1_LDADD = $(LIBUNWIND_local)
Ltest_exc_LDADD = $(LIBUNWIND_local)
Ltest_init_LDADD = $(LIBUNWIND_local)
diff --git a/src/third_party/unwind/dist/tests/Makefile.in b/src/third_party/unwind/dist/tests/Makefile.in
index 19e28da77b2..c24d9daced8 100644
--- a/src/third_party/unwind/dist/tests/Makefile.in
+++ b/src/third_party/unwind/dist/tests/Makefile.in
@@ -123,17 +123,19 @@ target_triplet = @target@
@BUILD_COREDUMP_TRUE@@OS_LINUX_TRUE@@REMOTE_ONLY_FALSE@am__append_14 = crasher test-coredump-unwind
@BUILD_COREDUMP_TRUE@@HAVE_LZMA_TRUE@@OS_LINUX_TRUE@@REMOTE_ONLY_FALSE@am__append_15 = run-coredump-unwind-mdi
check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_7) $(am__EXEEXT_10)
-XFAIL_TESTS = $(am__append_17) $(am__append_18) $(am__EXEEXT_19)
+XFAIL_TESTS = $(am__append_17) $(am__append_18) $(am__append_19) \
+ $(am__EXEEXT_19)
@ARCH_IA64_TRUE@am__append_16 = Gtest-dyn1 Ltest-dyn1
@ARCH_MIPS_TRUE@am__append_17 = $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+@ARCH_RISCV_TRUE@am__append_18 = $(XFAIL_TESTS_PTRACE_SINGLESTEP)
# ARM Linux kernel >=2.6.39 removed PTRACE_SINGLESTEP emulation
-@ARCH_ARM_TRUE@am__append_18 = $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+@ARCH_ARM_TRUE@am__append_19 = $(XFAIL_TESTS_PTRACE_SINGLESTEP)
# This is meant for multilib binaries, -m32.
# ptrace gives EBADREG when testing,
# but generally everything else works.
-@NO_PTRACE_TEST_TRUE@am__append_19 = run-ptrace-mapper test-ptrace Ltest-init-local-signal
+@NO_PTRACE_TEST_TRUE@am__append_20 = run-ptrace-mapper test-ptrace Ltest-init-local-signal
noinst_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_15) $(am__EXEEXT_18)
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -294,7 +296,7 @@ Ltest_concurrent_OBJECTS = Ltest-concurrent.$(OBJEXT)
Ltest_concurrent_DEPENDENCIES = $(LIBUNWIND_local)
am_Ltest_cxx_exceptions_OBJECTS = Ltest-cxx-exceptions.$(OBJEXT)
Ltest_cxx_exceptions_OBJECTS = $(am_Ltest_cxx_exceptions_OBJECTS)
-Ltest_cxx_exceptions_LDADD = $(LDADD)
+Ltest_cxx_exceptions_DEPENDENCIES = $(LIBUNWIND_local)
am_Ltest_dyn1_OBJECTS = Ltest-dyn1.$(OBJEXT) flush-cache.$(OBJEXT)
Ltest_dyn1_OBJECTS = $(am_Ltest_dyn1_OBJECTS)
Ltest_dyn1_DEPENDENCIES = $(LIBUNWIND_local)
@@ -902,6 +904,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CFLAGS = -fno-optimize-sibling-calls
EXTRA_DIST = run-ia64-test-dyn1 run-ptrace-mapper run-ptrace-misc \
run-check-namespace run-coredump-unwind \
run-coredump-unwind-mdi check-namespace.sh.in \
@@ -1004,6 +1007,7 @@ Gtest_trace_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
Gperf_trace_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
Ltest_bt_LDADD = $(LIBUNWIND_local)
Ltest_concurrent_LDADD = $(LIBUNWIND_local) -lpthread
+Ltest_cxx_exceptions_LDADD = $(LIBUNWIND_local)
Ltest_dyn1_LDADD = $(LIBUNWIND_local)
Ltest_exc_LDADD = $(LIBUNWIND_local)
Ltest_init_LDADD = $(LIBUNWIND_local)
diff --git a/src/third_party/unwind/dist/tests/check-namespace.sh.in b/src/third_party/unwind/dist/tests/check-namespace.sh.in
index f43bca263bc..f99fb59f776 100644
--- a/src/third_party/unwind/dist/tests/check-namespace.sh.in
+++ b/src/third_party/unwind/dist/tests/check-namespace.sh.in
@@ -189,6 +189,14 @@ check_local_unw_abi () {
match _UL${plat}_dwarf_find_unwind_table
match _U${plat}_setcontext
;;
+ riscv)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ match _U${plat}_setcontext
+ ;;
*)
match _U${plat}_is_fpreg
@@ -296,6 +304,13 @@ check_generic_unw_abi () {
match _U${plat}_dwarf_search_unwind_table
match _U${plat}_dwarf_find_unwind_table
;;
+ riscv)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
*)
match _U${plat}_is_fpreg
match _U${plat}_dwarf_search_unwind_table
diff --git a/src/third_party/unwind/dist/tests/test-coredump-unwind.c b/src/third_party/unwind/dist/tests/test-coredump-unwind.c
index fb06a38effa..93d9a0ee617 100644
--- a/src/third_party/unwind/dist/tests/test-coredump-unwind.c
+++ b/src/third_party/unwind/dist/tests/test-coredump-unwind.c
@@ -62,7 +62,7 @@
#else
extern int backtrace (void **, int);
#endif
-#include <sys/ucontext.h>
+#include <ucontext.h>
#include <libunwind-coredump.h>
@@ -322,7 +322,7 @@ main(int argc UNUSED, char **argv)
if (*colon != ':')
error_msg_and_die("Bad format: '%s'", *argv);
if (_UCD_add_backing_file_at_vaddr(ui, vaddr, colon + 1) < 0)
- error_msg_and_die("Can't add backing file '%s'", colon + 1);
+ error_msg("Can't add backing file '%s'", colon + 1);
argv++;
}
@@ -338,11 +338,16 @@ main(int argc UNUSED, char **argv)
if (ret < 0)
error_msg_and_die("unw_get_proc_info(ip=0x%lx) failed: ret=%d\n", (long) ip, ret);
- if (!testcase)
- printf("\tip=0x%08lx proc=%08lx-%08lx handler=0x%08lx lsda=0x%08lx\n",
+ if (!testcase) {
+ char proc_name[128];
+ unw_word_t off;
+ unw_get_proc_name(&c, proc_name, sizeof(proc_name), &off);
+
+ printf("\tip=0x%08lx proc=%08lx-%08lx handler=0x%08lx lsda=0x%08lx %s\n",
(long) ip,
(long) pi.start_ip, (long) pi.end_ip,
- (long) pi.handler, (long) pi.lsda);
+ (long) pi.handler, (long) pi.lsda, proc_name);
+ }
if (testcase && test_cur < TEST_FRAMES)
{
diff --git a/src/third_party/unwind/dist/tests/test-ptrace.c b/src/third_party/unwind/dist/tests/test-ptrace.c
index e7c7883f38f..846bcd80079 100644
--- a/src/third_party/unwind/dist/tests/test-ptrace.c
+++ b/src/third_party/unwind/dist/tests/test-ptrace.c
@@ -178,7 +178,7 @@ main (int argc, char **argv)
if (argc == 1)
{
- static char *args[] = { "self", "/bin/ls", "/usr", NULL };
+ static char *args[] = { "self", "ls", "/", NULL };
/* automated test case */
argv = args;
@@ -233,7 +233,11 @@ main (int argc, char **argv)
fprintf(stderr, "Need to specify a command line for the child\n");
exit (-1);
}
+#ifdef __FreeBSD__
execve (argv[optind], argv + optind, environ);
+#else
+ execvpe (argv[optind], argv + optind, environ);
+#endif
_exit (-1);
}
atexit (target_pid_kill);
diff --git a/src/third_party/unwind/dist/tests/test-setjmp.c b/src/third_party/unwind/dist/tests/test-setjmp.c
index 769b71b2228..59d1c5a083b 100644
--- a/src/third_party/unwind/dist/tests/test-setjmp.c
+++ b/src/third_party/unwind/dist/tests/test-setjmp.c
@@ -149,6 +149,10 @@ main (int argc, char **argv UNUSED)
if (argc > 1)
verbose = 1;
+ memset (&sigset1, 0, sizeof (sigset1));
+ memset (&sigset2, 0, sizeof (sigset2));
+ memset (&sigset3, 0, sizeof (sigset3));
+
sigemptyset ((sigset_t *) &sigset1);
sigaddset ((sigset_t *) &sigset1, SIGUSR1);
sigemptyset ((sigset_t *) &sigset2);
diff --git a/src/third_party/unwind/platform/linux_aarch64/build/include/config.h b/src/third_party/unwind/platform/linux_aarch64/build/include/config.h
index 72f178a595c..378144bd17a 100644
--- a/src/third_party/unwind/platform/linux_aarch64/build/include/config.h
+++ b/src/third_party/unwind/platform/linux_aarch64/build/include/config.h
@@ -16,12 +16,12 @@
/* Define to 1 if you want every memory access validated */
#define CONSERVATIVE_CHECKS 1
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+#define HAVE_ASM_PTRACE_H 1
+
/* Define to 1 if you have the <asm/ptrace_offsets.h> header file. */
/* #undef HAVE_ASM_PTRACE_OFFSETS_H */
-/* Define to 1 if you have the <atomic_ops.h> header file. */
-/* #undef HAVE_ATOMIC_OPS_H */
-
/* Define to 1 if you have the <byteswap.h> header file. */
#define HAVE_BYTESWAP_H 1
@@ -153,9 +153,6 @@
/* Define to 1 if the system has the type `struct prstatus'. */
/* #undef HAVE_STRUCT_PRSTATUS */
-/* Defined if __sync atomics are available */
-#define HAVE_SYNC_ATOMICS 1
-
/* Define to 1 if you have the <sys/elf.h> header file. */
#define HAVE_SYS_ELF_H 1
@@ -165,6 +162,9 @@
/* Define to 1 if you have the <sys/link.h> header file. */
/* #undef HAVE_SYS_LINK_H */
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
/* Define to 1 if you have the <sys/procfs.h> header file. */
#define HAVE_SYS_PROCFS_H 1
@@ -174,6 +174,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
@@ -187,7 +190,7 @@
#define HAVE_UNISTD_H 1
/* Define if you have libz */
-#define HAVE_ZLIB 1
+/* #undef HAVE_ZLIB */
/* Defined if __builtin_unreachable() is available */
#define HAVE__BUILTIN_UNREACHABLE 1
@@ -195,8 +198,8 @@
/* Defined if __builtin___clear_cache() is available */
#define HAVE__BUILTIN___CLEAR_CACHE 1
-/* Define to 1 if __thread keyword is supported by the C compiler. */
-/* #undef HAVE___THREAD */
+/* Define to 1 if --enable-per-thread-cache */
+/* #undef HAVE___CACHE_PER_THREAD */
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
@@ -211,7 +214,7 @@
#define PACKAGE_NAME "libunwind"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libunwind 1.5.0"
+#define PACKAGE_STRING "libunwind 1.6.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libunwind"
@@ -220,7 +223,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.5.0"
+#define PACKAGE_VERSION "1.6.2"
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
@@ -229,7 +232,7 @@
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "1.5.0"
+#define VERSION "1.6.2"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
diff --git a/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind-common.h b/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind-common.h
index 0beab1a9d8a..9de37c1d7c0 100644
--- a/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind-common.h
+++ b/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind-common.h
@@ -24,8 +24,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define UNW_VERSION_MAJOR 1
-#define UNW_VERSION_MINOR 5
-#define UNW_VERSION_EXTRA 0
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
diff --git a/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind.h b/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind.h
index b9bd68535ac..7a774250a8f 100644
--- a/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind.h
+++ b/src/third_party/unwind/platform/linux_aarch64/build/include/libunwind.h
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_aarch64/build/include/stamp-h1 b/src/third_party/unwind/platform/linux_aarch64/build/include/stamp-h1
new file mode 100644
index 00000000000..b330768e9bf
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_aarch64/build/include/stamp-h1
@@ -0,0 +1 @@
+timestamp for include/config.h
diff --git a/src/third_party/unwind/platform/linux_aarch64/build/include/tdep/libunwind_i.h b/src/third_party/unwind/platform/linux_aarch64/build/include/tdep/libunwind_i.h
index 6aa3a506703..27c89d79a33 100644
--- a/src/third_party/unwind/platform/linux_aarch64/build/include/tdep/libunwind_i.h
+++ b/src/third_party/unwind/platform/linux_aarch64/build/include/tdep/libunwind_i.h
@@ -27,6 +27,8 @@
# include "tdep-tilegx/libunwind_i.h"
#elif defined __s390x__
# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-aarch64.h b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-aarch64.h
index aeaef630240..a5265c4627b 100644
--- a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-aarch64.h
+++ b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-aarch64.h
@@ -34,6 +34,15 @@ extern "C" {
#include <inttypes.h>
#include <stddef.h>
#include <ucontext.h>
+#include <stdalign.h>
+
+#ifndef UNW_EMPTY_STRUCT
+# ifdef __GNUC__
+# define UNW_EMPTY_STRUCT
+# else
+# define UNW_EMPTY_STRUCT uint8_t unused;
+# endif
+#endif
#define UNW_TARGET aarch64
#define UNW_TARGET_AARCH64 1
@@ -60,6 +69,7 @@ typedef long double unw_tdep_fpreg_t;
typedef struct
{
/* no aarch64-specific auxiliary proc-info */
+ UNW_EMPTY_STRUCT
}
unw_tdep_proc_info_t;
@@ -169,10 +179,11 @@ aarch64_regnum_t;
typedef struct unw_tdep_save_loc
{
/* Additional target-dependent info on a save location. */
+ UNW_EMPTY_STRUCT
}
unw_tdep_save_loc_t;
-
+#ifdef __linux__
/* On AArch64, we can directly use ucontext_t as the unwind context,
* however, the __reserved struct is quite large: tune it down to only
* the necessary used fields. */
@@ -184,7 +195,7 @@ struct unw_sigcontext
uint64_t sp;
uint64_t pc;
uint64_t pstate;
- uint8_t __reserved[(34 * 8)] __attribute__((__aligned__(16)));
+ alignas(16) uint8_t __reserved[(66 * 8)];
};
typedef struct
@@ -192,7 +203,15 @@ typedef struct
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
+#ifndef __ANDROID__
sigset_t uc_sigmask;
+#else
+ union {
+ sigset_t uc_sigmask;
+ sigset64_t uc_sigmask64;
+ };
+ char __padding[128 - sizeof(sigset_t)];
+#endif
struct unw_sigcontext uc_mcontext;
} unw_tdep_context_t;
@@ -204,16 +223,19 @@ typedef struct
uint32_t fpcr;
uint64_t vregs[64];
} unw_fpsimd_context_t;
-
+#else
+/* On AArch64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+#endif
#include "libunwind-common.h"
#include "libunwind-dynamic.h"
-#define unw_tdep_getcontext(uc) (({ \
+#define unw_tdep_getcontext(uc) ({ \
unw_tdep_context_t *unw_ctx = (uc); \
- register uint64_t *unw_base __asm__ ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \
- __asm__ __volatile__ ( \
+ register uint64_t unw_base __asm__ ("x0") = (uint64_t) unw_ctx->uc_mcontext.regs; \
+ __asm__ __volatile__ ( \
"stp x0, x1, [%[base], #0]\n" \
"stp x2, x3, [%[base], #16]\n" \
"stp x4, x5, [%[base], #32]\n" \
@@ -229,11 +251,14 @@ typedef struct
"stp x24, x25, [%[base], #192]\n" \
"stp x26, x27, [%[base], #208]\n" \
"stp x28, x29, [%[base], #224]\n" \
- "str x30, [%[base], #240]\n" \
"mov x1, sp\n" \
- "stp x1, x30, [%[base], #248]\n" \
+ "stp x30, x1, [%[base], #240]\n" \
+ "adr x1, ret%=\n" \
+ "str x1, [%[base], #256]\n" \
+ "mov %[base], #0\n" \
+ "ret%=:\n" \
: [base] "+r" (unw_base) : : "x1", "memory"); \
- }), 0)
+ (int)unw_base; })
#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
extern int unw_tdep_is_fpreg (int);
diff --git a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-common.h b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-common.h
index 0beab1a9d8a..9de37c1d7c0 100644
--- a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-common.h
+++ b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-common.h
@@ -24,8 +24,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define UNW_VERSION_MAJOR 1
-#define UNW_VERSION_MINOR 5
-#define UNW_VERSION_EXTRA 0
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
diff --git a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-dynamic.h b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-dynamic.h
index edb0bbd343d..dc31b12efc9 100644
--- a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-dynamic.h
+++ b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind-dynamic.h
@@ -141,6 +141,7 @@ typedef struct unw_dyn_info
unw_word_t gp; /* global-pointer in effect for this entry */
int32_t format; /* real type: unw_dyn_info_format_t */
int32_t pad;
+ unw_word_t load_offset; /* ELF load offset */
union
{
unw_dyn_proc_info_t pi;
diff --git a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind.h b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind.h
index b9bd68535ac..7a774250a8f 100644
--- a/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind.h
+++ b/src/third_party/unwind/platform/linux_aarch64/install/include/libunwind.h
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_aarch64/install/include/unwind.h b/src/third_party/unwind/platform/linux_aarch64/install/include/unwind.h
index 7cf128deca3..93780fade8f 100644
--- a/src/third_party/unwind/platform/linux_aarch64/install/include/unwind.h
+++ b/src/third_party/unwind/platform/linux_aarch64/install/include/unwind.h
@@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* For uint64_t */
#include <stdint.h>
+#include <stdalign.h>
#ifdef __cplusplus
extern "C" {
@@ -76,11 +77,11 @@ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
even on 32-bit machines for gcc compatibility. */
struct _Unwind_Exception
{
- uint64_t exception_class;
+ alignas(8) uint64_t exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
- } __attribute__((__aligned__));
+ };
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
diff --git a/src/third_party/unwind/platform/linux_x86_64/build/include/config.h b/src/third_party/unwind/platform/linux_x86_64/build/include/config.h
index 620d9483731..625a4386db5 100644
--- a/src/third_party/unwind/platform/linux_x86_64/build/include/config.h
+++ b/src/third_party/unwind/platform/linux_x86_64/build/include/config.h
@@ -16,12 +16,12 @@
/* Define to 1 if you want every memory access validated */
#define CONSERVATIVE_CHECKS 1
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+#define HAVE_ASM_PTRACE_H 1
+
/* Define to 1 if you have the <asm/ptrace_offsets.h> header file. */
/* #undef HAVE_ASM_PTRACE_OFFSETS_H */
-/* Define to 1 if you have the <atomic_ops.h> header file. */
-/* #undef HAVE_ATOMIC_OPS_H */
-
/* Define to 1 if you have the <byteswap.h> header file. */
#define HAVE_BYTESWAP_H 1
@@ -153,9 +153,6 @@
/* Define to 1 if the system has the type `struct prstatus'. */
/* #undef HAVE_STRUCT_PRSTATUS */
-/* Defined if __sync atomics are available */
-#define HAVE_SYNC_ATOMICS 1
-
/* Define to 1 if you have the <sys/elf.h> header file. */
/* #undef HAVE_SYS_ELF_H */
@@ -165,6 +162,9 @@
/* Define to 1 if you have the <sys/link.h> header file. */
/* #undef HAVE_SYS_LINK_H */
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
/* Define to 1 if you have the <sys/procfs.h> header file. */
#define HAVE_SYS_PROCFS_H 1
@@ -174,6 +174,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
@@ -187,7 +190,7 @@
#define HAVE_UNISTD_H 1
/* Define if you have libz */
-#define HAVE_ZLIB 1
+/* #undef HAVE_ZLIB */
/* Defined if __builtin_unreachable() is available */
#define HAVE__BUILTIN_UNREACHABLE 1
@@ -195,8 +198,8 @@
/* Defined if __builtin___clear_cache() is available */
#define HAVE__BUILTIN___CLEAR_CACHE 1
-/* Define to 1 if __thread keyword is supported by the C compiler. */
-/* #undef HAVE___THREAD */
+/* Define to 1 if --enable-per-thread-cache */
+/* #undef HAVE___CACHE_PER_THREAD */
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
@@ -211,7 +214,7 @@
#define PACKAGE_NAME "libunwind"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libunwind 1.5.0"
+#define PACKAGE_STRING "libunwind 1.6.2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libunwind"
@@ -220,7 +223,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.5.0"
+#define PACKAGE_VERSION "1.6.2"
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
@@ -229,7 +232,7 @@
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "1.5.0"
+#define VERSION "1.6.2"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
diff --git a/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind-common.h b/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind-common.h
index 0beab1a9d8a..9de37c1d7c0 100644
--- a/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind-common.h
+++ b/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind-common.h
@@ -24,8 +24,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define UNW_VERSION_MAJOR 1
-#define UNW_VERSION_MINOR 5
-#define UNW_VERSION_EXTRA 0
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
diff --git a/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind.h b/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind.h
index 91bb8ef9cad..40f485dca17 100644
--- a/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind.h
+++ b/src/third_party/unwind/platform/linux_x86_64/build/include/libunwind.h
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_x86_64/build/include/stamp-h1 b/src/third_party/unwind/platform/linux_x86_64/build/include/stamp-h1
new file mode 100644
index 00000000000..b330768e9bf
--- /dev/null
+++ b/src/third_party/unwind/platform/linux_x86_64/build/include/stamp-h1
@@ -0,0 +1 @@
+timestamp for include/config.h
diff --git a/src/third_party/unwind/platform/linux_x86_64/build/include/tdep/libunwind_i.h b/src/third_party/unwind/platform/linux_x86_64/build/include/tdep/libunwind_i.h
index 19cdc156c6f..efd4f875ec4 100644
--- a/src/third_party/unwind/platform/linux_x86_64/build/include/tdep/libunwind_i.h
+++ b/src/third_party/unwind/platform/linux_x86_64/build/include/tdep/libunwind_i.h
@@ -27,6 +27,8 @@
# include "tdep-tilegx/libunwind_i.h"
#elif defined __s390x__
# include "tdep-s390x/libunwind_i.h"
+#elif defined __riscv || defined __riscv__
+# include "tdep-riscv/libunwind_i.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-common.h b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-common.h
index 0beab1a9d8a..9de37c1d7c0 100644
--- a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-common.h
+++ b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-common.h
@@ -24,8 +24,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define UNW_VERSION_MAJOR 1
-#define UNW_VERSION_MINOR 5
-#define UNW_VERSION_EXTRA 0
+#define UNW_VERSION_MINOR 6
+#define UNW_VERSION_EXTRA 2
#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
diff --git a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-dynamic.h b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-dynamic.h
index edb0bbd343d..dc31b12efc9 100644
--- a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-dynamic.h
+++ b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind-dynamic.h
@@ -141,6 +141,7 @@ typedef struct unw_dyn_info
unw_word_t gp; /* global-pointer in effect for this entry */
int32_t format; /* real type: unw_dyn_info_format_t */
int32_t pad;
+ unw_word_t load_offset; /* ELF load offset */
union
{
unw_dyn_proc_info_t pi;
diff --git a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind.h b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind.h
index 91bb8ef9cad..40f485dca17 100644
--- a/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind.h
+++ b/src/third_party/unwind/platform/linux_x86_64/install/include/libunwind.h
@@ -27,6 +27,8 @@
# include "libunwind-tilegx.h"
#elif defined __s390x__
# include "libunwind-s390x.h"
+#elif defined __riscv || defined __riscv__
+# include "libunwind-riscv.h"
#else
# error "Unsupported arch"
#endif
diff --git a/src/third_party/unwind/platform/linux_x86_64/install/include/unwind.h b/src/third_party/unwind/platform/linux_x86_64/install/include/unwind.h
index 7cf128deca3..93780fade8f 100644
--- a/src/third_party/unwind/platform/linux_x86_64/install/include/unwind.h
+++ b/src/third_party/unwind/platform/linux_x86_64/install/include/unwind.h
@@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* For uint64_t */
#include <stdint.h>
+#include <stdalign.h>
#ifdef __cplusplus
extern "C" {
@@ -76,11 +77,11 @@ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
even on 32-bit machines for gcc compatibility. */
struct _Unwind_Exception
{
- uint64_t exception_class;
+ alignas(8) uint64_t exception_class;
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
- } __attribute__((__aligned__));
+ };
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
diff --git a/src/third_party/unwind/scripts/host_config.sh b/src/third_party/unwind/scripts/host_config.sh
index 086952f1573..eb21ac19d25 100755
--- a/src/third_party/unwind/scripts/host_config.sh
+++ b/src/third_party/unwind/scripts/host_config.sh
@@ -33,6 +33,7 @@ $SRC_DIR/configure \
--disable-dependency-tracking \
--disable-documentation \
--disable-minidebuginfo \
+ --disable-zlibdebuginfo \
--disable-ptrace \
--disable-setjmp \
--disable-shared \
diff --git a/src/third_party/unwind/scripts/import.sh b/src/third_party/unwind/scripts/import.sh
index c57b2d7bd64..6e35f51fa50 100755
--- a/src/third_party/unwind/scripts/import.sh
+++ b/src/third_party/unwind/scripts/import.sh
@@ -7,8 +7,8 @@ IFS=$'\n\t'
set -vx
NAME=libunwind
-REVISION="v1.5-stable-mongo" # 2021-01-13
-VERSION="1.5.0"
+REVISION="v1.6-stable-mongo" # 2022-01-20
+VERSION="1.6.2"
DEST_DIR=$(git rev-parse --show-toplevel)/src/third_party/unwind
if [[ -d $DEST_DIR/dist ]]; then
@@ -23,7 +23,7 @@ git clone git@github.com:mongodb-forks/libunwind.git $UNWIND_GIT_DIR
git -C $UNWIND_GIT_DIR checkout $REVISION
pushd $UNWIND_GIT_DIR
-NOCONFIGURE=1 ./autogen.sh
+autoreconf -i
./configure
make dist
popd