mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Fix ABI on Win32.
We can't simply use the C calling convention, as the D(MD) ABI is callee-pop, and this is hardcoded in naked functions with stack parameters. The \1 "trick" is normally used to avoid prefixes added by LLVM; on the 3.2 release, a patch is needed to make it work for the @<n> stdcall suffixes as well.
This commit is contained in:
parent
e05a5c6f22
commit
2d3de4a3d4
4 changed files with 65 additions and 28 deletions
|
@ -74,15 +74,18 @@ static llvm::Function* build_module_function(const std::string &name, const std:
|
|||
|
||||
std::vector<LLType*> argsTy;
|
||||
LLFunctionType* fnTy = LLFunctionType::get(LLType::getVoidTy(gIR->context()),argsTy,false);
|
||||
assert(gIR->module->getFunction(name) == NULL);
|
||||
llvm::Function* fn = llvm::Function::Create(fnTy, llvm::GlobalValue::InternalLinkage, name, gIR->module);
|
||||
|
||||
std::string const symbolName = gABI->mangleForLLVM(name, LINKd);
|
||||
assert(gIR->module->getFunction(symbolName) == NULL);
|
||||
llvm::Function* fn = llvm::Function::Create(fnTy,
|
||||
llvm::GlobalValue::InternalLinkage, symbolName, gIR->module);
|
||||
fn->setCallingConv(gABI->callingConv(LINKd));
|
||||
|
||||
llvm::BasicBlock* bb = llvm::BasicBlock::Create(gIR->context(), "entry", fn);
|
||||
IRBuilder<> builder(bb);
|
||||
|
||||
// debug info
|
||||
DtoDwarfSubProgramInternal(name.c_str(), name.c_str());
|
||||
DtoDwarfSubProgramInternal(name.c_str(), symbolName.c_str());
|
||||
|
||||
// Call ctor's
|
||||
typedef std::list<FuncDeclaration*>::const_iterator FuncIterator;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue