comparison gen/naked.cpp @ 1181:204197eb9eb5

Fix up some naked asm output for mingw32
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Mon, 30 Mar 2009 18:18:23 -0600
parents 9279a9dc6df3
children 5e8f7ad442ba
comparison
equal deleted inserted replaced
1180:f5729209a1d4 1181:204197eb9eb5
134 } 134 }
135 asmstr << "_" << mangle << ":" << std::endl; 135 asmstr << "_" << mangle << ":" << std::endl;
136 } 136 }
137 // this works on linux x86 32 and 64 bit 137 // this works on linux x86 32 and 64 bit
138 // assume it works everywhere else as well for now 138 // assume it works everywhere else as well for now
139 // this needed a slight modification for Win
140 else
141 {
142 const char* linkage = "globl";
143 std::string section = "text";
144 if (DtoIsTemplateInstance(fd))
145 {
146 linkage = "weak";
147 tmpstr << "section\t.gnu.linkonce.t." << mangle << ",\"ax\",@progbits";
148 section = tmpstr.str();
149 }
150 asmstr << "\t." << section << std::endl;
151 asmstr << "\t.align\t16" << std::endl;
152
153 if (global.params.os == OSWindows)
154 {
155 std::string def = "def";
156 std::string endef = "endef";
157 asmstr << "\t." << def << "\t" << mangle << ";";
158 // hard code these two numbers for now since gas ignores .scl and llvm
159 // is defaulting to .type 32 for everything I have seen
160 asmstr << "\t.scl 2; .type 32;\t" << "." << endef << std::endl;
161 } else
162 {
163 asmstr << "\t." << linkage << "\t" << mangle << std::endl;
164 asmstr << "\t.type\t" << mangle << ",@function" << std::endl;
165 }
166
167 asmstr << mangle << ":" << std::endl;
168
169 }
170 /*
139 else 171 else
140 { 172 {
141 const char* linkage = "globl"; 173 const char* linkage = "globl";
142 std::string section = "text"; 174 std::string section = "text";
143 if (DtoIsTemplateInstance(fd)) 175 if (DtoIsTemplateInstance(fd))
149 asmstr << "\t." << section << std::endl; 181 asmstr << "\t." << section << std::endl;
150 asmstr << "\t.align\t16" << std::endl; 182 asmstr << "\t.align\t16" << std::endl;
151 asmstr << "\t." << linkage << "\t" << mangle << std::endl; 183 asmstr << "\t." << linkage << "\t" << mangle << std::endl;
152 asmstr << "\t.type\t" << mangle << ",@function" << std::endl; 184 asmstr << "\t.type\t" << mangle << ",@function" << std::endl;
153 asmstr << mangle << ":" << std::endl; 185 asmstr << mangle << ":" << std::endl;
154 } 186 }*/
155 187
156 // emit body 188 // emit body
157 fd->fbody->toNakedIR(gIR); 189 fd->fbody->toNakedIR(gIR);
158 190
159 // emit size after body 191 // emit size after body