PS-10330: Add aarch64 (arm64) support to the coredumper library#14
Open
inikep wants to merge 1 commit intoPercona-Lab:masterfrom
Open
PS-10330: Add aarch64 (arm64) support to the coredumper library#14inikep wants to merge 1 commit intoPercona-Lab:masterfrom
inikep wants to merge 1 commit intoPercona-Lab:masterfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.