From e2dc372b7c367981a57d94f9af7b283cfa90b359 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Tue, 15 Jan 2019 15:49:52 -0800 Subject: [PATCH] Update libunwind to 1.3.1 Co-authored-by: Yichao Yu --- NEWS.md | 1 + deps/Versions.make | 2 +- .../checksums/libunwind-1.1-julia2.tar.gz/md5 | 1 - .../libunwind-1.1-julia2.tar.gz/sha512 | 1 - deps/checksums/libunwind-1.3.1.tar.gz/md5 | 1 + deps/checksums/libunwind-1.3.1.tar.gz/sha512 | 1 + deps/patches/libunwind-arm-dyn.patch | 46 ---- deps/patches/libunwind-arm-pc-offset.patch | 43 ---- ...nd-dwarf-Fix-incorrect-cfi-execution.patch | 200 ------------------ deps/patches/libunwind-dwarf-ver.patch | 26 --- deps/patches/libunwind-freebsd-mapper.patch | 12 -- deps/patches/libunwind-prefer-extbl.patch | 59 +++--- deps/unwind.mk | 26 +-- 13 files changed, 37 insertions(+), 382 deletions(-) delete mode 100644 deps/checksums/libunwind-1.1-julia2.tar.gz/md5 delete mode 100644 deps/checksums/libunwind-1.1-julia2.tar.gz/sha512 create mode 100644 deps/checksums/libunwind-1.3.1.tar.gz/md5 create mode 100644 deps/checksums/libunwind-1.3.1.tar.gz/sha512 delete mode 100644 deps/patches/libunwind-arm-dyn.patch delete mode 100644 deps/patches/libunwind-arm-pc-offset.patch delete mode 100644 deps/patches/libunwind-dwarf-Fix-incorrect-cfi-execution.patch delete mode 100644 deps/patches/libunwind-dwarf-ver.patch delete mode 100644 deps/patches/libunwind-freebsd-mapper.patch diff --git a/NEWS.md b/NEWS.md index fac73c4bd3352..04c722003de14 100644 --- a/NEWS.md +++ b/NEWS.md @@ -57,6 +57,7 @@ External dependencies * libgit2 has been updated to v0.27.7 ([#30584]). * OpenBLAS has been updated to v0.3.5 ([#30583]). * MbedTLS has been updated to v2.16.0 ([#30618]). +* libunwind has been updated to v1.3.1 ([#30724]). Deprecated or removed --------------------- diff --git a/deps/Versions.make b/deps/Versions.make index 622127203581d..21cb4d69e27c3 100644 --- a/deps/Versions.make +++ b/deps/Versions.make @@ -4,7 +4,7 @@ PCRE_VER = 10.30 DSFMT_VER = 2.2.3 LAPACK_VER = 3.5.0 SUITESPARSE_VER = 4.4.5 -UNWIND_VER = 1.1-julia2 +UNWIND_VER = 1.3.1 OSXUNWIND_VER = 0.0.5 GMP_VER = 6.1.2 MPFR_VER = 4.0.1 diff --git a/deps/checksums/libunwind-1.1-julia2.tar.gz/md5 b/deps/checksums/libunwind-1.1-julia2.tar.gz/md5 deleted file mode 100644 index bf053cceb330a..0000000000000 --- a/deps/checksums/libunwind-1.1-julia2.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -8310cbf1288248996e5b4f5450e24588 diff --git a/deps/checksums/libunwind-1.1-julia2.tar.gz/sha512 b/deps/checksums/libunwind-1.1-julia2.tar.gz/sha512 deleted file mode 100644 index f0115b99e9c93..0000000000000 --- a/deps/checksums/libunwind-1.1-julia2.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -5047890e727069c6ed74ca84bbe999ba6bc5c41d8d3914d6fbce19d18ff8a5944a7276d805ef5f67a857598852ae996a671c264d34a19123bb04d4daf6316f9a diff --git a/deps/checksums/libunwind-1.3.1.tar.gz/md5 b/deps/checksums/libunwind-1.3.1.tar.gz/md5 new file mode 100644 index 0000000000000..c42ea472ddb92 --- /dev/null +++ b/deps/checksums/libunwind-1.3.1.tar.gz/md5 @@ -0,0 +1 @@ +a04f69d66d8e16f8bf3ab72a69112cd6 diff --git a/deps/checksums/libunwind-1.3.1.tar.gz/sha512 b/deps/checksums/libunwind-1.3.1.tar.gz/sha512 new file mode 100644 index 0000000000000..a168f6515108e --- /dev/null +++ b/deps/checksums/libunwind-1.3.1.tar.gz/sha512 @@ -0,0 +1 @@ +3110d0aed4f5c781ef1ff72c9337e59793c02c42066209a4ac44f50eff1c0b0e02a5ff9f66891e62016de14af065a47975763970b839b700c0ff2e9f415c8def diff --git a/deps/patches/libunwind-arm-dyn.patch b/deps/patches/libunwind-arm-dyn.patch deleted file mode 100644 index b675a611b3572..0000000000000 --- a/deps/patches/libunwind-arm-dyn.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 8475f898b7f47b6e9f7193597dadb959dc5a02d2 Mon Sep 17 00:00:00 2001 -From: Yichao Yu -Date: Fri, 30 Sep 2016 04:11:03 +0000 -Subject: [PATCH 1/3] Support dynamic unwind info on ARM - ---- - src/arm/Gstep.c | 10 ++++++++-- - src/mi/Gdyn-extract.c | 1 + - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c -index 79f2dd2..5b2b329 100644 ---- a/src/arm/Gstep.c -+++ b/src/arm/Gstep.c -@@ -45,8 +45,14 @@ arm_exidx_step (struct cursor *c) - /* mark PC unsaved */ - c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC; - -- if ((ret = tdep_find_proc_info (&c->dwarf, c->dwarf.ip, 1)) < 0) -- return ret; -+ /* check dynamic info first --- it overrides everything else */ -+ ret = unwi_find_dynamic_proc_info (c->dwarf.as, c->dwarf.ip, &c->dwarf.pi, 1, -+ c->dwarf.as_arg); -+ if (ret == -UNW_ENOINFO) -+ { -+ if ((ret = tdep_find_proc_info (&c->dwarf, c->dwarf.ip, 1)) < 0) -+ return ret; -+ } - - if (c->dwarf.pi.format != UNW_INFO_FORMAT_ARM_EXIDX) - return -UNW_ENOINFO; -diff --git a/src/mi/Gdyn-extract.c b/src/mi/Gdyn-extract.c -index c8ae7a0..5f7682e 100644 ---- a/src/mi/Gdyn-extract.c -+++ b/src/mi/Gdyn-extract.c -@@ -49,6 +49,7 @@ unwi_extract_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, - - case UNW_INFO_FORMAT_TABLE: - case UNW_INFO_FORMAT_REMOTE_TABLE: -+ case UNW_INFO_FORMAT_ARM_EXIDX: - case UNW_INFO_FORMAT_IP_OFFSET: - #ifdef tdep_search_unwind_table - /* call platform-specific search routine: */ --- -2.10.0 - diff --git a/deps/patches/libunwind-arm-pc-offset.patch b/deps/patches/libunwind-arm-pc-offset.patch deleted file mode 100644 index 41d62a46390b9..0000000000000 --- a/deps/patches/libunwind-arm-pc-offset.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 320973722157e09c6139b016aa31012d5ea75f68 Mon Sep 17 00:00:00 2001 -From: Yichao Yu -Date: Sun, 2 Oct 2016 03:19:19 +0000 -Subject: [PATCH] Handle non-signal frame unwind info lookup in ARM exidx - unwinder - ---- - src/arm/Gstep.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c -index 449419b..76ced8e 100644 ---- a/src/arm/Gstep.c -+++ b/src/arm/Gstep.c -@@ -44,19 +44,22 @@ arm_exidx_step (struct cursor *c) - - /* mark PC unsaved */ - c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC; -+ unw_word_t ip = c->dwarf.ip; -+ if (c->dwarf.use_prev_instr) -+ --ip; - - /* check dynamic info first --- it overrides everything else */ -- ret = unwi_find_dynamic_proc_info (c->dwarf.as, c->dwarf.ip, &c->dwarf.pi, 1, -+ ret = unwi_find_dynamic_proc_info (c->dwarf.as, ip, &c->dwarf.pi, 1, - c->dwarf.as_arg); - if (ret == -UNW_ENOINFO) - { - #ifdef UNW_LOCAL_ONLY -- if ((ret = arm_find_proc_info2 (c->dwarf.as, c->dwarf.ip, &c->dwarf.pi, -+ 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, c->dwarf.ip, 1)) < 0) -+ if ((ret = tdep_find_proc_info (&c->dwarf, ip, 1)) < 0) - return ret; - #endif - } --- -2.10.0 - diff --git a/deps/patches/libunwind-dwarf-Fix-incorrect-cfi-execution.patch b/deps/patches/libunwind-dwarf-Fix-incorrect-cfi-execution.patch deleted file mode 100644 index 083feba7aa384..0000000000000 --- a/deps/patches/libunwind-dwarf-Fix-incorrect-cfi-execution.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 73b106c6a263fb548d4d6e0c783148df9806fd0b Mon Sep 17 00:00:00 2001 -From: Yichao Yu -Date: Fri, 27 Oct 2017 13:50:58 +0000 -Subject: [PATCH] dwarf: Fix incorrect cfi execution - -During unwinding/resuming execution of a normal call frame, -it is not only necessary to use the previous instruction to lookup the unwind info -but also when executing the cfi program. Although the call usually don't modify -any unwinding state, it can happen for noreturn call or when the callee cleanup the stack. -In these cases, the next instruction after the call may have a cfi adjusting the state -(e.g. stack pointer) and such instruction should be executed. - -3d9a694de85f2ba10368b4fbc2aff1c6b8b76f58 worked around this issue by treating `cfi_restore_state` -specially. It works when the compiler use that instruction to restore the state, i.e. - -``` - .cfi_remember_state - je .L0 - push ... - .cfi_def_cfi_offset - call noreturn -.L0 - .cfi_restore_state -``` - -which is what GCC ususally does. However, it is not necessarily the case and clang/LLVM doesn't -do that. Instead LLVM emits the following unwind info which is also perfectly valid but is not -handled by the special case. - -``` - je .L0 - push ... - .cfi_def_cfi_offset - call noreturn -.L0 - .cfi_def_cfi_offset -``` - -e9e8ed73e34a2d65c7ec71c296156637763ffd5c also worked around this issue for another special case. - -This patch fix this issue for all cfi types by adjusting the `end_ip` based on the type of the -current frame instead, similar to what's done in `fetch_proc_info`. -Since this requires using the same `use_prev_instr` value after `fetch_proc_info` returns, -the patch also remove the `need_unwind_info` parameter to the function and move the code updating -`use_prev_instr` after all use of the old value are done. ---- - src/dwarf/Gparser.c | 53 +++++++++++++++++++++++++++-------------------------- - 1 file changed, 27 insertions(+), 26 deletions(-) - -diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c -index 3a47255..8ffc3f4 100644 ---- a/src/dwarf/Gparser.c -+++ b/src/dwarf/Gparser.c -@@ -82,9 +82,6 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, - a = unw_get_accessors (as); - curr_ip = c->pi.start_ip; - -- /* Process everything up to and including the current 'ip', -- including all the DW_CFA_advance_loc instructions. See -- 'c->use_prev_instr' use in 'fetch_proc_info' for details. */ - while (curr_ip <= ip && *addr < end_addr) - { - if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0) -@@ -401,7 +398,7 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, - } - - static int --fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) -+fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip) - { - int ret, dynamic = 1; - -@@ -415,7 +412,7 @@ fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) - and b) so that run_cfi_program() runs locations up to the call - but not more. - -- For execution resume, we need to do the exact opposite and look -+ For signal frame, we need to do the exact opposite and look - up using the current 'ip' value. That is where execution will - continue, and it's important we get this right, as 'ip' could be - right at the function entry and hence FDE edge, or at instruction -@@ -423,18 +420,14 @@ fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) - if (c->use_prev_instr) - --ip; - -- if (c->pi_valid && !need_unwind_info) -- return 0; -- - memset (&c->pi, 0, sizeof (c->pi)); - - /* check dynamic info first --- it overrides everything else */ -- ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info, -- c->as_arg); -+ ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, 1, c->as_arg); - if (ret == -UNW_ENOINFO) - { - dynamic = 0; -- if ((ret = tdep_find_proc_info (c, ip, need_unwind_info)) < 0) -+ if ((ret = tdep_find_proc_info (c, ip, 1)) < 0) - return ret; - } - -@@ -448,15 +441,7 @@ fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) - - /* Let system/machine-dependent code determine frame-specific attributes. */ - if (ret >= 0) -- tdep_fetch_frame (c, ip, need_unwind_info); -- -- /* Update use_prev_instr for the next frame. */ -- if (need_unwind_info) -- { -- assert(c->pi.unwind_info); -- struct dwarf_cie_info *dci = c->pi.unwind_info; -- c->use_prev_instr = ! dci->signal_frame; -- } -+ tdep_fetch_frame (c, ip, 1); - - return ret; - } -@@ -502,7 +487,7 @@ parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr) - memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial)); - - addr = dci->fde_instr_start; -- if ((ret = run_cfi_program (c, sr, ip, &addr, dci->fde_instr_end, dci)) < 0) -+ if ((ret = run_cfi_program (c, sr, ip - c->use_prev_instr, &addr, dci->fde_instr_end, dci)) < 0) - return ret; - - return 0; -@@ -842,19 +827,30 @@ uncached_dwarf_find_save_locs (struct dwarf_cursor *c) - dwarf_state_record_t sr; - int ret; - -- if ((ret = fetch_proc_info (c, c->ip, 1)) < 0) -+ if ((ret = fetch_proc_info (c, c->ip)) < 0) - { - put_unwind_info (c, &c->pi); - return ret; - } -+ /* Update use_prev_instr for the next frame. */ -+ assert(c->pi.unwind_info); -+ struct dwarf_cie_info *dci = c->pi.unwind_info; -+ int next_use_prev_instr = ! dci->signal_frame; - - if ((ret = create_state_record_for (c, &sr, c->ip)) < 0) -- return ret; -+ { -+ c->use_prev_instr = next_use_prev_instr; -+ return ret; -+ } - - if ((ret = apply_reg_state (c, &sr.rs_current)) < 0) -- return ret; -+ { -+ c->use_prev_instr = next_use_prev_instr; -+ return ret; -+ } - - put_unwind_info (c, &c->pi); -+ c->use_prev_instr = next_use_prev_instr; - return 0; - } - -@@ -882,13 +878,17 @@ dwarf_find_save_locs (struct dwarf_cursor *c) - } - else - { -- if ((ret = fetch_proc_info (c, c->ip, 1)) < 0 || -+ if ((ret = fetch_proc_info (c, c->ip)) < 0 || - (ret = create_state_record_for (c, &sr, c->ip)) < 0) - { - put_rs_cache (c->as, cache, &saved_mask); - put_unwind_info (c, &c->pi); - return ret; - } -+ /* Update use_prev_instr for the next frame. */ -+ assert(c->pi.unwind_info); -+ struct dwarf_cie_info *dci = c->pi.unwind_info; -+ int next_use_prev_instr = ! dci->signal_frame; - - rs = rs_new (cache, c); - memcpy(rs, &sr.rs_current, offsetof(struct dwarf_reg_state, ip)); -@@ -898,6 +898,7 @@ dwarf_find_save_locs (struct dwarf_cursor *c) - c->prev_rs = rs - cache->buckets; - - put_unwind_info (c, &c->pi); -+ c->use_prev_instr = next_use_prev_instr; - } - - memcpy (&rs_copy, rs, sizeof (rs_copy)); -@@ -926,6 +927,6 @@ dwarf_make_proc_info (struct dwarf_cursor *c) - || get_cached_proc_info (c) < 0) - #endif - /* Lookup it up the slow way... */ -- return fetch_proc_info (c, c->ip, 0); -+ return fetch_proc_info (c, c->ip); - return 0; - } --- -2.14.3 - diff --git a/deps/patches/libunwind-dwarf-ver.patch b/deps/patches/libunwind-dwarf-ver.patch deleted file mode 100644 index 977e5e6c8600f..0000000000000 --- a/deps/patches/libunwind-dwarf-ver.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 155540bf1b1b57bd73ba1e7c1c77f3e4467bf253 Mon Sep 17 00:00:00 2001 -From: Yichao Yu -Date: Sat, 1 Oct 2016 15:24:09 +0000 -Subject: [PATCH 2/3] Allow DWARF version 4 - ---- - src/dwarf/Gfde.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/dwarf/Gfde.c b/src/dwarf/Gfde.c -index dc973fe..c1d6e1c 100644 ---- a/src/dwarf/Gfde.c -+++ b/src/dwarf/Gfde.c -@@ -116,7 +116,8 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, - if ((ret = dwarf_readu8 (as, a, &addr, &version, arg)) < 0) - return ret; - -- if (version != 1 && version != DWARF_CIE_VERSION) -+ if (version != 1 && version != DWARF_CIE_VERSION && -+ !(version == 4 && DWARF_CIE_VERSION)) - { - Debug (1, "Got CIE version %u, expected version 1 or " - STR (DWARF_CIE_VERSION) "\n", version); --- -2.10.0 - diff --git a/deps/patches/libunwind-freebsd-mapper.patch b/deps/patches/libunwind-freebsd-mapper.patch deleted file mode 100644 index 66b9ba1c7c1b8..0000000000000 --- a/deps/patches/libunwind-freebsd-mapper.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- tests/mapper.c 2014-10-06 14:46:27.000000000 -0400 -+++ tests/mapper.c 2014-10-06 14:47:00.000000000 -0400 -@@ -39,6 +39,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE - #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) - # define MAP_ANONYMOUS MAP_ANON - #endif -+#if !defined(MAP_NORESERVE) -+# define MAP_NORESERVE 0 -+#endif - - int - main (void) diff --git a/deps/patches/libunwind-prefer-extbl.patch b/deps/patches/libunwind-prefer-extbl.patch index 694612952cc51..8d93605e337af 100644 --- a/deps/patches/libunwind-prefer-extbl.patch +++ b/deps/patches/libunwind-prefer-extbl.patch @@ -1,20 +1,23 @@ -From 6b6d4b1ce3dcfdc87a84ee276947d473e84cd39e Mon Sep 17 00:00:00 2001 +From bc7b50355cb37cfa56f6131b2f9174b499053188 Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Sat, 1 Oct 2016 16:55:40 +0000 -Subject: [PATCH 3/3] Prefer EXTBL unwinding on ARM since it seems to be more - reliable +Subject: [PATCH] Prefer EXTBL unwinding on ARM +It is part of the C++ ABI so a EXTBL unwind info that's not `CANT_UNWIND` +should always be reliable/correct. +Ignore `ESTOPUNWIND` so that a `CANT_UNWIND` info can fallback to unwinding +using the debug info instead. --- include/tdep-arm/libunwind_i.h | 4 ++++ src/arm/Gex_tables.c | 18 ++++++++++++++---- - src/arm/Gstep.c | 29 ++++++++++++++++++----------- - 3 files changed, 36 insertions(+), 15 deletions(-) + src/arm/Gstep.c | 35 +++++++++++++++++++++-------------- + 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h -index d3a279c..89a0b72 100644 +index 2602f41c..074fc8cb 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h -@@ -250,6 +250,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +@@ -253,6 +253,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) @@ -22,7 +25,7 @@ index d3a279c..89a0b72 100644 #define arm_put_unwind_info UNW_OBJ(put_unwind_info) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -@@ -290,6 +291,9 @@ extern void tdep_init (void); +@@ -294,6 +295,9 @@ 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); @@ -33,10 +36,10 @@ index d3a279c..89a0b72 100644 unw_proc_info_t *pi, void *arg); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, diff --git a/src/arm/Gex_tables.c b/src/arm/Gex_tables.c -index 34706cf..379859a 100644 +index d6573a65..a895e0cc 100644 --- a/src/arm/Gex_tables.c +++ b/src/arm/Gex_tables.c -@@ -500,15 +500,16 @@ arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data) +@@ -506,18 +506,20 @@ arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data) } HIDDEN int @@ -52,13 +55,8 @@ index 34706cf..379859a 100644 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)) - { - struct dwarf_callback_data cb_data; - -@@ -534,7 +535,8 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, - ret = -UNW_ENOINFO; - } ++ 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) && @@ -66,7 +64,7 @@ index 34706cf..379859a 100644 { struct arm_cb_data cb_data; -@@ -560,6 +562,14 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, +@@ -540,6 +542,14 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, return ret; } @@ -82,36 +80,39 @@ index 34706cf..379859a 100644 arm_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) { diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c -index 5b2b329..449419b 100644 +index adec02e0..c43daa1c 100644 --- a/src/arm/Gstep.c +++ b/src/arm/Gstep.c -@@ -50,8 +50,15 @@ arm_exidx_step (struct cursor *c) +@@ -53,8 +53,15 @@ 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, c->dwarf.ip, &c->dwarf.pi, ++ 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, c->dwarf.ip, 1)) < 0) + if ((ret = tdep_find_proc_info (&c->dwarf, ip, 1)) < 0) return ret; +#endif } if (c->dwarf.pi.format != UNW_INFO_FORMAT_ARM_EXIDX) -@@ -184,8 +191,18 @@ unw_step (unw_cursor_t *cursor) - if (unw_is_signal_frame (cursor)) - return unw_handle_signal_frame (cursor); +@@ -94,8 +101,21 @@ 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)) + { ++ 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) ++ if (ret == 0) + return ret; + } + @@ -121,7 +122,7 @@ index 5b2b329..449419b 100644 if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) { ret = dwarf_step (&c->dwarf); -@@ -204,16 +221,6 @@ unw_step (unw_cursor_t *cursor) +@@ -114,16 +129,6 @@ unw_step (unw_cursor_t *cursor) } #endif /* CONFIG_DEBUG_FRAME */ @@ -137,7 +138,7 @@ index 5b2b329..449419b 100644 - /* Fall back on APCS frame parsing. Note: This won't work in case the ARM EABI is used. */ - if (unlikely (ret < 0)) + #ifdef __FreeBSD__ -- -2.10.0 +2.16.1 diff --git a/deps/unwind.mk b/deps/unwind.mk index b3ab24f983ae3..7c19f9148a4ad 100644 --- a/deps/unwind.mk +++ b/deps/unwind.mk @@ -4,7 +4,7 @@ LIBUNWIND_CFLAGS := -U_FORTIFY_SOURCE $(fPIC) LIBUNWIND_CPPFLAGS := $(SRCCACHE)/libunwind-$(UNWIND_VER).tar.gz: | $(SRCCACHE) - $(JLDOWNLOAD) $@ https://julialang-s3.julialang.org/src/libunwind-$(UNWIND_VER).tar.gz + $(JLDOWNLOAD) $@ https://github.com/libunwind/libunwind/releases/download/v$(UNWIND_VER)/libunwind-$(UNWIND_VER).tar.gz $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted: $(SRCCACHE)/libunwind-$(UNWIND_VER).tar.gz $(JLCHECKSUM) $< @@ -12,31 +12,11 @@ $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted: $(SRCCACHE)/libunwind-$(UN touch -c $(SRCCACHE)/libunwind-$(UNWIND_VER)/configure # old target echo 1 > $@ -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-arm-dyn.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted - cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f < $(SRCDIR)/patches/libunwind-arm-dyn.patch - echo 1 > $@ - -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-ver.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-arm-dyn.patch-applied - cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f < $(SRCDIR)/patches/libunwind-dwarf-ver.patch - echo 1 > $@ - -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-prefer-extbl.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-ver.patch-applied +$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-prefer-extbl.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f < $(SRCDIR)/patches/libunwind-prefer-extbl.patch echo 1 > $@ -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-arm-pc-offset.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-prefer-extbl.patch-applied - cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f < $(SRCDIR)/patches/libunwind-arm-pc-offset.patch - echo 1 > $@ - -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-freebsd-mapper.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-arm-pc-offset.patch-applied - cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p0 -f < $(SRCDIR)/patches/libunwind-freebsd-mapper.patch - echo 1 > $@ - -$(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-Fix-incorrect-cfi-execution.patch-applied: $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-freebsd-mapper.patch-applied - cd $(SRCCACHE)/libunwind-$(UNWIND_VER) && patch -p1 -f < $(SRCDIR)/patches/libunwind-dwarf-Fix-incorrect-cfi-execution.patch - echo 1 > $@ - -$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-dwarf-Fix-incorrect-cfi-execution.patch-applied +$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-prefer-extbl.patch-applied mkdir -p $(dir $@) cd $(dir $@) && \ $(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" --disable-shared --disable-minidebuginfo