[PATCH] Use ARM-style representation for C++ method pointers under PNaCl

John McCall rjmccall at apple.com
Wed Jun 19 13:17:39 PDT 2013


On Jun 19, 2013, at 1:05 PM, Mark Seaborn <mseaborn at chromium.org> wrote:
> On 19 June 2013 13:01, Mark Seaborn <mseaborn at chromium.org> wrote:
> Use ARM-style representation for C++ method pointers under PNaCl
> 
> 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.
> 
> See: https://code.google.com/p/nativeclient/issues/detail?id=3450
> 
> Oops, I meant to send this to cfe-commits rather than llvm-commits.

I do not think you should just unconditionally opt in to random ARM
behavior.  In particular, ARM uses 32-bit guard variables because that's
the size of a pointer on ARM;  PNaCl needs to be able to efficiently
support 64-bit platforms as well.

Anyway, at the very least you should have your own subclass and
abstract out the behavior properly instead of setting an "IsARM" flag.
It's understood that the IsARM flag is not a good abstraction; we've
just been avoiding abstracting it further because you can't really
generalize from two data points.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130619/2d235ef1/attachment.html>


More information about the cfe-commits mailing list