summaryrefslogtreecommitdiff
path: root/test/COFF/Inputs/comdat-jumptable2.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/COFF/Inputs/comdat-jumptable2.s')
-rw-r--r--test/COFF/Inputs/comdat-jumptable2.s35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/COFF/Inputs/comdat-jumptable2.s b/test/COFF/Inputs/comdat-jumptable2.s
new file mode 100644
index 000000000000..8990d4c0d7f3
--- /dev/null
+++ b/test/COFF/Inputs/comdat-jumptable2.s
@@ -0,0 +1,35 @@
+ .section .text@comdatfunc, "x"
+ .linkonce discard
+ .globl comdatfunc
+comdatfunc:
+ leaq .Ljumptable(%rip), %rax
+ movslq (%rax, %rcx, 4), %rcx
+ addq %rcx, %rax
+ jmp *%rax
+
+ .section .rdata, "dr"
+ .long 0xcccccccc
+.Ljumptable:
+ .long .Ltail1-.Ljumptable
+ .long .Ltail2-.Ljumptable
+ .long .Ltail3-.Ljumptable
+ .long 0xdddddddd
+
+ .section .text@comdatfunc, "x"
+# If assembled with binutils, the following line can be kept in:
+# .linkonce discard
+.Ltail1:
+ movl $1, %eax
+ ret
+.Ltail2:
+ movl $2, %eax
+ ret
+.Ltail3:
+ movl $3, %eax
+ ret
+
+ .text
+ .globl otherfunc
+otherfunc:
+ call comdatfunc
+ ret