-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native Apple Silicon (M1) Support #5
Comments
Right you are, I’m not going to be able to do that anytime soon so
hopefully somebody else will take a swing at an M1 implementation for
variadic.
|
I tried doing it but am not familiar with the internal information or arm/x86 assembly but looks fun to learn. I might give it another go, no guarantees |
Hi, I m running on Mac m1 and get the following error when I make the pomodoro example (main, 8d2ca95):
I do not understand how this compile error is m1 related... |
@stephanwesten It has to do with build constraints and the fact that |
missing files from build constraints for diff platforms is part of it, but afaik the differences are minimal. the real missing piece is the implementation of the workaround in |
@dolmen awesome, thank you for making it easy to find from here |
|
see also https://gist.github.com/progrium/b286cd8c82ce0825b2eb3b0b3a0720a0 but these are workarounds. |
I'm currently working on setting things up with Rosetta as described, but maybe I'll get a chance to come back to this later. Some Apple docs that are likely to be useful: |
yep yep. remember go has no problem compiling to arm64 already, but the variadic package that every call in this library depends on needs to have an arm64 implementation since it drops into assembly. and it doesn't do much! all it's doing is making an alternative way to do a function call. |
(making note of a few more findings) It looks like it's not just For ARM, this describes the process for initializing the registers & memory to pass parameters to the procedure: The Apple docs here about calling So, the way
So, this does NOT use the conventional C-style "variadic" parameter passing where you use Per Apple:
|
In #52 I've added code that could be used to reimplement The other part is IIUC we can use that hook to create objects that instead of registering each method directly, call a common CGo implementation for A couple of the files (e.g. |
Can somebody write current status of this problem? |
its being solved mostly by way of code generation which is pretty close
On Fri, Sep 17, 2021 at 7:52 AM Vasiliy Tolstov ***@***.***> wrote:
Can somebody write current status of this problem?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAFBZC5LEN4ASVMVCKIE3UCM2XXANCNFSM4V3V2VJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Jeff Lindsay
http://progrium.com
|
very nice, last question - when ? =) |
There's no set timeline for this. For now your best bet is still to install an I'm working on the generator, which will expand the breadth of APIs included, and reduces the dependencies on the dynamic I'm not aware of anyone looking into File Provider support for macdriver yet, but it would be interesting. |
thank you |
Build scripts can go back to normal once macdriver adds M1 support: progrium/darwinkit#5
Pull request #100 by mkrautz adds basic arm64 support. Thank you mkrautz, this is wonderful. |
@sparkylein You're welcome. Have you tried it? Does it work to your liking? |
@mkrautz I only tried to create a minimalistic window which worked. However, it's strange that it works, because here https://github.com/below/HelloSilicon#listing-9-1 it is said that for variadic functions Apple silicon diverges from the ARM64 standard ABI. Where Linux will accept arguments passed in the registers, for Darwin the arguments must be passed on the stack. I'm not an assembly coder myself, so I don't know why what you did works... |
It works because on darwin/arm64, Apple redefined objc_msgSend to use the regular calling convention. objc_msgSend is defined as (void)objc_msgSend(void) in the headers, and if you must call it directly, you cast it to have the signature you require. That way, the compiler generates a non-variadic call, which objc_msgSend on arm64 requires. That's also why the package name 'variadic' is a bit misleading with the new PR. Perhaps a better name would be 'objcffi'. |
Interesting. Thanks for the info. |
I guess just to clarify now that this is based on the https://github.com/hsiafan/cocoa package mentioned, it's using |
The project doesn't build on apple silicone yet, i think it's mainly because of the lack of assembly files.
The text was updated successfully, but these errors were encountered: