Created attachment 194286 [details] libunwind-aarch64.patch
I made a patch that fixes the libunwind build on aarch64. It might contain bugs though...
(In reply to Greg V from comment #1) With this patch my build fails with the following: libtool: compile: cc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include/tdep-aarch64 -I. -D_GNU_SOURCE -DNDEBUG -O2 -pipe -fno-strict-aliasing -fexceptions -Wall -Wsign-compare -MT mi/backtrace.lo -MD -MP -MF mi/.deps/backtrace .Tpo -c mi/backtrace.c -fPIC -DPIC -o mi/.libs/backtrace.o mi/backtrace.c:71:7: error: no member named 'regs' in 'struct __mcontext' unw_getcontext (&uc); ^~~~~~~~~~~~~~~~~~~~ ../include/libunwind-common.h:108:29: note: expanded from macro 'unw_getcontext' #define unw_getcontext(uc) unw_tdep_getcontext(uc) ^~~~~~~~~~~~~~~~~~~~~~~ ../include/libunwind-aarch64.h:180:77: note: expanded from macro 'unw_tdep_getcontext' register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \ ~~~~~~~~~~~~~~~~~~~~ ^ mi/backtrace.c:26:9: warning: 'UNW_REMOTE_ONLY' is used as a header guard here, followed by #define of a different macro [-Wheader-guard] #ifndef UNW_REMOTE_ONLY ^~~~~~~~~~~~~~~ mi/backtrace.c:28:9: note: 'UNW_LOCAL_ONLY' is defined here; did you mean 'UNW_REMOTE_ONLY'? #define UNW_LOCAL_ONLY ^~~~~~~~~~~~~~ UNW_REMOTE_ONLY 1 warning and 1 error generated.
(In reply to Mark Linimon from comment #2) Looks like the patch didn't apply fully on your machine. 'unw_ctx->uc_mcontext.regs' should be replaced by 'unw_ctx->uc_mcontext.mc_gpregs.gp_x'. It displays correctly in the diff view here on bugzilla...
(In reply to Greg V from comment #3) You are correct; I am testing again with the patches applied.
A commit references this bug: Author: linimon Date: Fri Jun 29 07:48:44 UTC 2018 New revision: 473531 URL: https://svnweb.freebsd.org/changeset/ports/473531 Log: Port to aarch64. Tested for no-harm on amd64. While here, pet portlint. PR: 229057 Submitted by: greg at unrelenting.technology Approved by: portmgr (tier-2 blanket) Changes: head/devel/libunwind/Makefile head/devel/libunwind/files/patch-include_libunwind-aarch64.h head/devel/libunwind/files/patch-include_libunwind__i.h head/devel/libunwind/files/patch-src_aarch64_Ginit.c head/devel/libunwind/files/patch-src_coredump___UCD__access__reg__freebsd.c head/devel/libunwind/files/patch-src_ptrace___UPT__access__fpreg.c
Committed, thanks.