# HG changeset patch # User Kelly Wilson # Date 1238458703 21600 # Node ID 204197eb9eb5f91db4dd7fc9d8d31e2cfb416872 # Parent f5729209a1d4a90ad887dc060897e4c35d651b17 Fix up some naked asm output for mingw32 diff -r f5729209a1d4 -r 204197eb9eb5 gen/naked.cpp --- a/gen/naked.cpp Tue Mar 31 01:18:35 2009 +0200 +++ b/gen/naked.cpp Mon Mar 30 18:18:23 2009 -0600 @@ -136,6 +136,38 @@ } // 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 @@ 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);