• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc < %s -triple=aarch64-none-linux-gnu -filetype=obj | llvm-readobj -r | FileCheck %s
2
3	.file	"<stdin>"
4	.text
5	.globl	test_jumptable
6	.type	test_jumptable,@function
7test_jumptable:                         // @test_jumptable
8	.cfi_startproc
9// BB#0:
10	ubfx	w1, w0, #0, #32
11	cmp w0, #4
12	b.hi .LBB0_3
13// BB#1:
14	adrp	x0, .LJTI0_0
15	add	x0, x0, #:lo12:.LJTI0_0
16	ldr	x0, [x0, x1, lsl #3]
17	br	x0
18.LBB0_2:                                // %lbl1
19	movz	x0, #1
20	ret
21.LBB0_3:                                // %def
22	mov	 x0, xzr
23	ret
24.LBB0_4:                                // %lbl2
25	movz	x0, #2
26	ret
27.LBB0_5:                                // %lbl3
28	movz	x0, #4
29	ret
30.LBB0_6:                                // %lbl4
31	movz	x0, #8
32	ret
33.Ltmp0:
34	.size	test_jumptable, .Ltmp0-test_jumptable
35	.cfi_endproc
36	.section	.rodata,"a",@progbits
37	.align	3
38.LJTI0_0:
39	.xword	.LBB0_2
40	.xword	.LBB0_4
41	.xword	.LBB0_5
42	.xword	.LBB0_3
43	.xword	.LBB0_6
44
45
46
47// First make sure we get a page/lo12 pair in .text to pick up the jump-table
48
49// CHECK:      Relocations [
50// CHECK:        Section ({{[0-9]+}}) .rela.text {
51// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 .rodata
52// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ADD_ABS_LO12_NC .rodata
53// CHECK:        }
54
55// Also check the targets in .rodata are relocated
56// CHECK:        Section ({{[0-9]+}}) .rela.rodata {
57// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ABS64 .text
58// CHECK:        }
59// CHECK:      ]
60