1 ; Test -asan-with-ifunc flag.
3 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=0 < %s | \
4 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-NOIFUNC
5 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 < %s | \
6 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC
7 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=1 < %s | \
8 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC-NOREMAT
10 ; Pre-Lollipop Android does not support ifunc.
11 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android20 < %s | \
12 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-NOIFUNC
13 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android < %s | \
14 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-NOIFUNC
15 ; RUN: opt -asan -asan-module -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android21 < %s | \
16 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC
18 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
19 target triple = "armv7--linux-android22"
21 ; CHECK-IFUNC: @__asan_shadow = external global [0 x i8]
22 ; CHECK-NOIFUNC: @__asan_shadow_memory_dynamic_address = external global i32
24 define i32 @test_load(i32* %a) sanitize_address {
25 ; First instrumentation in the function must be to load the dynamic shadow
26 ; address into a local variable.
27 ; CHECK-LABEL: @test_load
30 ; CHECK-IFUNC-NEXT: %[[A:[^ ]*]] = ptrtoint i32* %a to i32
31 ; CHECK-IFUNC-NEXT: %[[B:[^ ]*]] = lshr i32 %[[A]], 3
32 ; CHECK-IFUNC-NEXT: %[[C:[^ ]*]] = add i32 %[[B]], ptrtoint ([0 x i8]* @__asan_shadow to i32)
34 ; CHECK-IFUNC-NOREMAT-NEXT: %[[S:[^ ]*]] = call i32 asm "", "=r,0"([0 x i8]* @__asan_shadow)
35 ; CHECK-IFUNC-NOREMAT-NEXT: %[[A:[^ ]*]] = ptrtoint i32* %a to i32
36 ; CHECK-IFUNC-NOREMAT-NEXT: %[[B:[^ ]*]] = lshr i32 %[[A]], 3
37 ; CHECK-IFUNC-NOREMAT-NEXT: %[[C:[^ ]*]] = add i32 %[[B]], %[[S]]
39 ; CHECK-NOIFUNC-NEXT: %[[SHADOW:[^ ]*]] = load i32, i32* @__asan_shadow_memory_dynamic_address
40 ; CHECK-NOIFUNC-NEXT: %[[A:[^ ]*]] = ptrtoint i32* %a to i32
41 ; CHECK-NOIFUNC-NEXT: %[[B:[^ ]*]] = lshr i32 %[[A]], 3
42 ; CHECK-NOIFUNC-NEXT: %[[C:[^ ]*]] = add i32 %[[B]], %[[SHADOW]]
45 %x = load i32, i32* %a, align 4