Some more fixups for mingw -- missing underscores

This commit is contained in:
Kelly Wilson
2009-04-02 17:27:53 -06:00
parent 04f3c61b97
commit 7a1052a2fc
3 changed files with 15 additions and 7 deletions

View File

@@ -2165,8 +2165,8 @@ namespace AsmParserx8632
{
use_star = false;
// simply write out the mangle
// on osx, prepend extra _
if ( global.params.os == OSMacOSX )
// on osx and mingw, prepend extra _
if ( global.params.os == OSMacOSX || global.params.os == OSWindows )
insnTemplate << "_";
insnTemplate << decl->mangle();
// addOperand2("${", ":c}", Arg_Pointer, e, asmcode);

View File

@@ -1656,7 +1656,7 @@ namespace AsmParserx8664
}
// osx needs an extra underscore
if ( global.params.os == OSMacOSX )
if ( global.params.os == OSMacOSX || global.params.os == OSWindows )
insnTemplate << "_";
// print out the mangle
@@ -2287,8 +2287,8 @@ namespace AsmParserx8664
{
use_star = false;
// simply write out the mangle
// on osx, prepend extra _
if ( global.params.os == OSMacOSX )
// on osx and windows, prepend extra _
if ( global.params.os == OSMacOSX || global.params.os == OSWindows )
insnTemplate << "_";
insnTemplate << decl->mangle();
// addOperand2("${", ":c}", Arg_Pointer, e, asmcode);

View File

@@ -144,7 +144,14 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
if (DtoIsTemplateInstance(fd))
{
linkage = "weak";
tmpstr << "section\t.gnu.linkonce.t." << mangle << ",\"ax\",@progbits";
tmpstr << "section\t.gnu.linkonce.t.";
if (global.params.os != OSWindows)
{
tmpstr << mangle << ",\"ax\",@progbits";
} else
{
tmpstr << "_" << mangle << ",\"ax\"";
}
section = tmpstr.str();
}
asmstr << "\t." << section << std::endl;
@@ -154,10 +161,11 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
{
std::string def = "def";
std::string endef = "endef";
asmstr << "\t." << def << "\t" << mangle << ";";
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;
asmstr << "_";
} else
{
asmstr << "\t." << linkage << "\t" << mangle << std::endl;