aboutsummaryrefslogtreecommitdiff
path: root/test/NaCl
diff options
context:
space:
mode:
authorJan Voung <jvoung@chromium.org>2013-05-07 16:01:21 -0700
committerJan Voung <jvoung@chromium.org>2013-05-07 16:01:21 -0700
commit77cc10ffb869891e7eff5a5fa1be4437c3360cf8 (patch)
tree95e8622b2b1395289d4cf6cb410db47ba8e65afe /test/NaCl
parenta4c38e64aa4f485e3caff72dc01cb794ed99af20 (diff)
Start a whitelist of intrinsics for the PNaCl ABI checker.
This list is currently too small to support our tests (scons, gcc, llvm). To prevent the tests from breaking, there is a -pnaclabi-allow-intrinsics flag which defaults to true. To turn on the checking for real, set -pnaclabi-allow-intrinsics=0. We will avoid actually using the -pnaclabi-allow-intrinsics flags in tests, and try to just stick with the -pnacl-disable-abi-check flag. Remove this flag soon. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 R=eliben@chromium.org Review URL: https://codereview.chromium.org/14670017
Diffstat (limited to 'test/NaCl')
-rw-r--r--test/NaCl/PNaClABI/intrinsics.ll62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/NaCl/PNaClABI/intrinsics.ll b/test/NaCl/PNaClABI/intrinsics.ll
new file mode 100644
index 0000000000..83c0c69bb5
--- /dev/null
+++ b/test/NaCl/PNaClABI/intrinsics.ll
@@ -0,0 +1,62 @@
+; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=0 < %s | FileCheck %s
+; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=0 \
+; RUN: -pnaclabi-allow-debug-metadata < %s | FileCheck %s --check-prefix=DBG
+; RUN: pnacl-abicheck -pnaclabi-allow-dev-intrinsics=1 < %s | \
+; RUN: FileCheck %s --check-prefix=DEV
+
+; Test that only white-listed intrinsics are allowed.
+
+; ===================================
+; Some disallowed "Dev" intrinsics.
+; CHECK: Function llvm.dbg.value is a disallowed LLVM intrinsic
+; DBG-NOT: Function llvm.dbg.value is a disallowed LLVM intrinsic
+; DEV-NOT: Function llvm.dbg.value is a disallowed LLVM intrinsic
+declare void @llvm.dbg.value(metadata, i64, metadata)
+
+; CHECK: Function llvm.frameaddress is a disallowed LLVM intrinsic
+; DEV-NOT: Function llvm.frameaddress is a disallowed LLVM intrinsic
+declare i8* @llvm.frameaddress(i32 %level)
+
+; CHECK: Function llvm.returnaddress is a disallowed LLVM intrinsic
+; DEV-NOT: Function llvm.returnaddress is a disallowed LLVM intrinsic
+declare i8* @llvm.returnaddress(i32 %level)
+
+; ===================================
+; Always allowed intrinsics.
+; CHECK-NOT: Function llvm.lifetime.start is a disallowed LLVM intrinsic
+; DBG-NOT: Function llvm.lifetime.start is a disallowed LLVM intrinsic
+; DEV-NOT: Function llvm.lifetime.start is a disallowed LLVM intrinsic
+declare void @llvm.lifetime.start(i64, i8* nocapture)
+
+; CHECK-NOT: Function llvm.lifetime.start is a disallowed LLVM intrinsic
+declare void @llvm.lifetime.end(i64, i8* nocapture)
+; CHECK-NOT: Function llvm.memcpy.p0i8.p0i8.i32 is a disallowed LLVM intrinsic
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src,
+ i32 %len, i32 %align, i1 %isvolatile)
+; CHECK-NOT: Function llvm.memcpy.p0i8.p0i8.i64 is a disallowed LLVM intrinsic
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest, i8* %src,
+ i64 %len, i32 %align, i1 %isvolatile)
+; CHECK-NOT: Function llvm.nacl.read.tp is a disallowed LLVM intrinsic
+declare i8* @llvm.nacl.read.tp()
+
+; ===================================
+; Always disallowed intrinsics.
+; CHECK: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
+; DBG: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
+; DEV: Function llvm.adjust.trampoline is a disallowed LLVM intrinsic
+declare i8* @llvm.adjust.trampoline(i8*)
+
+; CHECK: Function llvm.init.trampoline is a disallowed LLVM intrinsic
+; DBG: Function llvm.init.trampoline is a disallowed LLVM intrinsic
+; DEV: Function llvm.init.trampoline is a disallowed LLVM intrinsic
+declare void @llvm.init.trampoline(i8*, i8*, i8*)
+
+; CHECK: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
+; DBG: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
+; DEV: Function llvm.x86.aesni.aeskeygenassist is a disallowed LLVM intrinsic
+declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8)
+
+; CHECK: Function llvm.va_copy is a disallowed LLVM intrinsic
+; DBG: Function llvm.va_copy is a disallowed LLVM intrinsic
+; DEV: Function llvm.va_copy is a disallowed LLVM intrinsic
+declare void @llvm.va_copy(i8*, i8*)