Author: Mihnea Saracin <[email protected]>
Branch: nopax
Changeset: r91933:2b5d6124c784
Date: 2017-05-26 15:23 +0300
http://bitbucket.org/pypy/pypy/changeset/2b5d6124c784/

Log:    nopax added

diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py
--- a/lib_pypy/_tkinter/tklib_build.py
+++ b/lib_pypy/_tkinter/tklib_build.py
@@ -22,12 +22,23 @@
     linklibs = ['tcl', 'tk']
     libdirs = []
 else:
+    # On some Linux distributions, the tcl and tk libraries are
+    # stored in /usr/include, so we must check this case also
+    found = False
     for _ver in ['', '8.6', '8.5', '']:
         incdirs = ['/usr/include/tcl' + _ver]
         linklibs = ['tcl' + _ver, 'tk' + _ver]
         libdirs = []
         if os.path.isdir(incdirs[0]):
+            found = True
             break
+        if not found:
+            for _ver in ['8.6', '8.5', '']:
+                incdirs = ['/usr/include']
+                linklibs = ['tcl' + _ver, 'tk' + _ver]
+                libdirs=[]
+                if os.path.isfile(''.join(['/usr/lib/lib', linklibs[1], 
'.so'])):
+                    break
 
 config_ffi = FFI()
 config_ffi.cdef("""
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -264,6 +264,9 @@
                 raise Exception("Cannot use the --output option with PyPy "
                                 "when --shared is on (it is by default). "
                                 "See issue #1971.")
+        elif config.translation.nopax is not None:
+            raise Exception("Cannot use the --nopax option "
+                            "when --shared is off (it is on by default). ")
 
         # if both profopt and profoptpath are specified then we keep them as 
they are with no other changes
         if config.translation.profopt:
diff --git a/rpython/config/translationoption.py 
b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -145,6 +145,9 @@
     BoolOption("profopt", "Enable profile guided optimization. Defaults to 
enabling this for PyPy. For other training workloads, please specify them in 
profoptargs",
               cmdline="--profopt", default=False),
     StrOption("profoptargs", "Absolute path to the profile guided optimization 
training script + the necessary arguments of the script", 
cmdline="--profoptargs", default=None),
+    BoolOption("nopax", "Use this in case your system comes with a PAX 
protection. --nopax will disable it for pypy, so that it can use the jit. 
Requires paxmark to be installed",
+               default=False,
+               cmdline="--nopax"),
     BoolOption("instrument", "internal: turn instrumentation on",
                default=False, cmdline=None),
     BoolOption("countmallocs", "Count mallocs and frees", default=False,
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
@@ -333,6 +333,8 @@
         extra_opts = []
         if self.config.translation.profopt:
             extra_opts += ["profopt"]
+        if self.config.translation.nopax:
+            extra_opts += ["nopax"]
         if self.config.translation.make_jobs != 1:
             extra_opts += ['-j', str(self.config.translation.make_jobs)]
         if self.config.translation.lldebug:
@@ -396,6 +398,15 @@
                     '$(MAKE) CFLAGS="-fprofile-use -fprofile-correction -fPIC 
$(CFLAGS) -fno-lto"  LDFLAGS="-fprofile-use $(LDFLAGS) -fno-lto" 
$(PROFOPT_TARGET)',
                 ]))
 
+        # No-pax code
+        if self.config.translation.nopax:
+            mk.definition('PAX_TARGET', '%s' % (exe_name))
+            rules.append(('$(PAX_TARGET)', '$(TARGET) main.o', [
+                          '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. 
-l$(SHARED_IMPORT_LIB) -o $@ $(RPATH_FLAGS)',
+                          'paxmark -zm $(PAX_TARGET)']))
+            mk.rule('nopax', '',
+                    '$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGSEXTRA)" 
LDFLAGS="$(LDFLAGS)" $(PAX_TARGET)')
+
         for rule in rules:
             mk.rule(*rule)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to