-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-driverArea: rustc_driver that ties everything together into the `rustc` compilerArea: rustc_driver that ties everything together into the `rustc` compilerA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesO-windowsOperating system: WindowsOperating system: Windows
Metadata
Metadata
Assignees
Labels
A-driverArea: rustc_driver that ties everything together into the `rustc` compilerArea: rustc_driver that ties everything together into the `rustc` compilerA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesO-windowsOperating system: WindowsOperating system: Windows
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
kyonifer commentedon Feb 16, 2012
This issue is very relevant if rust eventually allows linking with C code (i.e. issue #1850). Although in theory the MinGW C toolchain is ABI compatible with MSVC, in practice this isn't the case and will cause things to fail in subtle and mysterious ways, especially as code size gets large. Sorry for the long list of examples that follows, but I wanted to illustrate the issues I've had with MinGW/MSVC interop.
Certainly this last issue applies to any code compiled with incompatible version of a compiler (i.e. VS2005/VS2010), however the issue is that mingw links with such an outdated version of MSVC that it is not useful for new code being compiled today. I've seen activity in the MinGW mailing list about working with msvcr100.dll, so this may disappear soon. However, it still stands that using static/shared libs built with the MS toolchain with MinGWs toolchain is somewhere between a lot of hassle and impossible. This hassle would be saved if compiling .c code (e.g. #1850) was done with MSVC, and then linked with the rustc objects generated by llvm.
Note that I have very little experience with llvm, so i'm not sure how compatible LLVM's ABI (used for rust objects) is with MSVC. I know that it is possible to be compatible though, as Intel's compiler (icc) does just fine importing .lib/.def/.dll's built with MSVC. If llvm is anywhere near as compatible as icc with with cl.exe/link.exe then rustc would inherit those advantages.
fithisux commentedon Mar 13, 2012
I would like to comment on the random assumption that mingw is "a pretty rare toolchain on windows".
Facts :
equation.com maintains a mingw toolchain for scilab
mingw-w64 makes adjustments and improvements
google go can be compiled with mingw
ReactOS uses a mingw environment
numerous FOSS projects embrace mingw
prove that the comment is invalid. For my work mingw is vital while rust is not. However mingw gives me an opportunity to explore rust and consider it for future products. The fact that Mozilla embraces Visual Studio does not prove that VS is necessarily the only option. Chromium is a counterexample. The lack of interoperability of mingw with VS is also something that I do not personally consider a big issue.
Mingw is interoperable with many scripting languages, many full fledged languages like FreePascal/Mono/D and Go. In this respect I would like to ask you to maintain mingw along with VS or keep mingw and add clang+mingw libs.
Blei commentedon Jun 12, 2013
Problem: jemalloc requires mingw.
jdm commentedon Jun 12, 2013
Firefox uses jemalloc on Windows with MSVC: http://glandium.org/blog/?p=2581
thestinger commentedon Jun 12, 2013
jemalloc definitely supports MSVC, but I don't think it supports acting as a drop-in malloc/free replacement for the entire process. I think you have to compile it with the
je_
prefix and switch the calls to that, so we would lose LLVM's hardcoded optimizations for malloc/free but not much else.Aatch commentedon Jun 12, 2013
@thestinger it's actually not as hard coded as it seems. There's just a list of library calls and some information about them as a function pass. We should be able to extend it to provide the appropriate data to let LLVM do the optimizations for je_ prefixed versions same as the regular calls.
thestinger commentedon Jun 12, 2013
@Aatch: there's more than just that - there are specific optimizations related to
free
andmalloc
http://llvm.org/docs/doxygen/html/InstructionCombining_8cpp_source.html#l01378
http://llvm.org/docs/doxygen/html/Local_8cpp_source.html#l00269
13 remaining items