Description: Build with -fPIC on arm and mips
 Not needing -fPIC on i386 is exception, not the norm.
 Don't expect all 32 bit archs to build shared libraries without it.
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: no
Last-Update: 2012-02-08

--- a/pypy/translator/platform/__init__.py
+++ b/pypy/translator/platform/__init__.py
@@ -240,12 +240,15 @@
 
 
 if sys.platform.startswith('linux'):
-    from pypy.translator.platform.linux import Linux, Linux64
+    from pypy.translator.platform.linux import Linux, LinuxPIC
     import platform
-    if platform.architecture()[0] == '32bit':
-        host_factory = Linux
+    # Only required on armhf and mips{,el}, not armel. But there's no way to
+    # detect armhf without shelling out
+    if (platform.architecture()[0] == '64bit'
+            or platform.machine().startswith(('arm', 'mips'))):
+        host_factory = LinuxPIC
     else:
-        host_factory = Linux64
+        host_factory = Linux
 elif sys.platform == 'darwin':
     from pypy.translator.platform.darwin import Darwin_i386, Darwin_x86_64, Darwin_PowerPC
     import platform
--- a/pypy/translator/platform/linux.py
+++ b/pypy/translator/platform/linux.py
@@ -44,5 +44,5 @@
     shared_only = ()    # it seems that on 32-bit linux, compiling with -fPIC
                         # gives assembler that asmgcc is not happy about.
 
-class Linux64(BaseLinux):
+class LinuxPIC(BaseLinux):
     pass
