--- Begin Message ---
Source: pypy
Version: 6.0.0+dfsg-1
Severity: important
Tags: patch upstream
Forwarded: https://bitbucket.org/pypy/pypy/issues/2848/gnu-hurd-port
User: [email protected]
User-tags: hurd
Hello,
pypy is becoming more and more a dependence for a lot of packages. I
have worked on the hurd port, here is the patch I have come up with and
submitted to https://bitbucket.org/pypy/pypy/issues/2848/gnu-hurd-port
There were a couple of issues which were fixed upstream, I have also
attached the patches.
Samuel
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500,
'testing-debug'), (500, 'stable-debug'), (500, 'oldoldstable'), (500,
'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1,
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.17.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--
Samuel
Now, it we had this sort of thing:
yield -a for yield to all traffic
yield -t for yield to trucks
yield -f for yield to people walking (yield foot)
yield -d t* for yield on days starting with t
...you'd have a lot of dead people at intersections, and traffic jams you
wouldn't believe...
(Discussion in comp.os.linux.misc on the intuitiveness of commands.)
Index: pypy-6.0.0+dfsg/rpython/translator/platform/__init__.py
===================================================================
--- pypy-6.0.0+dfsg.orig/rpython/translator/platform/__init__.py
+++ pypy-6.0.0+dfsg/rpython/translator/platform/__init__.py
@@ -310,6 +310,13 @@ elif "openbsd" in sys.platform:
host_factory = OpenBSD
else:
host_factory = OpenBSD_64
+elif sys.platform.startswith('gnu'):
+ from rpython.translator.platform.hurd import Hurd
+ import platform
+ if platform.architecture()[0] == '32bit':
+ host_factory = Hurd
+ else:
+ host_factory = Hurd_64
elif os.name == 'nt':
from rpython.translator.platform.windows import Windows, Windows_x64
import platform
Index: pypy-6.0.0+dfsg/rpython/translator/platform/hurd.py
===================================================================
--- /dev/null
+++ pypy-6.0.0+dfsg/rpython/translator/platform/hurd.py
@@ -0,0 +1,42 @@
+"""Support for Hurd."""
+
+import os
+import platform
+import sys
+from rpython.translator.platform.posix import BasePosix
+
+class BaseHurd(BasePosix):
+ name = "hurd"
+
+ link_flags = tuple(
+ ['-pthread',]
+ + os.environ.get('LDFLAGS', '').split())
+ extra_libs = ('-lrt',)
+ cflags = tuple(
+ ['-O3', '-pthread', '-fomit-frame-pointer',
+ '-Wall', '-Wno-unused', '-Wno-address']
+ + os.environ.get('CFLAGS', '').split())
+ standalone_only = ()
+ shared_only = ('-fPIC',)
+ so_ext = 'so'
+
+ def _args_for_shared(self, args, **kwds):
+ return ['-shared'] + args
+
+ def _include_dirs_for_libffi(self):
+ return self._pkg_config("libffi", "--cflags-only-I",
+ ['/usr/include/libffi'],
+ check_result_dir=True)
+
+ def _library_dirs_for_libffi(self):
+ return self._pkg_config("libffi", "--libs-only-L",
+ ['/usr/lib/libffi'],
+ check_result_dir=True)
+
+
+class Hurd(BaseHurd):
+ shared_only = () # it seems that on 32-bit GNU, compiling with -fPIC
+ # gives assembler that asmgcc is not happy about.
+
+class HurdPIC(BaseHurd):
+ pass
Index: pypy-6.0.0+dfsg/rpython/rlib/rposix.py
===================================================================
--- pypy-6.0.0+dfsg.orig/rpython/rlib/rposix.py
+++ pypy-6.0.0+dfsg/rpython/rlib/rposix.py
@@ -1086,9 +1086,12 @@ def _make_waitmacro(name):
else:
return bool(c_func(status))
-WAIT_MACROS = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+WAIT_MACROS = ['WCOREDUMP', 'WIFSTOPPED',
'WIFSIGNALED', 'WIFEXITED',
'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']
+if not sys.platform.startswith('gnu'):
+ WAIT_MACROS.append('WIFCONTINUED')
+
for name in WAIT_MACROS:
_make_waitmacro(name)
Index: pypy-6.0.0+dfsg/rpython/jit/backend/detect_cpu.py
===================================================================
--- pypy-6.0.0+dfsg.orig/rpython/jit/backend/detect_cpu.py
+++ pypy-6.0.0+dfsg/rpython/jit/backend/detect_cpu.py
@@ -57,6 +57,7 @@ def detect_model_from_host_platform():
'i486': MODEL_X86,
'i586': MODEL_X86,
'i686': MODEL_X86,
+ 'i686-AT386': MODEL_X86,
'i86pc': MODEL_X86, # Solaris/Intel
'x86': MODEL_X86, # Apple
'Power Macintosh': MODEL_PPC_64,
Index: pypy-6.0.0+dfsg/pypy/module/_multiprocessing/interp_semaphore.py
===================================================================
--- pypy-6.0.0+dfsg.orig/pypy/module/_multiprocessing/interp_semaphore.py
+++ pypy-6.0.0+dfsg/pypy/module/_multiprocessing/interp_semaphore.py
@@ -57,7 +57,10 @@ else:
TIMESPEC = platform.Struct('struct timespec', [('tv_sec', rffi.TIME_T),
('tv_nsec', rffi.LONG)])
SEM_FAILED = platform.ConstantInteger('SEM_FAILED')
- SEM_VALUE_MAX = platform.ConstantInteger('SEM_VALUE_MAX')
+ if sys.platform.startswith('gnu'):
+ SEM_VALUE_MAX = sys.maxint
+ else:
+ SEM_VALUE_MAX = platform.ConstantInteger('SEM_VALUE_MAX')
SEM_TIMED_WAIT = platform.Has('sem_timedwait')
SEM_T_SIZE = platform.SizeOf('sem_t')
@@ -69,7 +72,10 @@ else:
SEM_T = rffi.COpaquePtr('sem_t', compilation_info=eci)
# rffi.cast(SEM_T, config['SEM_FAILED'])
SEM_FAILED = config['SEM_FAILED']
- SEM_VALUE_MAX = config['SEM_VALUE_MAX']
+ if sys.platform.startswith('gnu'):
+ SEM_VALUE_MAX = sys.maxint
+ else:
+ SEM_VALUE_MAX = config['SEM_VALUE_MAX']
SEM_TIMED_WAIT = config['SEM_TIMED_WAIT']
SEM_T_SIZE = config['SEM_T_SIZE']
if sys.platform == 'darwin':
# HG changeset patch
# User Armin Rigo <[email protected]>
# Date 1530647130 -7200
# Tue Jul 03 21:45:30 2018 +0200
# Node ID 60d37209763ded4f11bfdb86d7e1700109b9ce8e
# Parent 55061f499bd529fa3efa23e47c77c22133884d99
Fix rvmprof/dummy: stop_sampling() is supposed to return an integer, not None
diff -r 55061f499bd5 -r 60d37209763d rpython/rlib/rvmprof/dummy.py
--- a/rpython/rlib/rvmprof/dummy.py Sun Jul 01 22:39:13 2018 +0200
+++ b/rpython/rlib/rvmprof/dummy.py Tue Jul 03 21:45:30 2018 +0200
@@ -23,4 +23,4 @@
pass
def stop_sampling(self):
- pass
+ return -1
# HG changeset patch
# User Armin Rigo <[email protected]>
# Date 1531903611 -7200
# Wed Jul 18 10:46:51 2018 +0200
# Node ID 0ee5333ce97ea580ca99c024fec9afd96b7e0db4
# Parent 94d4f08d6056245f7615d019d24d2469e8c3ee6f
rvmprof.dummy is not really working, at least for pypy. Try to fix it some
more,
but give up for now. Instead, robustly detect that vmprof is not supported from
pypyoption and disable the '_vmprof' and 'faulthandler' modules.
diff -r 94d4f08d6056 -r 0ee5333ce97e pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py Tue Jul 17 12:32:16 2018 +0200
+++ b/pypy/config/pypyoption.py Wed Jul 18 10:46:51 2018 +0200
@@ -39,14 +39,10 @@
"_csv", "_cppyy", "_pypyjson", "_jitlog"
])
-from rpython.jit.backend import detect_cpu
-try:
- if detect_cpu.autodetect().startswith('x86'):
- if not sys.platform.startswith('openbsd'):
- working_modules.add('_vmprof')
- working_modules.add('faulthandler')
-except detect_cpu.ProcessorAutodetectError:
- pass
+import rpython.rlib.rvmprof.cintf
+if rpython.rlib.rvmprof.cintf.IS_SUPPORTED:
+ working_modules.add('_vmprof')
+ working_modules.add('faulthandler')
translation_modules = default_modules.copy()
translation_modules.update([
@@ -318,3 +314,4 @@
parser = to_optparse(config) #, useoptions=["translation.*"])
option, args = parser.parse_args()
print config
+ print working_modules
diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/dummy.py
--- a/rpython/rlib/rvmprof/dummy.py Tue Jul 17 12:32:16 2018 +0200
+++ b/rpython/rlib/rvmprof/dummy.py Wed Jul 18 10:46:51 2018 +0200
@@ -1,6 +1,7 @@
from rpython.rlib.objectmodel import specialize
class DummyVMProf(object):
+ is_enabled = False
def __init__(self):
self._unique_id = 0
diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/rvmprof.py
--- a/rpython/rlib/rvmprof/rvmprof.py Tue Jul 17 12:32:16 2018 +0200
+++ b/rpython/rlib/rvmprof/rvmprof.py Wed Jul 18 10:46:51 2018 +0200
@@ -23,6 +23,7 @@
VMPROF_GC_TAG = 5
class VMProfError(Exception):
+ msg = '' # annotation hack
def __init__(self, msg):
self.msg = msg
def __str__(self):
diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/traceback.py
--- a/rpython/rlib/rvmprof/traceback.py Tue Jul 17 12:32:16 2018 +0200
+++ b/rpython/rlib/rvmprof/traceback.py Wed Jul 18 10:46:51 2018 +0200
@@ -13,6 +13,8 @@
array_length). The caller must free array_p. Not for signal handlers:
for these, call vmprof_get_traceback() from C code.
"""
+ if not cintf.IS_SUPPORTED:
+ return (None, 0)
_cintf = rvmprof._get_vmprof().cintf
size = estimate_number_of_entries * 2 + 4
stack = cintf.get_rvmprof_stack()
@@ -47,6 +49,8 @@
'code_obj' may be None if it can't be determined. 'loc' is one
of the LOC_xxx constants.
"""
+ if not cintf.IS_SUPPORTED:
+ return
i = 0
while i < array_length - 1:
tag = array_p[i]
--- End Message ---