-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Direct x64 machine code generation - considerations for implementation for macOS and Windows #5374
Comments
Here are some resources for MacOS Mach-O format and assembler: Something about statically compiled binaries: https://developer.apple.com/library/archive/qa/qa1118/_index.html
Probably it also means that fully statically compiled binary won't be accepted to App Store (you cannot use direct syscalls), and is not backward or forward-compatible, so these are huge downsides. Also statically compiled crt0.o is not enough, you also need statically compiled libSystem which simply isn't currently available. So probably it means we need to live with it and figure out how to link system libraries (at least System) with V compiler. So the proper way to compile assembly that uses libc calls (libSystem) to binary on MacOS is:
There are some interesting facts when it comes to linking when you read source of go-lang linker: https://golang.org/src/cmd/link/internal/ld/macho.go For example some offsets need to be maintained for code signing to be working |
Due to Apple's stance on static bins, could parts of Darling (GitHub & other associated repos) be used to help accomplish this? |
Linux is one of the few systems that has a stable syscall interface. On all other systems you must use the system libraries to interface with the kernel. For macOS cross compilation there seems to be https://github.com/tpoechtrager/osxcross. For Windows cross compilation you can use mingw. |
Exactly. V is going to be able to generate dynamically linked binaries. For now it's Linux/static only. |
For Windows @nord501 noted that it should be pe.v and asks whether or not we should use kernel32 or ntdll.lib... |
@nord501 is putting forth a valiant and successful effort with Windows implementation and noted this last night that he now has a working |
macOS 11 (Big Sur) updates: https://gist.github.com/FiloSottile/7125822#gistcomment-3578065 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
As we all know, x64 code generation is currently only available for Linux. The purpose of this issue is to track, discuss and collaborate on efforts to get this also implemented for macOS and Windows (or to branch out into other issues to get more specific for each).
The text was updated successfully, but these errors were encountered: