]> granicus.if.org Git - clang/commit
Use ARM-style representation for C++ method pointers under PNaCl/Emscripten
authorMark Seaborn <mseaborn@chromium.org>
Wed, 24 Jul 2013 16:25:13 +0000 (16:25 +0000)
committerMark Seaborn <mseaborn@chromium.org>
Wed, 24 Jul 2013 16:25:13 +0000 (16:25 +0000)
commit21fe45076c371e9a9f27e15c4e068e77a185fe62
tree461c6162cb1f9262f1af80be1cd94a7e65847dc1
parent4c7736ec76fb35fe83eb4144137cf14df1c6d056
Use ARM-style representation for C++ method pointers under PNaCl/Emscripten

Before this change, Clang uses the x86 representation for C++ method
pointers when generating code for PNaCl.  However, the resulting code
will assume that function pointers are 0 mod 2.  This assumption is
not safe for PNaCl, where function pointers could have any value
(especially in future sandboxing models).

So, switch to using the ARM representation for PNaCl code, which makes
no assumptions about the alignment of function pointers.

Since we're changing the "le32" target, this change also applies to
Emscripten.  The change is beneficial for Emscripten too.  Emscripten
has a workaround to make function pointers 0 mod 2.  This change would
allow the workaround to be removed.

See: https://code.google.com/p/nativeclient/issues/detail?id=3450

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187051 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ItaniumCXXABI.cpp
test/CodeGenCXX/member-function-pointers.cpp
test/CodeGenCXX/static-init-pnacl.cpp [new file with mode: 0644]