-
Notifications
You must be signed in to change notification settings - Fork 114
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
Windows LLVM build (was 'Windows C codegen') #113
Comments
Just noticed that there is a lot of progress in the For refence:
Have you found any problems using that? I also see that you already tested the |
The I've committed/pushed a few fixes today, addressing some minor bugs that were causing crashes and compilation failures, but neither rustc nor cargo are fully building yet (mostly because my windows machine doesn't have LLVM or many of the libraries used by cargo) |
I got past the libs. The problem is with the more complicated C files generated by rustc. Check my first message in the issue for reference of the bugs you might find later with the codegen. I'm pasting the scripts I used for building LLVM on Monday. |
For building LLVM:
LLVM_CONFIG environment variable then must point to llvm-config in the installed path. |
Hi,
I'm hacking on mrustc to make it build the Windows version of rustc. I got it pretty far to the point I compiled all the libraries and rustc is the only missing part. Patches incoming soon.
The part where I got stuck is the C code being emmitted is not appropiate for VC++. And the problem is I'm not sure how to fix it. I'm writing down what I found.
For function alias in GCC,
mrustc
emitsasm(link_name)
attributes. For MSVC, the current approach is creating the functions with the right symbol mangling calling into the original function:This works when the function are declared in the headers. Otherwise they are declared implicitally.
The problem is the compiler will default to
int
whenever the types are implicit. This creates a conflict when the arguments and return types expected have other size. As a result, it ends in a compiler error. A basic example is that pointers are bigger than ints.My hack has been declaring the external function before calling it from the one with the other name. This results in something like this:
The problem with this approach is that we end up re-declaring functions already imported by the headers and sometimes they have conflicting types leading to errors. I'm not aware of a way to detect which functions are declared already to prevent re-declaring them.
The most similar thing to the
asm attribute
that VC++ supports is#pragma comment(linker, "/alternatename:__a=a")
as used here. I haven't tried it yet but it's next in my list.What do you think? Do you have any other ideas? I'm not super familiar with mrustc source code so I might be missing a better approach.
The text was updated successfully, but these errors were encountered: