Mercurial > projects > ldc
comparison gen/naked.cpp @ 1182:5e8f7ad442ba
Fix one more naked asm output problem for mingw32 and remove some
duplicate code
author | Kelly Wilson <wilsonk cpsc.ucalgary.ca> |
---|---|
date | Mon, 30 Mar 2009 18:22:30 -0600 |
parents | 204197eb9eb5 |
children | ea7b8b6c96c0 |
comparison
equal
deleted
inserted
replaced
1181:204197eb9eb5 | 1182:5e8f7ad442ba |
---|---|
165 } | 165 } |
166 | 166 |
167 asmstr << mangle << ":" << std::endl; | 167 asmstr << mangle << ":" << std::endl; |
168 | 168 |
169 } | 169 } |
170 /* | |
171 else | |
172 { | |
173 const char* linkage = "globl"; | |
174 std::string section = "text"; | |
175 if (DtoIsTemplateInstance(fd)) | |
176 { | |
177 linkage = "weak"; | |
178 tmpstr << "section\t.gnu.linkonce.t." << mangle << ",\"ax\",@progbits"; | |
179 section = tmpstr.str(); | |
180 } | |
181 asmstr << "\t." << section << std::endl; | |
182 asmstr << "\t.align\t16" << std::endl; | |
183 asmstr << "\t." << linkage << "\t" << mangle << std::endl; | |
184 asmstr << "\t.type\t" << mangle << ",@function" << std::endl; | |
185 asmstr << mangle << ":" << std::endl; | |
186 }*/ | |
187 | 170 |
188 // emit body | 171 // emit body |
189 fd->fbody->toNakedIR(gIR); | 172 fd->fbody->toNakedIR(gIR); |
190 | 173 |
191 // emit size after body | 174 // emit size after body |
192 // llvm does this on linux, but not on osx | 175 // llvm does this on linux, but not on osx or Win |
193 if (global.params.os != OSMacOSX) | 176 if (global.params.os != OSMacOSX && global.params.os != OSWindows) |
194 { | 177 { |
195 asmstr << "\t.size\t" << mangle << ", .-" << mangle << std::endl << std::endl; | 178 asmstr << "\t.size\t" << mangle << ", .-" << mangle << std::endl << std::endl; |
196 } | 179 } |
197 | 180 |
198 gIR->module->appendModuleInlineAsm(asmstr.str()); | 181 gIR->module->appendModuleInlineAsm(asmstr.str()); |