mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43:14 +01:00
Fix up some naked asm output for mingw32
This commit is contained in:
@@ -136,6 +136,38 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
||||
}
|
||||
// this works on linux x86 32 and 64 bit
|
||||
// assume it works everywhere else as well for now
|
||||
// this needed a slight modification for Win
|
||||
else
|
||||
{
|
||||
const char* linkage = "globl";
|
||||
std::string section = "text";
|
||||
if (DtoIsTemplateInstance(fd))
|
||||
{
|
||||
linkage = "weak";
|
||||
tmpstr << "section\t.gnu.linkonce.t." << mangle << ",\"ax\",@progbits";
|
||||
section = tmpstr.str();
|
||||
}
|
||||
asmstr << "\t." << section << std::endl;
|
||||
asmstr << "\t.align\t16" << std::endl;
|
||||
|
||||
if (global.params.os == OSWindows)
|
||||
{
|
||||
std::string def = "def";
|
||||
std::string endef = "endef";
|
||||
asmstr << "\t." << def << "\t" << mangle << ";";
|
||||
// hard code these two numbers for now since gas ignores .scl and llvm
|
||||
// is defaulting to .type 32 for everything I have seen
|
||||
asmstr << "\t.scl 2; .type 32;\t" << "." << endef << std::endl;
|
||||
} else
|
||||
{
|
||||
asmstr << "\t." << linkage << "\t" << mangle << std::endl;
|
||||
asmstr << "\t.type\t" << mangle << ",@function" << std::endl;
|
||||
}
|
||||
|
||||
asmstr << mangle << ":" << std::endl;
|
||||
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
const char* linkage = "globl";
|
||||
@@ -151,7 +183,7 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
||||
asmstr << "\t." << linkage << "\t" << mangle << std::endl;
|
||||
asmstr << "\t.type\t" << mangle << ",@function" << std::endl;
|
||||
asmstr << mangle << ":" << std::endl;
|
||||
}
|
||||
}*/
|
||||
|
||||
// emit body
|
||||
fd->fbody->toNakedIR(gIR);
|
||||
|
||||
Reference in New Issue
Block a user