[pypy-commit] pypy release-pypy2.7-5.x: Fix for calls to '__x86.get_pc_thunk'

arigo pypy.commits at gmail.com
Sat Nov 12 04:10:55 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: release-pypy2.7-5.x
Changeset: r88330:cf97314aa80f
Date: 2016-11-12 10:08 +0100
http://bitbucket.org/pypy/pypy/changeset/cf97314aa80f/

Log:	Fix for calls to '__x86.get_pc_thunk'

diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py
--- a/rpython/translator/c/gcc/trackgcroot.py
+++ b/rpython/translator/c/gcc/trackgcroot.py
@@ -926,6 +926,13 @@
                 assert  lineoffset in (1,2)
                 return [InsnStackAdjust(-4)]
 
+        if target.startswith('__x86.get_pc_thunk.'):
+            # special case, found on x86-32: these static functions
+            # contain only a simple load of some non-GC pointer to
+            # a specific register (not necessarily EAX)
+            reg = '%e' + target.split('.')[-1]
+            return [InsnSetLocal(reg)]
+
         insns = [InsnCall(target, self.currentlineno),
                  InsnSetLocal(self.EAX)]      # the result is there
         if self.format in ('mingw32', 'msvc'):


More information about the pypy-commit mailing list