From fcdbd3e26d20fc8d3fade086f09fc94b06efe2b8 Mon Sep 17 00:00:00 2001 From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:12:15 +0200 Subject: [PATCH 01/11] check windows-11-arm runner --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87e28d87f..65852da5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,8 @@ jobs: TEST_X86: 1 - name: Windows (latest) os: windows-latest + - name: Windows arm64 + os: windows-11-arm - name: Windows ClangCL (latest) os: windows-latest VS_GENERATOR_TOOLSET: ClangCL From 60dbd2891ee1285d322191b47e2d681080930119 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 15 Apr 2025 17:37:46 +0200 Subject: [PATCH 02/11] install rust on win11 --- .github/workflows/ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65852da5a..cdd9c9182 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,6 +174,17 @@ jobs: make sudo make install + - name: Install rust (Windows 11 ARM64 until the image has it) + if: ${{ matrix.os == 'windows-11-arm' }} + shell: pwsh + run: | + Invoke-WebRequest -Uri "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe" -OutFile rustup-init.exe + .\rustup-init.exe --default-toolchain none -y + "$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH + "CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV + rustup install stable + rustup target add aarch64-pc-windows-msvc + - name: Installing Linux GCC 9.4.0 Dependencies if: ${{ runner.os == 'Linux' && matrix.os == 'ubuntu-22.04' && !env['TEST_X86'] }} run: | From 9fe08ad1b808a0518596dd1bde50896a0018b12f Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 15 Apr 2025 17:42:56 +0200 Subject: [PATCH 03/11] separate rust install steps so seconds step pick up env --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdd9c9182..b205c827e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,7 +174,7 @@ jobs: make sudo make install - - name: Install rust (Windows 11 ARM64 until the image has it) + - name: Install rustup on Windows 11 ARM64 (until the image has it) if: ${{ matrix.os == 'windows-11-arm' }} shell: pwsh run: | @@ -182,6 +182,11 @@ jobs: .\rustup-init.exe --default-toolchain none -y "$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH "CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV + + - name: Install rust on Windows 11 ARM64 (until the image has it) + if: ${{ matrix.os == 'windows-11-arm' }} + shell: pwsh + run: | rustup install stable rustup target add aarch64-pc-windows-msvc From 32258e31fb1b2b52c715d3c0e441015b074f55f2 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 15 Apr 2025 21:11:04 +0200 Subject: [PATCH 04/11] do not install clang-format via pip when on ARM64 windows --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 50002c903..d8e819f36 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,6 +3,6 @@ pytest==8.1.1 pytest-httpserver==1.0.10 msgpack==1.0.8 pytest-xdist==3.5.0 -clang-format==19.1.3 +clang-format==19.1.3; not (sys_platform == "win32" and platform_machine == "ARM64") pywin32==308; sys_platform == "win32" mitmproxy==11.0.0 From 4fcb3366b34e9eb189ebcfda7955f600208f1447 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 15 Apr 2025 21:16:24 +0200 Subject: [PATCH 05/11] use DeMorgan do bypass the PEP508 expression limit --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index d8e819f36..5e2756462 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,6 +3,6 @@ pytest==8.1.1 pytest-httpserver==1.0.10 msgpack==1.0.8 pytest-xdist==3.5.0 -clang-format==19.1.3; not (sys_platform == "win32" and platform_machine == "ARM64") +clang-format==19.1.3; sys_platform != "win32" or platform_machine != "ARM64" pywin32==308; sys_platform == "win32" mitmproxy==11.0.0 From 008b420a5003f3354f063b6f39ddd869d3f9aeb6 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 15 Apr 2025 21:40:08 +0200 Subject: [PATCH 06/11] figure out if OpenSSL was correctly installed --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b205c827e..8d8eb7f4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,6 +182,7 @@ jobs: .\rustup-init.exe --default-toolchain none -y "$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH "CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV + tree "$env:ProgramFiles\OpenSSL" /F - name: Install rust on Windows 11 ARM64 (until the image has it) if: ${{ matrix.os == 'windows-11-arm' }} From 25eaa970aaf13c81d761cb28e7a88a507c39b067 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Thu, 5 Jun 2025 16:09:22 +0200 Subject: [PATCH 07/11] try clang-format 20.1.5 (which has ARM64 wheels) --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 5e2756462..55a1fcd8f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,6 +3,6 @@ pytest==8.1.1 pytest-httpserver==1.0.10 msgpack==1.0.8 pytest-xdist==3.5.0 -clang-format==19.1.3; sys_platform != "win32" or platform_machine != "ARM64" +clang-format==20.1.5 pywin32==308; sys_platform == "win32" mitmproxy==11.0.0 From 016e7d603f0e04da889fbffe8d866ab85fdc9054 Mon Sep 17 00:00:00 2001 From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> Date: Fri, 9 Jan 2026 10:59:34 +0100 Subject: [PATCH 08/11] (test) temporarily skip mitmproxy on ARM64 --- tests/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 22322f74b..4166841b3 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,5 +5,6 @@ msgpack==1.0.8 pytest-xdist==3.5.0 clang-format==20.1.5 pywin32==308; sys_platform == "win32" -mitmproxy==11.0.0 +# mitmproxy requires OpenSSL to build on Windows ARM64, skip it there +mitmproxy==11.0.0; platform_machine != "ARM64" psutil==7.1.1 From 8ac82aca9ec3fff7c2a0f0826ab0a79b8fa23a78 Mon Sep 17 00:00:00 2001 From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:42:26 +0100 Subject: [PATCH 09/11] update test_build_static for ARM64 --- tests/test_build_static.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_build_static.py b/tests/test_build_static.py index e2ccfadf7..719edfcdc 100644 --- a/tests/test_build_static.py +++ b/tests/test_build_static.py @@ -28,11 +28,13 @@ def test_static_lib(cmake): binary.seek(offset, 0) magic = binary.read(6) # https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#signature-image-only - assert magic == ( - b"PE\x00\x00\x4c\x01" - if os.environ.get("TEST_X86") - else b"PE\x00\x00\x64\x86" - ) + if os.environ.get("TEST_X86"): + expected = b"PE\x00\x00\x4c\x01" # IMAGE_FILE_MACHINE_I386 + elif os.environ.get("PROCESSOR_ARCHITECTURE") == "ARM64": + expected = b"PE\x00\x00\x64\xaa" # IMAGE_FILE_MACHINE_ARM64 + else: + expected = b"PE\x00\x00\x64\x86" # IMAGE_FILE_MACHINE_AMD64 + assert magic == expected # similarly, we use `file` on linux if sys.platform == "linux": output = subprocess.check_output( From 1749d0a51e8d6f250992d7875f8a288dc946b612 Mon Sep 17 00:00:00 2001 From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:48:06 +0100 Subject: [PATCH 10/11] add ARM64 Windows registers to inproc backend --- src/backends/sentry_backend_inproc.c | 43 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/backends/sentry_backend_inproc.c b/src/backends/sentry_backend_inproc.c index 5ac3e2e2b..3f02024e3 100644 --- a/src/backends/sentry_backend_inproc.c +++ b/src/backends/sentry_backend_inproc.c @@ -445,8 +445,47 @@ registers_from_uctx(const sentry_ucontext_t *uctx) SET_REG("esp", Esp); } -# else - // _ARM64_ +# elif defined(_M_ARM64) + + if (ctx->ContextFlags & CONTEXT_INTEGER) { + SET_REG("x0", X0); + SET_REG("x1", X1); + SET_REG("x2", X2); + SET_REG("x3", X3); + SET_REG("x4", X4); + SET_REG("x5", X5); + SET_REG("x6", X6); + SET_REG("x7", X7); + SET_REG("x8", X8); + SET_REG("x9", X9); + SET_REG("x10", X10); + SET_REG("x11", X11); + SET_REG("x12", X12); + SET_REG("x13", X13); + SET_REG("x14", X14); + SET_REG("x15", X15); + SET_REG("x16", X16); + SET_REG("x17", X17); + // x18 is reserved as platform register on Windows + SET_REG("x19", X19); + SET_REG("x20", X20); + SET_REG("x21", X21); + SET_REG("x22", X22); + SET_REG("x23", X23); + SET_REG("x24", X24); + SET_REG("x25", X25); + SET_REG("x26", X26); + SET_REG("x27", X27); + SET_REG("x28", X28); + } + + if (ctx->ContextFlags & CONTEXT_CONTROL) { + SET_REG("fp", Fp); + SET_REG("lr", Lr); + SET_REG("sp", Sp); + SET_REG("pc", Pc); + } + # endif # undef SET_REG From 1d1ef580f06426a10f33f874dd6037375794ac4c Mon Sep 17 00:00:00 2001 From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:49:23 +0100 Subject: [PATCH 11/11] remove rustup install since we skip mitmproxy anyway --- .github/workflows/ci.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fb9c1fff..8c7f592a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -261,23 +261,6 @@ jobs: make sudo make install - - name: Install rustup on Windows 11 ARM64 (until the image has it) - if: ${{ matrix.os == 'windows-11-arm' }} - shell: pwsh - run: | - Invoke-WebRequest -Uri "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe" -OutFile rustup-init.exe - .\rustup-init.exe --default-toolchain none -y - "$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH - "CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV - tree "$env:ProgramFiles\OpenSSL" /F - - - name: Install rust on Windows 11 ARM64 (until the image has it) - if: ${{ matrix.os == 'windows-11-arm' }} - shell: pwsh - run: | - rustup install stable - rustup target add aarch64-pc-windows-msvc - - name: Installing Linux 32-bit Dependencies if: ${{ runner.os == 'Linux' && env['TEST_X86'] && !matrix.container }} run: |