[llvm] a49a9dd - MC, test: Add a MCFillFragment stress test from #123402

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 23:52:32 PDT 2025


Author: Fangrui Song
Date: 2025-06-01T23:52:27-07:00
New Revision: a49a9dd14f51d5b4b57ccd49d481b14c9b3a9fb9

URL: https://github.com/llvm/llvm-project/commit/a49a9dd14f51d5b4b57ccd49d481b14c9b3a9fb9
DIFF: https://github.com/llvm/llvm-project/commit/a49a9dd14f51d5b4b57ccd49d481b14c9b3a9fb9.diff

LOG: MC,test: Add a MCFillFragment stress test from #123402

This will be resolved by an upcoming change that changes the fragment
relaxation algorithm.

Added: 
    llvm/test/MC/ELF/layout-interdependency3.s

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/ELF/layout-interdependency3.s b/llvm/test/MC/ELF/layout-interdependency3.s
new file mode 100644
index 0000000000000..85b90078b1b2a
--- /dev/null
+++ b/llvm/test/MC/ELF/layout-interdependency3.s
@@ -0,0 +1,45 @@
+## This contrived .space example previously triggered "invalid number of bytes" error.
+## https://github.com/llvm/llvm-project/issues/123402
+# RUN: not llvm-mc -filetype=obj -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK: error: invalid number of bytes
+
+	.section .p,"ax"
+p_1st:
+0:	pause
+	lfence
+	jmp	0b
+
+	.section .q,"ax"
+q_1st:
+	addl	11,%eax
+	addl	22,%eax
+
+q_cli:
+	cli
+0:	pause
+	lfence
+	jmp	0b
+
+	.section .p
+	.space	(q_cli - q_1st) - (. - p_1st), 0xcc
+	cli
+
+	.section .q
+q_sti:
+	sti
+
+	.section .p
+	.space	(q_sti - q_1st) - (. - p_1st), 0xcc
+	sti
+	addl	33,%eax
+	addl	44,%eax
+p_nop:
+	nop
+
+	.section .q
+0:	pause
+	lfence
+	jmp	0b
+	.space	(p_nop - p_1st) - (. - q_1st), 0xcc
+	nop


        


More information about the llvm-commits mailing list