aboutsummaryrefslogtreecommitdiff
path: root/examples/python2.7/patches/ctypes-arm.diff
diff options
context:
space:
mode:
Diffstat (limited to 'examples/python2.7/patches/ctypes-arm.diff')
-rw-r--r--examples/python2.7/patches/ctypes-arm.diff32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/python2.7/patches/ctypes-arm.diff b/examples/python2.7/patches/ctypes-arm.diff
new file mode 100644
index 0000000..655998f
--- /dev/null
+++ b/examples/python2.7/patches/ctypes-arm.diff
@@ -0,0 +1,32 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -206,16 +206,27 @@
+
+ def _findSoname_ldconfig(name):
+ import struct
++ # XXX this code assumes that we know all unames and that a single
++ # ABI is supported per uname; instead we should find what the
++ # ABI is (e.g. check ABI of current process) or simply ask libc
++ # to load the library for us
++ uname = os.uname()[4]
++ # ARM has a variety of unames, e.g. armv7l
++ if uname.startswith("arm"):
++ uname = "arm"
+ if struct.calcsize('l') == 4:
+- machine = os.uname()[4] + '-32'
++ machine = uname + '-32'
+ else:
+- machine = os.uname()[4] + '-64'
++ machine = uname + '-64'
+ mach_map = {
+ 'x86_64-64': 'libc6,x86-64',
+ 'ppc64-64': 'libc6,64bit',
+ 'sparc64-64': 'libc6,64bit',
+ 's390x-64': 'libc6,64bit',
+ 'ia64-64': 'libc6,IA-64',
++ # this actually breaks on biarch or multiarch as the first
++ # library wins; uname doesn't tell us which ABI we're using
++ 'arm-32': 'libc6(,hard-float)?',
+ }
+ abi_type = mach_map.get(machine, 'libc6')
+