xref: /llvm-project/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s (revision bfb0a518e73623732c6567916d066df817e0cb0c)
1# REQUIRES: asserts
2# RUN: llvm-mc -triple=armv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t_armv7.o %s
3# RUN: llvm-objdump -s --section=.rodata %t_armv7.o | FileCheck --check-prefix=CHECK-OBJ %s
4# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \
5# RUN:              -slab-address 0x76ff0000 -slab-allocate 10Kb \
6# RUN:              -slab-page-size 4096 %t_armv7.o 2>&1 \
7# RUN:              | FileCheck --check-prefix=CHECK-LG %s
8# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \
9# RUN:              -slab-page-size 4096 %t_armv7.o -check %s
10
11# RUN: llvm-mc -triple=thumbv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t_thumbv7.o %s
12# RUN: llvm-objdump -s --section=.rodata %t_thumbv7.o | FileCheck --check-prefix=CHECK-OBJ %s
13# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \
14# RUN:              -slab-address 0x76ff0000 -slab-allocate 10Kb \
15# RUN:              -slab-page-size 4096 %t_thumbv7.o 2>&1 \
16# RUN:              | FileCheck --check-prefix=CHECK-LG %s
17# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \
18# RUN:              -slab-page-size 4096 %t_thumbv7.o -check %s
19
20# The strings of "H1\00", "H2\00" and "H3\00" are encoded as
21#               0x483100, 0x483200 and 0x483300 in the .rodata section.
22# CHECK-OBJ: Contents of section .rodata:
23# CHECK-OBJ: 0000 48310048 32004833 00                 H1.H2.H3.
24
25# CHECK-LG: Starting link phase 1 for graph
26# CHECK-LG: section .rodata:
27
28# CHECK-LG:       block 0x0 size = 0x00000009, align = 1, alignment-offset = 0
29# CHECK-LG-NEXT:    symbols:
30# CHECK-LG-NEXT:      0x0 (block + 0x00000000): size: 0x00000003, linkage: strong, scope: default, live  -   Lstr.H1
31# CHECK-LG-NEXT:      0x3 (block + 0x00000003): size: 0x00000003, linkage: strong, scope: default, live  -   Lstr.H2
32# CHECK-LG-NOT:       0x2 (block + 0x00000002): size: 0x00000003, linkage: strong, scope: default, live  -   Lstr.H2
33# CHECK-LG-NEXT:      0x6 (block + 0x00000006): size: 0x00000003, linkage: strong, scope: default, live  -   Lstr.H3
34
35# jitlink-check: Lstr.H1 = 0x76ff0000
36# jitlink-check: (*{4}(Lstr.H1))[23:0] = 0x003148
37	.globl	Lstr.H1
38	.type	Lstr.H1,%object
39	.section	.rodata,"a",%progbits
40Lstr.H1:
41	.asciz	"H1"
42	.size	Lstr.H1, 3
43
44# H2 is unaligned as its beginning address is base address + 0x3
45# Make sure the string we get is 0x003248 and not 0x324800
46# jitlink-check: Lstr.H2 = 0x76ff0003
47# jitlink-check: (*{4}(Lstr.H2))[23:0] = 0x003248
48	.globl	Lstr.H2
49	.type	Lstr.H2,%object
50Lstr.H2:
51	.asciz	"H2"
52	.size	Lstr.H2, 3
53
54# jitlink-check: Lstr.H3 = 0x76ff0006
55# jitlink-check: (*{4}(Lstr.H3))[23:0] = 0x003348
56	.globl	Lstr.H3
57	.type	Lstr.H3,%object
58Lstr.H3:
59	.asciz	"H3"
60	.size	Lstr.H3, 3
61
62	.text
63	.syntax unified
64# Empty main function for jitlink to be happy
65	.globl	main
66	.type	main,%function
67	.p2align	2
68main:
69	bx	lr
70	.size	main,.-main
71