Removed redundant global.params.os field.

I hope I have untangled the checks for "native" Windows (Triple::Win32)
vs. Windows/MinGW/Cygwin (Triple::isOSWindows) correctly.

MinGW needs some default libraries as well, has to be fixed later.
This commit is contained in:
David Nadlinger
2013-02-07 17:13:24 +01:00
parent 4e02f41f31
commit d4b391249d
15 changed files with 71 additions and 59 deletions

View File

@@ -154,17 +154,6 @@ enum OUTPUTFLAG
OUTPUTFLAGset // for -output
};
enum OS
{
OSinvalid = llvm::Triple::UnknownOS,
OSLinux = llvm::Triple::Linux,
OSHaiku = llvm::Triple::Haiku,
OSWindows = llvm::Triple::Win32,
OSMacOSX = llvm::Triple::MacOSX,
OSFreeBSD = llvm::Triple::FreeBSD,
OSSolaris = llvm::Triple::Solaris,
};
typedef unsigned char ubyte;
#endif
@@ -190,9 +179,7 @@ struct Param
#endif
char map; // generate linker .map file
bool is64bit; // generate 64 bit code
#if IN_LLVM
OS os;
#else
#if !IN_LLVM
char isLinux; // generate code for linux
char isOSX; // generate code for Mac OSX
char isWindows; // generate code for Windows

View File

@@ -357,7 +357,8 @@ void Module::buildTargetFiles(bool singleObj)
if(!objfile)
{
if (global.params.output_o)
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.params.os == OSWindows ? global.obj_ext_alt : global.obj_ext);
objfile = Module::buildFilePath(global.params.objname, global.params.objdir,
global.params.targetTriple.isOSWindows() ? global.obj_ext_alt : global.obj_ext);
else if (global.params.output_bc)
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext);
else if (global.params.output_ll)

View File

@@ -980,11 +980,18 @@ enum LINK Parser::parseLinkage()
}
else if (id == Id::System)
{
// LDC we configure target at runtime
if (global.params.os == OSWindows)
#if IN_LLVM
if (global.params.targetTriple.isOSWindows())
link = LINKwindows;
else
link = LINKc;
#else
#if _WIN32
link = LINKwindows;
else
#else
link = LINKc;
#endif
#endif
}
else
{

View File

@@ -44,9 +44,9 @@ int os_critsecsize()
// Return sizeof(RTL_CRITICAL_SECTION)
return global.params.is64bit ? 40 : 24;
#else
if (global.params.os == OSWindows)
if (global.params.targetTriple.isOSWindows())
return global.params.is64bit ? 40 : 24;
else if (global.params.os == OSFreeBSD)
else if (global.params.targetTriple.getOS() == llvm::Triple::FreeBSD)
return sizeof(size_t);
else
return sizeof(pthread_mutex_t);