mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Fix MinGW names for naked functions.
This commit is contained in:
@@ -151,20 +151,21 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string fullMangle;
|
||||
if (global.params.targetTriple.getOS() == llvm::Triple::MinGW32)
|
||||
{
|
||||
fullMangle = "_";
|
||||
}
|
||||
fullMangle += mangle;
|
||||
|
||||
const char* linkage = "globl";
|
||||
std::string section = "text";
|
||||
if (DtoIsTemplateInstance(fd))
|
||||
{
|
||||
linkage = "weak";
|
||||
tmpstr << "section\t.gnu.linkonce.t.";
|
||||
if (isWin)
|
||||
{
|
||||
tmpstr << "_" << mangle << ",\"ax\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpstr << mangle << ",\"ax\",@progbits";
|
||||
}
|
||||
tmpstr << "section\t.gnu.linkonce.t." << fullMangle << ",\"ax\"";
|
||||
if (!isWin)
|
||||
tmpstr << ",@progbits";
|
||||
section = tmpstr.str();
|
||||
}
|
||||
asmstr << "\t." << section << std::endl;
|
||||
@@ -172,18 +173,18 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
||||
|
||||
if (isWin)
|
||||
{
|
||||
asmstr << "\t.def\t" << mangle << ";";
|
||||
asmstr << "\t.def\t" << fullMangle << ";";
|
||||
// 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 << "\t.type\t" << fullMangle << ",@function" << std::endl;
|
||||
}
|
||||
|
||||
asmstr << mangle << ":" << std::endl;
|
||||
asmstr << "\t." << linkage << "\t" << fullMangle << std::endl;
|
||||
asmstr << fullMangle << ":" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user