3 ## Old versions of Android (Android 11 & 12) have very strict parsing logic on
4 ## the layout of the ELF note. This test ensures that backwards compatibility is
5 ## maintained, i.e. new versions of the linker will still produce binaries that
6 ## can be run on these versions of Android.
8 # RUN: llvm-mc --filetype=obj -triple=aarch64-linux-android %s -o %t.o
9 # RUN: ld.lld -shared --android-memtag-mode=async --android-memtag-heap %t.o -o %t
10 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,HEAP,NOSTACK,ASYNC
12 # RUN: ld.lld -shared --android-memtag-mode=sync --android-memtag-heap %t.o -o %t
13 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,HEAP,NOSTACK,SYNC
15 # RUN: ld.lld -shared --android-memtag-mode=async --android-memtag-stack %t.o -o %t
16 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,NOHEAP,STACK,ASYNC
18 # RUN: ld.lld -shared --android-memtag-mode=sync --android-memtag-stack %t.o -o %t
19 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,NOHEAP,STACK,SYNC
21 # RUN: ld.lld -shared --android-memtag-mode=async --android-memtag-heap \
22 # RUN: --android-memtag-stack %t.o -o %t
23 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,HEAP,STACK,ASYNC
25 # RUN: ld.lld -shared --android-memtag-mode=sync --android-memtag-heap \
26 # RUN: --android-memtag-stack %t.o -o %t
27 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=CHECK,HEAP,STACK,SYNC
29 # RUN: ld.lld -shared --android-memtag-heap %t.o -o %t 2>&1 | \
30 # RUN: FileCheck %s --check-prefixes=MISSING-MODE
31 # RUN: ld.lld -shared --android-memtag-stack %t.o -o %t 2>&1 | \
32 # RUN: FileCheck %s --check-prefixes=MISSING-MODE
33 # RUN: ld.lld -shared --android-memtag-heap --android-memtag-stack %t.o -o %t 2>&1 | \
34 # RUN: FileCheck %s --check-prefixes=MISSING-MODE
35 # MISSING-MODE: warning: --android-memtag-mode is unspecified, leaving
36 # MISSING-MODE: --android-memtag-{{(heap|stack)}} a no-op
38 # CHECK: Memtag Dynamic Entries
39 # SYNC: AARCH64_MEMTAG_MODE: Synchronous (0)
40 # ASYNC: AARCH64_MEMTAG_MODE: Asynchronous (1)
41 # HEAP: AARCH64_MEMTAG_HEAP: Enabled (1)
42 # NOHEAP: AARCH64_MEMTAG_HEAP: Disabled (0)
43 # STACK: AARCH64_MEMTAG_STACK: Enabled (1)
44 # NOSTACK: AARCH64_MEMTAG_STACK: Disabled (0)
46 # CHECK: Memtag Android Note
47 # ASYNC-NEXT: Tagging Mode: ASYNC
48 # SYNC-NEXT: Tagging Mode: SYNC
49 # HEAP-NEXT: Heap: Enabled
50 # NOHEAP-NEXT: Heap: Disabled
51 # STACK-NEXT: Stack: Enabled
52 # NOSTACK-NEXT: Stack: Disabled
54 # RUN: not ld.lld -shared --android-memtag-mode=asymm --android-memtag-heap 2>&1 | \
55 # RUN: FileCheck %s --check-prefix=BAD-MODE
56 # BAD-MODE: error: unknown --android-memtag-mode value: "asymm", should be one of
57 # BAD-MODE: {async, sync, none}
59 # RUN: ld.lld -static --android-memtag-mode=sync --android-memtag-heap \
60 # RUN: --android-memtag-stack %t.o -o %t
61 # RUN: llvm-readelf --memtag %t | FileCheck %s --check-prefixes=STATIC
63 # STATIC: Memtag Dynamic Entries:
64 # STATIC-NEXT: < none found >
65 # STATIC: Memtag Android Note:
66 # STATIC-NEXT: Tagging Mode: SYNC
67 # STATIC-NEXT: Heap: Enabled
68 # STATIC-NEXT: Stack: Enabled