|
1 | 1 | ;; Tagged symbols are only available on aarch64-linux-android.
|
2 |
| -; RUN: not llc %s -mtriple=aarch64-linux-unknown |
3 |
| -; RUN: not llc %s -mtriple=x86_64-linux-unknown |
| 2 | +; RUN: not llc %s -mtriple=aarch64-unknown-linux 2>&1 | FileCheck %s --check-prefix=ERR |
| 3 | +; RUN: not llc %s -mtriple=x86_64-unknown-linux 2>&1 | FileCheck %s --check-prefix=ERR |
| 4 | + |
| 5 | +; ERR: error: tagged symbols (-fsanitize=memtag-globals) are only supported on AArch64 Android |
4 | 6 |
|
5 | 7 | ; RUN: llc %s -mtriple=aarch64-linux-android31 -o %t.S
|
6 | 8 | ; RUN: FileCheck %s --input-file=%t.S --check-prefix=CHECK-ASM
|
|
12 | 14 | ; RUN: yaml2obj %t.yaml -o %t.o
|
13 | 15 | ; RUN: llvm-readelf -r %t.o | FileCheck %s --check-prefix=CHECK-RELOCS
|
14 | 16 |
|
| 17 | +;; Check we don't create relocations referencing a section symbol for sanitize_memtag globals. |
| 18 | +; CHECK-RELOCS: Relocation section '.rela.text' {{.*}} contains 4 entries: |
| 19 | +; CHECK-RELOCS: R_AARCH64_ADR_GOT_PAGE {{.*}} internal_four + 0 |
| 20 | +; CHECK-RELOCS-NEXT: R_AARCH64_ADR_GOT_PAGE {{.*}} four + 0 |
| 21 | +; CHECK-RELOCS-NEXT: R_AARCH64_LD64_GOT_LO12_NC {{.*}} internal_four + 0 |
| 22 | +; CHECK-RELOCS-NEXT: R_AARCH64_LD64_GOT_LO12_NC {{.*}} four + 0 |
| 23 | + |
15 | 24 | ; CHECK-RELOCS: Relocation section '.rela.memtag.globals.static' {{.*}} contains 4 entries
|
16 | 25 | ; CHECK-RELOCS: R_AARCH64_NONE {{.*}} internal_four
|
17 | 26 | ; CHECK-RELOCS: R_AARCH64_NONE {{.*}} four
|
|
40 | 49 | ; CHECK-ASM-NOT: .memtag specialcaselisted
|
41 | 50 |
|
42 | 51 | @internal_four = internal global i32 1, sanitize_memtag
|
43 |
| -@four = global i32 1, sanitize_memtag |
| 52 | +@four = dso_local global i32 1, sanitize_memtag |
44 | 53 | @sixteen = global [16 x i8] zeroinitializer, sanitize_memtag
|
45 | 54 | @huge = global [16777232 x i8] zeroinitializer, sanitize_memtag
|
46 | 55 | @specialcaselisted = global i16 2
|
| 56 | + |
| 57 | +define i32 @use() { |
| 58 | +entry: |
| 59 | + %a = load i32, ptr @internal_four |
| 60 | + %b = load i32, ptr @four |
| 61 | + %sum = add i32 %a, %b |
| 62 | + ret i32 %sum |
| 63 | +} |
0 commit comments