[pypy-svn] r68654 - in pypy/branch/msvc-asmgcroot/pypy/translator/c: . gcc
afa at codespeak.net
afa at codespeak.net
Tue Oct 20 01:17:02 CEST 2009
Author: afa
Date: Tue Oct 20 01:17:01 2009
New Revision: 68654
Modified:
pypy/branch/msvc-asmgcroot/pypy/translator/c/gcc/trackgcroot.py
pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py
Log:
More progress, test program is almost compiling,
two remaining problems:
- nmake does not delay macro expansion, ASMLBLOBJFILES has to be defined before OBJECTS
- the insertion of labels causes some "jmp SHORT" to become LONG jumps
And of course, even after this the resulting executable does not work at all.
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 01:17:01 2009
@@ -326,7 +326,7 @@
self.labels[label] = None
if self.format == 'msvc':
self.lines.insert(call.lineno+1, '%s::\n' % (label,))
- #self.lines.insert(call.lineno+1, 'PUBLIC\t%s\n' % (label,))
+ self.lines.insert(call.lineno+1, 'PUBLIC\t%s\n' % (label,))
else:
# These global symbols are not directly labels pointing to the
# code location because such global labels in the middle of
@@ -750,10 +750,24 @@
for in_function, lines in self.find_functions(iterlines):
if in_function:
lines = self.process_function(lines, entrypoint, filename)
- newfile.writelines(lines)
+ self.write_newfile(newfile, lines, filename.split('.')[0])
if self.verbose == 1:
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):
tracker = self.FunctionGcRootTracker(
lines, filetag=getidentifier(filename))
@@ -1136,7 +1150,7 @@
for in_function, lines in parser.find_functions(iterlines):
if in_function:
lines = parser.process_function(lines, entrypoint, filename)
- newfile.writelines(lines)
+ parser.write_newfile(newfile, lines, filename.split('.')[0])
if self.verbose == 1:
sys.stderr.write('\n')
if self.shuffle and random.random() < 0.5:
@@ -1336,7 +1350,7 @@
tracker.reload_raw_table(f)
f.close()
else:
- assert fn.endswith('.s')
+ assert fn.endswith('.s'), fn
lblfn = fn[:-2] + '.lbl.s'
g = open(lblfn, 'w')
try:
Modified: pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py (original)
+++ pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py Tue Oct 20 01:17:01 2009
@@ -505,7 +505,7 @@
mk.definition('OBJECTS', '$(ASMLBLOBJFILES) gcmaptable.obj')
mk.rule('.SUFFIXES', '.s', [])
mk.rule('.s.obj', '',
- 'ml $(CFLAGS) /Zm /coff /Fo$@ /c $< $(INCLUDEDIRS)')
+ 'ml /Cx /Zm /coff /Fo$@ /c $< $(INCLUDEDIRS)')
mk.rule('.c.gcmap', '',
['$(CC) $(CFLAGS) /c /FAs /Fa$*.s $< $(INCLUDEDIRS)',
'cmd /c ' + python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py -t $*.s > $@']
More information about the Pypy-commit
mailing list