comparison gen/naked.cpp @ 1190:ea7b8b6c96c0

Some more fixups for mingw -- missing underscores
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Thu, 02 Apr 2009 17:27:53 -0600
parents 5e8f7ad442ba
children 15e9762bb620
comparison
equal deleted inserted replaced
1189:c0091f3b72f1 1190:ea7b8b6c96c0
142 const char* linkage = "globl"; 142 const char* linkage = "globl";
143 std::string section = "text"; 143 std::string section = "text";
144 if (DtoIsTemplateInstance(fd)) 144 if (DtoIsTemplateInstance(fd))
145 { 145 {
146 linkage = "weak"; 146 linkage = "weak";
147 tmpstr << "section\t.gnu.linkonce.t." << mangle << ",\"ax\",@progbits"; 147 tmpstr << "section\t.gnu.linkonce.t.";
148 if (global.params.os != OSWindows)
149 {
150 tmpstr << mangle << ",\"ax\",@progbits";
151 } else
152 {
153 tmpstr << "_" << mangle << ",\"ax\"";
154 }
148 section = tmpstr.str(); 155 section = tmpstr.str();
149 } 156 }
150 asmstr << "\t." << section << std::endl; 157 asmstr << "\t." << section << std::endl;
151 asmstr << "\t.align\t16" << std::endl; 158 asmstr << "\t.align\t16" << std::endl;
152 159
153 if (global.params.os == OSWindows) 160 if (global.params.os == OSWindows)
154 { 161 {
155 std::string def = "def"; 162 std::string def = "def";
156 std::string endef = "endef"; 163 std::string endef = "endef";
157 asmstr << "\t." << def << "\t" << mangle << ";"; 164 asmstr << "\t." << def << "\t_" << mangle << ";";
158 // hard code these two numbers for now since gas ignores .scl and llvm 165 // hard code these two numbers for now since gas ignores .scl and llvm
159 // is defaulting to .type 32 for everything I have seen 166 // is defaulting to .type 32 for everything I have seen
160 asmstr << "\t.scl 2; .type 32;\t" << "." << endef << std::endl; 167 asmstr << "\t.scl 2; .type 32;\t" << "." << endef << std::endl;
168 asmstr << "_";
161 } else 169 } else
162 { 170 {
163 asmstr << "\t." << linkage << "\t" << mangle << std::endl; 171 asmstr << "\t." << linkage << "\t" << mangle << std::endl;
164 asmstr << "\t.type\t" << mangle << ",@function" << std::endl; 172 asmstr << "\t.type\t" << mangle << ",@function" << std::endl;
165 } 173 }