diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-19 15:25:12 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-19 15:25:12 -0700 |
commit | bdfbe91f5f6db852e3e91d6830a82b323c4dd846 (patch) | |
tree | 5aef741c85c6456f0b2081c02ead0897700f7b61 /lib | |
parent | 9c3c7b3130bc72b3f50703c11b85152b1264fc90 (diff) |
Use ARM-style representation for C++ method pointers under PNaCl
This avoids baking into pexes an assumption that function pointers are
0 mod 2, which might not be the case in future sandboxing models.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3450
TEST=run_method_pointer_repr_test in NaCl + llvm-lit test
Review URL: https://codereview.chromium.org/17419005
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/ItaniumCXXABI.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 7b1d8098aa..827f1a20b6 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -203,6 +203,14 @@ CodeGen::CGCXXABI *CodeGen::CreateItaniumCXXABI(CodeGenModule &CGM) { return new ItaniumCXXABI(CGM, /*IsARM = */ true); case TargetCXXABI::GenericItanium: + if (CGM.getContext().getTargetInfo().getTriple().getArch() + == llvm::Triple::le32) { + // For PNaCl, use ARM-style method pointers so that PNaCl code + // does not assume anything about the alignment of function + // pointers. Using IsARM=true also makes guard variables 32-bit + // instead of 64-bit, which saves a little space. + return new ItaniumCXXABI(CGM, /*IsARM = */ true); + } return new ItaniumCXXABI(CGM); case TargetCXXABI::Microsoft: |