Skip to content

Conversation

@paschalis-mpeis
Copy link
Member

No description provided.

@paschalis-mpeis paschalis-mpeis marked this pull request as ready for review January 5, 2026 14:57
@llvmbot llvmbot added the BOLT label Jan 5, 2026
@llvmbot
Copy link
Member

llvmbot commented Jan 5, 2026

@llvm/pr-subscribers-bolt

Author: Paschalis Mpeis (paschalis-mpeis)

Changes

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

1 Files Affected:

  • (added) bolt/test/AArch64/rseq.s (+36)
diff --git a/bolt/test/AArch64/rseq.s b/bolt/test/AArch64/rseq.s
new file mode 100644
index 0000000000000..31c3990a48a13
--- /dev/null
+++ b/bolt/test/AArch64/rseq.s
@@ -0,0 +1,36 @@
+## Check that llvm-bolt avoids optimization of functions referenced from
+## __rseq_cs section, i.e. containing critical sections and abort handlers used
+## by restartable sequences in tcmalloc.
+
+# RUN: %clang %cflags %s -o %t -nostdlib -no-pie -Wl,-q
+# RUN: llvm-bolt %t -o %t.bolt --print-cfg 2>&1 | FileCheck %s
+# RUN: %clang %cflags %s -o %t.pie -nostdlib -pie -Wl,-q
+# RUN: llvm-bolt %t.pie -o %t.pie.bolt 2>&1 | FileCheck %s
+
+# CHECK: restartable sequence reference detected in _start
+# CHECK: restartable sequence reference detected in __rseq_abort
+
+  .text
+.reloc 0, R_AARCH64_NONE
+
+  .global _start
+  .type _start, %function
+_start:
+  stp     x29, x30, [sp, #-16]!
+  mov     x29, sp
+.L1:
+  ldp     x29, x30, [sp], #16
+.L2:
+  ret
+  .size _start, .-_start
+
+  .section __rseq_abort, "ax"
+## Signature for rseq abort IP. Unmarked in the symbol table.
+ .long 0xd428bc00 // RSEQ_SIG_CODE, BRK #0x45E0
+.L3:
+  b .L2
+
+.section __rseq_cs, "aw"
+.balign 32
+  .quad .L1
+  .quad .L3

@paschalis-mpeis
Copy link
Member Author

paschalis-mpeis commented Jan 5, 2026

@maksfb tentative PR that adds a restartable sequences test for AArch64.
Do you think the rseq logic checks out?

@paschalis-mpeis paschalis-mpeis marked this pull request as draft January 5, 2026 14:59
@maksfb
Copy link
Contributor

maksfb commented Jan 5, 2026

@paschalis-mpeis Yes, makes sense to me. Thanks!

@paschalis-mpeis paschalis-mpeis marked this pull request as ready for review January 6, 2026 09:40
@paschalis-mpeis
Copy link
Member Author

Great, thanks. Can you please approve?

@paschalis-mpeis paschalis-mpeis merged commit 164cfda into main Jan 7, 2026
16 checks passed
@paschalis-mpeis paschalis-mpeis deleted the users/paschalis-mpeis/rseq-aarch64-test branch January 7, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants