aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-09-04 12:50:46 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-09-04 12:50:46 -0700
commitf8ea6b0a1ed535c10089d53c93f32cfe0117c812 (patch)
treed4547468cda1900dd2e8fbb553bb3e0842bdc68b /lib
parenteb10318143cc0045a053a1973e4aeaf246e53984 (diff)
PNaCl bitcode reader: Disallow pointer-typed arguments in indirect calls
Make the bitcode reader stricter, so that it disallows pointer arguments in indirect function calls, which are disallowed by the PNaCl ABI checker. Pointer arguments in function calls are only allowed in intrinsic calls, and calls to intrinsics must always be direct calls, not indirect calls. This involves removing two tests that specifically test for pointer args. This is in preparation for tweaking how indirect calls are represented, so that they store the call's return type rather than the function type. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544 TEST=*.ll tests Review URL: https://codereview.chromium.org/23660005
Diffstat (limited to 'lib')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
index 1e524db3de..bff4afb0c3 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
@@ -1643,6 +1643,10 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) {
Value *Arg;
if (popValue(Record, &OpNum, NextValueNo, &Arg))
Error("Invalid argument in CALL record");
+ if (BitCode == naclbitc::FUNC_CODE_INST_CALL_INDIRECT &&
+ FTy->getParamType(Index)->isPointerTy()) {
+ return Error("Pointer arguments not allowed for indirect calls");
+ }
Arg = ConvertOpToType(Arg, FTy->getParamType(Index), CurBBNo);
Args.push_back(Arg);
}