[svn r327] Fixed some more MinGW32 issues. It's now very close to working.

Fixed problems with inline asm like: mov EAX, FS:4 , which incidentally is used in the runtime to get the stack bottom, on Windows.
This commit is contained in:
Tomas Lindquist Olsen 2008-06-27 23:58:22 +02:00
parent 03d26e1178
commit a3c7b8b369
7 changed files with 28 additions and 15 deletions

View file

@ -1,6 +1,9 @@
#include "gen/llvm.h"
#include "llvm/Linker.h"
#include "llvm/System/Program.h"
#if _WIN32
#include "llvm/Support/SystemUtils.h"
#endif
#include "root.h"
#include "mars.h"
@ -35,7 +38,7 @@ void linkModules(llvm::Module* dst, const Module_vector& MV)
static llvm::sys::Path gExePath;
int linkExecutable()
int linkExecutable(const char* argv0)
{
Logger::println("*** Linking executable ***");
@ -43,11 +46,10 @@ int linkExecutable()
std::string errstr;
// find the llvm-ld program
llvm::sys::Path ldpath = llvm::sys::Program::FindProgramByName("llvm-ld");
llvm::sys::Path ldpath = llvm::sys::Program::FindProgramByName("llvm-ld");
if (ldpath.isEmpty())
{
error("linker program not found");
fatal();
ldpath.set("llvm-ld");
}
// build arguments
@ -83,12 +85,15 @@ int linkExecutable()
// create path to exe
llvm::sys::Path exedir(gExePath);
exedir.set(gExePath.getDirname());
exedir.createDirectoryOnDisk(true, &errstr);
if (!errstr.empty())
if (!exedir.exists())
{
error("failed to create path to linking output\n%s", errstr.c_str());
fatal();
}
exedir.createDirectoryOnDisk(true, &errstr);
if (!errstr.empty())
{
error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str());
fatal();
}
}
// strip debug info
if (!global.params.symdebug)