Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r94880:2ca5d2f3a174 Date: 2018-07-20 09:25 +0200 http://bitbucket.org/pypy/pypy/changeset/2ca5d2f3a174/
Log: Issue #2848 Patch for GNU Hurd. diff --git a/pypy/module/_multiprocessing/interp_semaphore.py b/pypy/module/_multiprocessing/interp_semaphore.py --- a/pypy/module/_multiprocessing/interp_semaphore.py +++ b/pypy/module/_multiprocessing/interp_semaphore.py @@ -57,7 +57,7 @@ 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') + SEM_VALUE_MAX = platform.DefinedConstantInteger('SEM_VALUE_MAX') SEM_TIMED_WAIT = platform.Has('sem_timedwait') SEM_T_SIZE = platform.SizeOf('sem_t') @@ -70,6 +70,8 @@ # rffi.cast(SEM_T, config['SEM_FAILED']) SEM_FAILED = config['SEM_FAILED'] SEM_VALUE_MAX = config['SEM_VALUE_MAX'] + if SEM_VALUE_MAX is None: # on Hurd + SEM_VALUE_MAX = sys.maxint SEM_TIMED_WAIT = config['SEM_TIMED_WAIT'] SEM_T_SIZE = config['SEM_T_SIZE'] if sys.platform == 'darwin': diff --git a/rpython/jit/backend/detect_cpu.py b/rpython/jit/backend/detect_cpu.py --- a/rpython/jit/backend/detect_cpu.py +++ b/rpython/jit/backend/detect_cpu.py @@ -57,6 +57,7 @@ 'i486': MODEL_X86, 'i586': MODEL_X86, 'i686': MODEL_X86, + 'i686-AT386': MODEL_X86, # Hurd 'i86pc': MODEL_X86, # Solaris/Intel 'x86': MODEL_X86, # Apple 'Power Macintosh': MODEL_PPC_64, diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -1086,9 +1086,12 @@ 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) diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py --- a/rpython/translator/platform/__init__.py +++ b/rpython/translator/platform/__init__.py @@ -308,6 +308,13 @@ 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 diff --git a/rpython/translator/platform/hurd.py b/rpython/translator/platform/hurd.py new file mode 100644 --- /dev/null +++ b/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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit