[pypy-commit] pypy default: dance a bit, so the RPython_StartupCode is called with correctly set stack bottom

fijal noreply at buildbot.pypy.org
Wed May 8 20:48:10 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r63927:037ff5bf2cf9
Date: 2013-05-08 20:47 +0200
http://bitbucket.org/pypy/pypy/changeset/037ff5bf2cf9/

Log:	dance a bit, so the RPython_StartupCode is called with correctly set
	stack bottom

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -83,6 +83,7 @@
         # platforms, just disable it when we've passed --shared
         if config.translation.shared:
             eci.link_files = ()
+            eci.libraries = ('ffi',)
 
     def find_libffi_a():
         dirlist = platform.library_dirs_for_libffi_a()
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -2,7 +2,9 @@
 import py
 import sys, os
 from rpython.rlib import exports
+from rpython.rlib.entrypoint import entrypoint
 from rpython.rtyper.typesystem import getfunctionptr
+from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.tool import runsubprocess
 from rpython.tool.nullpath import NullPyPathLocal
 from rpython.tool.udir import udir
@@ -257,8 +259,7 @@
             if self.config.translation.shared:
                 defines['PYPY_MAIN_FUNCTION'] = "pypy_main_startup"
                 self.eci = self.eci.merge(ExternalCompilationInfo(
-                    export_symbols=["pypy_main_startup",
-                                    'RPython_StartupCode']))
+                    export_symbols=["pypy_main_startup"]))
         self.eci, cfile, extra = gen_source(db, modulename, targetdir,
                                             self.eci, defines=defines,
                                             split=self.split)
@@ -726,6 +727,15 @@
     for line in preimplementationlines:
         print >> f, line
 
+# the point of dance below is so the call to rpython_startup_code actually
+# does call asm_stack_bottom
+
+RPython_StartupCode = rffi.llexternal([], lltype.Void)
+
+ at entrypoint('main', [], c_name='rpython_startup_code')
+def rpython_startup_code():
+    return RPython_StartupCode()
+
 def gen_startupcode(f, database):
     # generate the start-up code and put it into a function
     print >> f, 'char *RPython_StartupCode(void) {'


More information about the pypy-commit mailing list