|
1 | 1 | // This test checks that the constant island is aligned after BOLT tool.
|
2 |
| -// In case the nop before .Lci will be removed the pointer to exit function |
3 |
| -// won't be alinged and the test will fail. |
| 2 | + |
| 3 | +# RUN: split-file %s %t |
| 4 | + |
| 5 | +// For the first test case, in case the nop before .Lci will be removed |
| 6 | +// the pointer to exit function won't be alinged and the test will fail. |
4 | 7 |
|
5 | 8 | # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
|
6 |
| -# RUN: %s -o %t.o |
7 |
| -# RUN: %clang %cflags -fPIC -pie %t.o -o %t.exe -Wl,-q \ |
| 9 | +# RUN: %t/xword_align.s -o %t_xa.o |
| 10 | +# RUN: %clang %cflags -fPIC -pie %t_xa.o -o %t_xa.exe -Wl,-q \ |
8 | 11 | # RUN: -nostartfiles -nodefaultlibs -Wl,-z,notext
|
9 |
| -# RUN: llvm-bolt %t.exe -o %t.bolt --use-old-text=0 --lite=0 --trap-old-code |
10 |
| -# RUN: llvm-objdump -d --disassemble-symbols='$d' %t.bolt | FileCheck %s |
| 12 | +# RUN: llvm-bolt %t_xa.exe -o %t_xa.bolt --use-old-text=0 --lite=0 \ |
| 13 | +# RUN: --trap-old-code |
| 14 | +# RUN: llvm-objdump -d --disassemble-symbols='$d' %t_xa.bolt | FileCheck %s |
| 15 | + |
| 16 | +// For the second and third test cases, we want to set an alignment based |
| 17 | +// on various heuristics. |
| 18 | + |
| 19 | +# RUN: %clang %cflags -pie %t/page_align.s -o %t_pa.exe -Wl,-q \ |
| 20 | +# RUN: -Wl,--init=_foo -Wl,--fini=_foo |
| 21 | +# RUN: llvm-bolt %t_pa.exe -o %t_pa.bolt |
| 22 | +# RUN: llvm-objdump -t %t_pa.exe | grep _const_island |
| 23 | +# RUN: llvm-objdump -t %t_pa.bolt | grep _const_island | FileCheck %s \ |
| 24 | +# RUN: --check-prefix=PAGE |
| 25 | + |
| 26 | +# RUN: %clang %cflags -pie %t/64B_align.s -o %t_64B.exe -Wl,-q \ |
| 27 | +# RUN: -Wl,--init=_foo -Wl,--fini=_foo |
| 28 | +# RUN: llvm-bolt %t_64B.exe -o %t_64B.bolt |
| 29 | +# RUN: llvm-objdump -t %t_64B.exe | grep _const_island |
| 30 | +# RUN: llvm-objdump -t %t_64B.bolt | grep _const_island | FileCheck %s \ |
| 31 | +# RUN: --check-prefix=64BYTE |
11 | 32 |
|
| 33 | +;--- xword_align.s |
12 | 34 | .text
|
13 | 35 | .align 4
|
14 | 36 | .global
|
@@ -36,3 +58,51 @@ _start:
|
36 | 58 | .Lci:
|
37 | 59 | .xword exitOk
|
38 | 60 | .xword 0
|
| 61 | + |
| 62 | +;--- page_align.s |
| 63 | + .text |
| 64 | + .global _foo |
| 65 | + .type _foo, %function |
| 66 | +_foo: |
| 67 | + ret |
| 68 | + |
| 69 | + .text |
| 70 | + .global _const_island |
| 71 | + .align 12 |
| 72 | +# PAGE: {{[0-9a-f]*}}000 g |
| 73 | +_const_island: |
| 74 | + .rept 0x25100 |
| 75 | + .byte 0xbb |
| 76 | + .endr |
| 77 | + |
| 78 | + .global _start |
| 79 | + .type _start, %function |
| 80 | +_start: |
| 81 | + ret |
| 82 | + |
| 83 | + # Dummy relocation to force relocation mode |
| 84 | + .reloc 0, R_AARCH64_NONE |
| 85 | + |
| 86 | +;--- 64B_align.s |
| 87 | + .text |
| 88 | + .global _foo |
| 89 | + .type _foo, %function |
| 90 | +_foo: |
| 91 | + ret |
| 92 | + |
| 93 | + .text |
| 94 | + .global _const_island |
| 95 | + .align 6 |
| 96 | +# 64BYTE: {{[0-9a-f]*}}{{0|4|8|c}}0 g |
| 97 | +_const_island: |
| 98 | + .rept 0x2048 |
| 99 | + .byte 0xbb |
| 100 | + .endr |
| 101 | + |
| 102 | + .global _start |
| 103 | + .type _start, %function |
| 104 | +_start: |
| 105 | + ret |
| 106 | + |
| 107 | + # Dummy relocation to force relocation mode |
| 108 | + .reloc 0, R_AARCH64_NONE |
0 commit comments