Fix _d_invariant mangling on MinGW/Win32.

This is getting uglier and uglier, should probably just switch back
to extern(C) irrespective of what upstream DMD does.
This commit is contained in:
David Nadlinger 2013-09-15 19:48:08 +02:00
parent 286770ed7b
commit 3556f52b95
2 changed files with 9 additions and 4 deletions

View file

@ -915,12 +915,15 @@ static void LLVM_D_BuildRuntimeModule()
// KLUDGE: _d_invariant is actually extern(D) in the upstream runtime, possibly
// for more efficient parameter passing on x86. This complicates our code here
// quite a bit, though.
llvm::StringRef fname("_D9invariant12_d_invariantFC6ObjectZv");
Parameters* params = new Parameters();
params->push(new Parameter(STCin, ClassDeclaration::object->type, NULL, NULL));
TypeFunction* dty = new TypeFunction(params, Type::tvoid, 0, LINKd);
llvm::Function* fn = llvm::Function::Create(llvm::cast<llvm::FunctionType>(DtoType(dty)),
llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function* fn = llvm::Function::Create(
llvm::cast<llvm::FunctionType>(DtoType(dty)),
llvm::GlobalValue::ExternalLinkage,
gABI->mangleForLLVM("_D9invariant12_d_invariantFC6ObjectZv", LINKd),
M
);
gABI->newFunctionType(dty);
gABI->rewriteFunctionType(dty);
gABI->doneWithFunctionType();