[LLVMdev] Adding integer field to all C++ classes in LLVM

Reid Kleckner rnk at google.com
Fri Jul 17 08:13:01 PDT 2015


Clang is the code responsible for layout decisions, so LLVM is too late for
this. Clang lowers sizeof, for example. If you want to change layout, see
record layout builder in clang.

Sent from phone
On Jul 16, 2015 2:39 PM, "Mohit Mishra" <mmishra23 at gmail.com> wrote:

> HI Mats,
>
> Thanks for getting back to me.
>
>
> I take it you mean that you want to add a field to all classes COMPILED
>> by LLVM, and not all classes that LLVM consists of?
>>
> YES!
>
>>
>> Also, unless I'm terribly misinformed, adding something to an ArrayRef is
>> not going to work. ArrayRef, StringRef and such are "references to the
>> original data in the calling code", which means you have no right to modify
>> it.
>>
>
>  What I want is to be able to randomize object layout; and hence adding of
> integer fields to the classes might be a good option. While I did think so
> about ArrayRef, I thought about to substitute that with vector something
> like this:
> vector<Type*> vecType = Elements.vec ();
> vecType.insert (Type::getInt32Ty (Context))
> ST->setBody(vecType, isPacked);
>
> and modify the setBody function parameters replacing ArrayRef with the
> vector. However, I'm still skeptical about this.
>
> What do you propose to have a  fairly good object layout randomization?
>
> Best,
> Mohit.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/34ff0b55/attachment.html>


More information about the llvm-dev mailing list