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

@@ -220,32 +220,30 @@ int linkObjToBinaryGcc(bool sharedLib)
// default libs
bool addSoname = false;
switch(global.params.os) {
case OSLinux:
switch (global.params.targetTriple.getOS()) {
case llvm::Triple::Linux:
addSoname = true;
args.push_back("-lrt");
// fallthrough
case OSMacOSX:
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
args.push_back("-ldl");
// fallthrough
case OSFreeBSD:
case llvm::Triple::FreeBSD:
addSoname = true;
args.push_back("-lpthread");
args.push_back("-lm");
break;
case OSSolaris:
case llvm::Triple::Solaris:
args.push_back("-lm");
args.push_back("-lumem");
// solaris TODO
break;
case OSWindows:
// FIXME: I'd assume kernel32 etc
break;
default:
// OS not yet handled, will probably lead to linker errors.
// FIXME: Win32, MinGW.
break;
}

View File

@@ -590,7 +590,6 @@ int main(int argc, char** argv)
// Starting with LLVM 3.1 we could also use global.params.targetTriple.isArch64Bit();
global.params.is64bit = gDataLayout->getPointerSizeInBits(ADDRESS_SPACE) == 64;
global.params.os = static_cast<OS>(global.params.targetTriple.getOS());
switch (global.params.targetTriple.getArch())
{
@@ -681,7 +680,6 @@ int main(int argc, char** argv)
VersionCondition::addPredefinedGlobalIdent(global.params.is64bit ? "Win64" : "Win32");
break;
case llvm::Triple::MinGW32:
global.params.os = OSWindows; // FIXME: Check source for uses of MinGW32
VersionCondition::addPredefinedGlobalIdent("Windows");
VersionCondition::addPredefinedGlobalIdent(global.params.is64bit ? "Win64" : "Win32");
VersionCondition::addPredefinedGlobalIdent("mingw32"); // For backwards compatibility.
@@ -701,7 +699,6 @@ int main(int argc, char** argv)
VersionCondition::addPredefinedGlobalIdent("Posix");
break;
case llvm::Triple::Darwin:
global.params.os = OSMacOSX;
VersionCondition::addPredefinedGlobalIdent("OSX");
VersionCondition::addPredefinedGlobalIdent("darwin"); // For backwards compatibility.
VersionCondition::addPredefinedGlobalIdent("Posix");
@@ -746,7 +743,7 @@ int main(int argc, char** argv)
#undef XSTR
#undef STR
if (global.params.os == OSWindows) {
if (global.params.targetTriple.isOSWindows()) {
global.dll_ext = "dll";
global.lib_ext = "lib";
} else {