Bug 229057 - devel/libunwind: port to aarch64
Summary: devel/libunwind: port to aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Linimon
URL:
Keywords:
Depends on:
Blocks: 201763 229258
  Show dependency treegraph
 
Reported: 2018-06-16 00:33 UTC by Val Packett
Modified: 2018-06-29 07:49 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (danilo)


Attachments
libunwind-aarch64.patch (4.31 KB, patch)
2018-06-16 00:33 UTC, Val Packett
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Val Packett 2018-06-16 00:33:15 UTC
Created attachment 194286 [details]
libunwind-aarch64.patch
Comment 1 Val Packett 2018-06-16 00:35:05 UTC
I made a patch that fixes the libunwind build on aarch64. It might contain bugs though...
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2018-06-21 19:41:01 UTC
(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.
Comment 3 Val Packett 2018-06-23 20:11:43 UTC
(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...
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2018-06-25 04:43:20 UTC
(In reply to Greg V from comment #3)

You are correct; I am testing again with the patches applied.
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-06-29 07:49:03 UTC
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
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2018-06-29 07:49:38 UTC
Committed, thanks.