Skip to content

Conversation

@medismailben
Copy link
Member

@medismailben medismailben commented Nov 12, 2025

This patch should fix an libunwind build failure that happens on Chromium's Android bots:

#165066 (comment)

The issue is that we're using the wzr register to move the value 0 in x1, but this is the 32-bit register.

To prevent this issue, we use an immediate instead of the zero registers.

@llvmbot
Copy link
Member

llvmbot commented Nov 12, 2025

@llvm/pr-subscribers-libunwind

Author: Med Ismail Bennani (medismailben)

Changes

This patch should fix an libunwind build failure that happens on Chromium's Android bots:

#165066 (comment)

The issue is that we're using the wzr register to move the value 0 in x1, but this is the 32-bit register. We should be using the 64-bit version, xzr instead.


Full diff: https://github.com/llvm/llvm-project/pull/167743.diff

1 Files Affected:

  • (modified) libunwind/src/UnwindLevel1.c (+1-1)
diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c
index 79398bac8b531..f1794ef2bb49e 100644
--- a/libunwind/src/UnwindLevel1.c
+++ b/libunwind/src/UnwindLevel1.c
@@ -82,7 +82,7 @@
     void *shstkRegContext = __libunwind_shstk_get_registers((cursor));         \
     void *shstkJumpAddress = __libunwind_shstk_get_jump_target();              \
     __asm__ volatile("mov x0, %0\n\t"                                          \
-                     "mov x1, wzr\n\t"                                         \
+                     "mov x1, xzr\n\t"                                         \
                      "br %1\n\t"                                               \
                      :                                                         \
                      : "r"(shstkRegContext), "r"(shstkJumpAddress)             \

Copy link
Member

@dtellenbach dtellenbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the nit of using an immediate instead.

@medismailben medismailben force-pushed the fix-cxx-exception-trace-call-imbalance branch from 2c92459 to c08b793 Compare November 12, 2025 19:20
This patch should fix an libunwind build failure that happens on
Chromium's Android bots:

llvm#165066 (comment)

The issue is that we're using the `wzr` register to move the value 0 in
x1, but this is the 32-bit register. To prevent this issue, we use an
immediate instead of the zero registers.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
@medismailben medismailben force-pushed the fix-cxx-exception-trace-call-imbalance branch from c08b793 to 5af9358 Compare November 12, 2025 19:21
@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions c -- libunwind/src/UnwindLevel1.c --diff_from_common_commit

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c
index 73a27928e..714f0b7d3 100644
--- a/libunwind/src/UnwindLevel1.c
+++ b/libunwind/src/UnwindLevel1.c
@@ -82,7 +82,7 @@
     void *shstkRegContext = __libunwind_shstk_get_registers((cursor));         \
     void *shstkJumpAddress = __libunwind_shstk_get_jump_target();              \
     __asm__ volatile("mov x0, %0\n\t"                                          \
-                     "mov x1, #0\n\t"                                         \
+                     "mov x1, #0\n\t"                                          \
                      "br %1\n\t"                                               \
                      :                                                         \
                      : "r"(shstkRegContext), "r"(shstkJumpAddress)             \

@medismailben medismailben merged commit e5e9c3b into llvm:main Nov 12, 2025
72 of 74 checks passed
git-crd pushed a commit to git-crd/crd-llvm-project that referenced this pull request Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants