Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: test/Transforms/NaCl/sandbox-memory-accesses.ll

Issue 29743003: Add passes for applying SFI sandboxing at the LLVM IR level Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry upload Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/Transforms/NaCl/sandbox-indirect-calls.ll ('k') | test/Transforms/NaCl/strip-tls.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; RUN: opt %s -sandbox-memory-accesses -S | FileCheck %s
2
3
4 ; CHECK: @__sfi_memory_base = external global i64
5
6 define void @func(i32* %ptr) {
7 %val = load i32* %ptr
8 ret void
9 }
10 ; CHECK: define void @func(i32* %ptr) {
11 ; CHECK-NEXT: %mem_base = load i64* @__sfi_memory_base
12 ; CHECK-NEXT: %1 = ptrtoint i32* %ptr to i32
13 ; CHECK-NEXT: %2 = zext i32 %1 to i64
14 ; CHECK-NEXT: %3 = add i64 %mem_base, %2
15 ; CHECK-NEXT: %4 = inttoptr i64 %3 to i32*
16 ; CHECK-NEXT: %val = load i32* %4
17
18 define void @func2(i32* %ptr) {
19 %val = load i32* %ptr
20 store i32 %val, i32* %ptr
21 ret void
22 }
23 ; TODO...
24
25 define void @ptr_with_addend(i32 %ptr) {
26 %add = add i32 %ptr, 1234
27 %add.p = inttoptr i32 %add to i32*
28 %val = load i32* %add.p
29 ret void
30 }
31 ; CHECK: define void @ptr_with_addend(i32 %ptr) {
32 ; CHECK-NEXT: %mem_base = load i64* @__sfi_memory_base
33 ; CHECK-NEXT: %add = add i32 %ptr, 1234
34 ; CHECK-NEXT: %add.p = inttoptr i32 %add to i32*
35 ; CHECK-NEXT: %1 = zext i32 %ptr to i64
36 ; CHECK-NEXT: %2 = add i64 %mem_base, %1
37 ; CHECK-NEXT: %3 = add i64 %2, 1234
38 ; CHECK-NEXT: %4 = inttoptr i64 %3 to i32*
39 ; CHECK-NEXT: %val = load i32* %4
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/sandbox-indirect-calls.ll ('k') | test/Transforms/NaCl/strip-tls.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698