File: ctypes-arm.diff

package info (click to toggle)
python2.7 2.7.16-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,524 kB
  • sloc: python: 469,695; ansic: 444,315; sh: 17,604; asm: 14,304; makefile: 4,899; objc: 761; exp: 499; cpp: 128; xml: 76
file content (34 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Index: b/Lib/ctypes/util.py
===================================================================
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -236,16 +236,27 @@ elif os.name == "posix":
 
         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')