[pypy-svn] r68656 - pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc

afa at codespeak.net afa at codespeak.net
Tue Oct 20 10:30:12 CEST 2009


Author: afa
Date: Tue Oct 20 10:30:11 2009
New Revision: 68656

Modified:
   pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc/trackgcroot.py
Log:
Now the test program compiles!
Next step: make it work


Modified: pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc/trackgcroot.py	Tue Oct 20 10:30:11 2009
@@ -755,17 +755,6 @@
             sys.stderr.write('\n')
 
     def write_newfile(self, newfile, lines, grist):
-        # Workaround a bug in the .s files generated by msvc compiler: every
-        # float constant is exported with a name correcsponding to its value,
-        # and will conflict with other modules.
-        if self.format == 'msvc':
-            newlines = []
-            for line in lines:
-                newlines.append(
-                    line.replace('__real@',
-                                 '__%s__real@' % grist))
-            lines = newlines
-
         newfile.writelines(lines)
 
     def process_function(self, lines, entrypoint, filename):
@@ -902,6 +891,26 @@
         return super(MsvcAssemblerParser, self).process_function(
             lines, entrypoint, filename)
 
+    def write_newfile(self, newfile, lines, grist):
+        newlines = []
+        for line in lines:
+            # Workaround a bug in the .s files generated by msvc
+            # compiler: every float constant is exported with a name
+            # correcponding to its value, and will conflict with other
+            # modules.
+            line = line.replace('__real@',
+                                '__%s__real@' % grist)
+            # Because we insert labels in the code, some "SHORT" jumps
+            # are now longer than 127 bytes.  We turn them all into
+            # "NEAR" jumps.  Note that the assembler allocates space
+            # for a near jump, but still generates a short jump when
+            # it can.
+            line = line.replace('\tjmp\tSHORT ', '\tjmp\t')
+
+            newlines.append(line)
+
+        newfile.writelines(newlines)
+
 PARSERS = {
     'elf': ElfAssemblerParser,
     'darwin': DarwinAssemblerParser,



More information about the Pypy-commit mailing list