changeset 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 c0091f3b72f1
children d68796be59fd
files gen/asm-x86-32.h gen/asm-x86-64.h gen/naked.cpp
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gen/asm-x86-32.h	Thu Apr 02 20:56:39 2009 +0200
+++ b/gen/asm-x86-32.h	Thu Apr 02 17:27:53 2009 -0600
@@ -2165,8 +2165,8 @@
                                 {
                                     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);
--- a/gen/asm-x86-64.h	Thu Apr 02 20:56:39 2009 +0200
+++ b/gen/asm-x86-64.h	Thu Apr 02 17:27:53 2009 -0600
@@ -1656,7 +1656,7 @@
                                 }
 
                                 // 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 @@
                                 {
                                     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);
--- a/gen/naked.cpp	Thu Apr 02 20:56:39 2009 +0200
+++ b/gen/naked.cpp	Thu Apr 02 17:27:53 2009 -0600
@@ -144,7 +144,14 @@
         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 @@
         {
             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;