[llvm-dev] Is it possible to execute Objective-C code via LLVM JIT?

Stanislav Pankevich via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 12 14:31:58 PST 2018

Hi all,

> I actually looked into this recently. It is possible, but takes some non-trivial effort right now: You have to hook into the JIT memory allocator, parse the objective C metadata sections in the object file, then call the objective C runtime to register any newly added classes, protocols and selectors.
> I can't release my code as-is: I built it against a hacked up copy of the runtime. The right way to do this would be to write parsers for the objective C metadata, and an Objective-C registration call that uses the parsers and calls the runtime. These should be made available conditionally if the objective C runtime headers are available. This is something that I'd like to get to eventually, but I have a long to-do list. If you or anyone you know is interested in working on it I'd be happy to provide pointers and code review.

Has any progress been made on this issue since 1 year ago?

Lang, I have spent some time trying to follow your hints along the
lines quoted above and found that it is indeed a non-trivial effort to
implement all of this. Specifically I explored the latest objc4-723
from Apple Open Source and it looks like all of the APIs that allow
the registration of Objective-C classes, selectors, etc. are all very

One year ago you said you could help anyone interested in working on
this. Let me check here again as a volunteer (if this work can ever be
accomplished by someone outside Apple).

[cutting the rest of the thread to reduce the size of the email]



More information about the llvm-dev mailing list