Skip to content

PS-10330: Add aarch64 (arm64) support to the coredumper library#14

Open
inikep wants to merge 1 commit intoPercona-Lab:masterfrom
inikep:arm64-support
Open

PS-10330: Add aarch64 (arm64) support to the coredumper library#14
inikep wants to merge 1 commit intoPercona-Lab:masterfrom
inikep:arm64-support

Conversation

@inikep
Copy link
Contributor

@inikep inikep commented Feb 13, 2026

The coredumper library previously only supported x86-32, x86-64, ARM32, MIPS, and PPC architectures. On aarch64, the DUMPER macro was never defined, causing InternalGetCoreDump() to return -1 with EINVAL. This made the percona.coredump MTR test fail on arm64 builds because no core files were produced after SIGSEGV.

Key changes for aarch64 support:

  • linux_syscall_support.h: Add aarch64 syscall macros using svc #0 instruction with x8 for syscall number and x0-x5 for arguments. Provide wrappers for legacy syscalls removed on aarch64 (open->openat, stat->newfstatat, pipe->pipe2, dup2->dup3, fork->clone, readlink-> readlinkat, getpgrp->getpgid, getdents->getdents64). Add aarch64 to architecture guards for socket, mmap, wait4, sigaction, and other arch-gated sections. Include aarch64 syscall number definitions.

  • elfcore.h: Add aarch64_regs struct (31 GP regs + sp + pc + pstate) with BP/SP/IP/LR macros. Add FRAME/SET_FRAME macros using stp pairs to capture all registers.

  • elfcore.cc: Add aarch64 fpregs (32x128-bit SIMD vregs + fpsr/fpcr) and empty fpxregs. Set ELF_ARCH to EM_AARCH64. Use PTRACE_GETREGSET with NT_PRSTATUS/NT_PRFPREG instead of PTRACE_GETREGS/PTRACE_GETFPREGS for register reading. Skip core_user/PEEKUSER on aarch64.

  • linuxthreads.h: Add aarch64 to architecture guard for THREADS.

  • linuxthreads.cc: Use kernel_dirent64/sys_getdents64 on aarch64 since __NR_getdents is not available.

The coredumper library previously only supported x86-32, x86-64, ARM32,
MIPS, and PPC architectures. On aarch64, the DUMPER macro was never
defined, causing InternalGetCoreDump() to return -1 with EINVAL. This
made the percona.coredump MTR test fail on arm64 builds because no core
files were produced after SIGSEGV.

Key changes for aarch64 support:

- linux_syscall_support.h: Add aarch64 syscall macros using svc #0
  instruction with x8 for syscall number and x0-x5 for arguments.
  Provide wrappers for legacy syscalls removed on aarch64 (open->openat,
  stat->newfstatat, pipe->pipe2, dup2->dup3, fork->clone, readlink->
  readlinkat, getpgrp->getpgid, getdents->getdents64). Add aarch64 to
  architecture guards for socket, mmap, wait4, sigaction, and other
  arch-gated sections. Include aarch64 syscall number definitions.

- elfcore.h: Add aarch64_regs struct (31 GP regs + sp + pc + pstate)
  with BP/SP/IP/LR macros. Add FRAME/SET_FRAME macros using stp pairs
  to capture all registers.

- elfcore.cc: Add aarch64 fpregs (32x128-bit SIMD vregs + fpsr/fpcr)
  and empty fpxregs. Set ELF_ARCH to EM_AARCH64. Use PTRACE_GETREGSET
  with NT_PRSTATUS/NT_PRFPREG instead of PTRACE_GETREGS/PTRACE_GETFPREGS
  for register reading. Skip core_user/PEEKUSER on aarch64.

- linuxthreads.h: Add __aarch64__ to architecture guard for THREADS.

- linuxthreads.cc: Use kernel_dirent64/sys_getdents64 on aarch64 since
  __NR_getdents is not available.

Co-authored-by: Cursor <cursoragent@cursor.com>
@inikep inikep requested a review from dlenev February 13, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant