[Bug 262706] Build on arm64 fails to find libclang_rt.asan-aarch64.a

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Mar 2022 20:20:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262706

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dim@FreeBSD.org

--- Comment #2 from Dimitry Andric <dim@FreeBSD.org> ---
Yep, upstream doesn't yet support aarch64 for the sanitizers. If I attempt to
build it on an aarch64 machine, I see:

/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1811:23:
error: field has incomplete type 'struct _aarch64_ctx'
  struct _aarch64_ctx head;
                      ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1811:10:
note: forward declaration of '__sanitizer::_aarch64_ctx'
  struct _aarch64_ctx head;
         ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1817:35:
error: no member named '__reserved' in '__mcontext'
  u8 *aux = ucontext->uc_mcontext.__reserved;
            ~~~~~~~~~~~~~~~~~~~~~ ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1820:12:
error: member access into incomplete type '__sanitizer::_aarch64_ctx'
    if (ctx->size == 0) break;
           ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1811:10:
note: forward declaration of '__sanitizer::_aarch64_ctx'
  struct _aarch64_ctx head;
         ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1821:12:
error: member access into incomplete type '__sanitizer::_aarch64_ctx'
    if (ctx->magic == kEsrMagic) {
           ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1811:10:
note: forward declaration of '__sanitizer::_aarch64_ctx'
  struct _aarch64_ctx head;
         ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1825:15:
error: member access into incomplete type '__sanitizer::_aarch64_ctx'
    aux += ctx->size;
              ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1811:10:
note: forward declaration of '__sanitizer::_aarch64_ctx'
  struct _aarch64_ctx head;
         ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2055:31:
error: no member named 'pc' in '__mcontext'
  *pc = ucontext->uc_mcontext.pc;
        ~~~~~~~~~~~~~~~~~~~~~ ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2056:31:
error: no member named 'regs' in '__mcontext'
  *bp = ucontext->uc_mcontext.regs[29];
        ~~~~~~~~~~~~~~~~~~~~~ ^
/home/dim/src/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2057:31:
error: no member named 'sp' in '__mcontext'
  *sp = ucontext->uc_mcontext.sp;
        ~~~~~~~~~~~~~~~~~~~~~ ^
8 errors generated.

`_aarch64_ctx` is a Linux-specific context struct from
/usr/include/aarch64-linux-gnu/asm/sigcontext.h:

/*
 * Header to be used at the beginning of structures extending the user
 * context. Such structures must be placed after the rt_sigframe on the stack
 * and be 16-byte aligned. The last structure must be a dummy one with the
 * magic and size set to 0.
 */
struct _aarch64_ctx {
        __u32 magic;
        __u32 size;
};

but obviously it doesn't exist in FreeBSD. Similarly, struct ucontext and
mcontext have different members, and aren't generally compatible.

I think the only way to get this implemented is to have somebody with aarch64
knowledge, who can attempt to fix them up and submit reviews upstream.

-- 
You are receiving this mail because:
You are the assignee for the bug.