mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
[svn r306] Fixed: it's now possible to compile and link llvmdc with MinGW32 and msys on Win32 :D I tried it myself ;) Building the runtime still needs some work, but it's a step in the right direction.
This commit is contained in:
parent
f8b421d4ac
commit
5647598da9
11 changed files with 38 additions and 18 deletions
|
@ -13,7 +13,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER || __MINGW32__
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
extern "C" char * __cdecl __locale_decpoint;
|
extern "C" char * __cdecl __locale_decpoint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __MINGW32__
|
||||||
|
#ifndef isnan
|
||||||
|
#define isnan _isnan
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IN_GCC
|
#if IN_GCC
|
||||||
// Issues with using -include total.h (defines integer_t) and then complex.h fails...
|
// Issues with using -include total.h (defines integer_t) and then complex.h fails...
|
||||||
#undef integer_t
|
#undef integer_t
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
#include "root.h"
|
#include "root.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG 0
|
#define LOG 0
|
||||||
|
|
||||||
char *skipspace(const char *p);
|
char *skipspace(const char *p);
|
||||||
|
|
|
@ -328,8 +328,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
inifile(argv[0], "llvmdc.ini");
|
inifile(argv[0], "llvmdc.ini");
|
||||||
#endif
|
#elif linux
|
||||||
#if linux
|
|
||||||
inifile(argv[0], "llvmdc.conf");
|
inifile(argv[0], "llvmdc.conf");
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if _MSC_VER || __MINGW32__
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#elif __DMC__
|
#elif __DMC__
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
#elif __MINGW32__
|
||||||
|
#include <malloc.h>
|
||||||
#else
|
#else
|
||||||
//#define signbit 56
|
//#define signbit 56
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +34,9 @@
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
static double zero = 0;
|
static double zero = 0;
|
||||||
|
#elif __MINGW32__
|
||||||
|
#include <math.h>
|
||||||
|
static double zero = 0;
|
||||||
#elif __GNUC__
|
#elif __GNUC__
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <bits/nan.h>
|
#include <bits/nan.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER ||__MINGW32__
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,18 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#if !IN_LLVM
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep);
|
long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "root.h"
|
#include "root.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include "stringtable.h"
|
#include "stringtable.h"
|
||||||
|
#include "mars.h"
|
||||||
|
#include "identifier.h"
|
||||||
#include "mtype.h"
|
#include "mtype.h"
|
||||||
#include "template.h"
|
#include "template.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
@ -31,9 +34,6 @@ long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep);
|
||||||
#include "aggregate.h"
|
#include "aggregate.h"
|
||||||
#include "declaration.h"
|
#include "declaration.h"
|
||||||
#include "dsymbol.h"
|
#include "dsymbol.h"
|
||||||
#include "mars.h"
|
|
||||||
#include "dsymbol.h"
|
|
||||||
#include "identifier.h"
|
|
||||||
#include "hdrgen.h"
|
#include "hdrgen.h"
|
||||||
|
|
||||||
#define LOG 0
|
#define LOG 0
|
||||||
|
@ -2944,9 +2944,11 @@ void TemplateInstance::semantic(Scope *sc)
|
||||||
//printf("isnested = %d, sc->parent = %s\n", isnested, sc->parent->toChars());
|
//printf("isnested = %d, sc->parent = %s\n", isnested, sc->parent->toChars());
|
||||||
sc2->parent = /*isnested ? sc->parent :*/ this;
|
sc2->parent = /*isnested ? sc->parent :*/ this;
|
||||||
|
|
||||||
|
#if !IN_LLVM
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < members->dim; i++)
|
for (int i = 0; i < members->dim; i++)
|
||||||
{
|
{
|
||||||
|
@ -2960,6 +2962,7 @@ void TemplateInstance::semantic(Scope *sc)
|
||||||
//printf("test4: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars());
|
//printf("test4: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars());
|
||||||
sc2->module->runDeferredSemantic();
|
sc2->module->runDeferredSemantic();
|
||||||
}
|
}
|
||||||
|
#if !IN_LLVM
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
}
|
}
|
||||||
__except (__ehfilter(GetExceptionInformation()))
|
__except (__ehfilter(GetExceptionInformation()))
|
||||||
|
@ -2968,6 +2971,7 @@ void TemplateInstance::semantic(Scope *sc)
|
||||||
error("recursive expansion");
|
error("recursive expansion");
|
||||||
fatal();
|
fatal();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If any of the instantiation members didn't get semantic() run
|
/* If any of the instantiation members didn't get semantic() run
|
||||||
|
|
|
@ -1388,10 +1388,10 @@ static LLConstant* build_class_dtor(ClassDeclaration* cd)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint build_classinfo_flags(ClassDeclaration* cd)
|
static unsigned build_classinfo_flags(ClassDeclaration* cd)
|
||||||
{
|
{
|
||||||
// adapted from original dmd code
|
// adapted from original dmd code
|
||||||
uint flags = 0;
|
unsigned flags = 0;
|
||||||
//flags |= isCOMclass(); // IUnknown
|
//flags |= isCOMclass(); // IUnknown
|
||||||
bool hasOffTi = false;
|
bool hasOffTi = false;
|
||||||
if (cd->ctor) flags |= 8;
|
if (cd->ctor) flags |= 8;
|
||||||
|
@ -1563,7 +1563,7 @@ void DtoDefineClassInfo(ClassDeclaration* cd)
|
||||||
c = defc->getOperand(9);
|
c = defc->getOperand(9);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint flags = build_classinfo_flags(cd);
|
unsigned flags = build_classinfo_flags(cd);
|
||||||
c = DtoConstUint(flags);
|
c = DtoConstUint(flags);
|
||||||
}
|
}
|
||||||
inits.push_back(c);
|
inits.push_back(c);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "gen/llvm.h"
|
#include "gen/llvm.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
|
#include "llvm/System/Path.h"
|
||||||
|
|
||||||
#include "declaration.h"
|
#include "declaration.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
@ -136,11 +137,8 @@ static LLGlobalVariable* dwarfCompileUnit(Module* m)
|
||||||
vals[2] = DtoConstUint(DW_LANG_C);// _D)); // doesn't seem to work
|
vals[2] = DtoConstUint(DW_LANG_C);// _D)); // doesn't seem to work
|
||||||
vals[3] = DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata");
|
vals[3] = DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata");
|
||||||
std::string srcpath(FileName::path(m->srcfile->name->toChars()));
|
std::string srcpath(FileName::path(m->srcfile->name->toChars()));
|
||||||
if (srcpath.empty()) {
|
if (srcpath.empty())
|
||||||
const char* str = get_current_dir_name();
|
srcpath = llvm::sys::Path::GetCurrentDirectory().toString();
|
||||||
assert(str != NULL);
|
|
||||||
srcpath = str;
|
|
||||||
}
|
|
||||||
vals[4] = DtoConstStringPtr(srcpath.c_str(), "llvm.metadata");
|
vals[4] = DtoConstStringPtr(srcpath.c_str(), "llvm.metadata");
|
||||||
vals[5] = DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata");
|
vals[5] = DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata");
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,11 @@ project.name = llvmdc
|
||||||
|
|
||||||
-- options
|
-- options
|
||||||
OPAQUE_VTBLS = 1
|
OPAQUE_VTBLS = 1
|
||||||
USE_BOEHM_GC = 1
|
if OS == "windows" then
|
||||||
|
USE_BOEHM_GC = 0
|
||||||
|
else
|
||||||
|
USE_BOEHM_GC = 1
|
||||||
|
end
|
||||||
|
|
||||||
-- idgen
|
-- idgen
|
||||||
package = newpackage()
|
package = newpackage()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue