gnu: libmtp: Update to 1.1.11.
[jackhill/guix/guix.git] / gnu / packages / patches / patchelf-page-size.patch
1 Improve the determination of pageSize in patchelf.cc.
2
3 Patch by Mark H Weaver <mhw@netris.org>.
4
5 --- patchelf/src/patchelf.cc.orig 1969-12-31 19:00:01.000000000 -0500
6 +++ patchelf/src/patchelf.cc 2014-02-16 20:15:06.283203125 -0500
7 @@ -21,11 +21,19 @@
8 using namespace std;
9
10
11 -#ifdef MIPSEL
12 -/* The lemote fuloong 2f kernel defconfig sets a page size of 16KB */
13 -const unsigned int pageSize = 4096*4;
14 -#else
15 +/* Note that some platforms support multiple page sizes. Therefore,
16 + it is not enough to query the current page size. 'pageSize' must
17 + be the maximum architectural page size for the platform, which is
18 + typically defined in the corresponding ABI document.
19 +
20 + XXX FIXME: This won't work when we're cross-compiling. */
21 +
22 +#if defined __MIPSEL__ || defined __MIPSEB__ || defined __aarch64__
23 +const unsigned int pageSize = 65536;
24 +#elif defined __x86_64__ || defined __i386__ || defined __arm__
25 const unsigned int pageSize = 4096;
26 +#else
27 +# error maximum architectural page size unknown for this platform
28 #endif
29
30
31 --- patchelf/tests/no-rpath.sh.orig 2014-01-14 08:17:47.000000000 -0500
32 +++ patchelf/tests/no-rpath.sh 2015-01-06 18:31:53.418172797 -0500
33 @@ -1,23 +1,23 @@
34 #! /bin/sh -e
35 SCRATCH=scratch/$(basename $0 .sh)
36
37 -rm -rf ${SCRATCH}
38 -mkdir -p ${SCRATCH}
39 +if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
40 + rm -rf ${SCRATCH}
41 + mkdir -p ${SCRATCH}
42
43 -cp ${srcdir}/no-rpath ${SCRATCH}/
44 + cp ${srcdir}/no-rpath ${SCRATCH}/
45
46 -oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
47 -if test -n "$oldRPath"; then exit 1; fi
48 -../src/patchelf \
49 - --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
50 - --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath
51 + oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
52 + if test -n "$oldRPath"; then exit 1; fi
53 + ../src/patchelf \
54 + --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
55 + --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath
56
57 -newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
58 -if ! echo "$newRPath" | grep -q '/foo:/bar'; then
59 - echo "incomplete RPATH"
60 - exit 1
61 -fi
62 + newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
63 + if ! echo "$newRPath" | grep -q '/foo:/bar'; then
64 + echo "incomplete RPATH"
65 + exit 1
66 + fi
67
68 -if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
69 cd ${SCRATCH} && ./no-rpath
70 fi