2014-02-17 02:20:10 +01:00
|
|
|
Improve the determination of pageSize in patchelf.cc.
|
|
|
|
|
|
|
|
Patch by Mark H Weaver <mhw@netris.org>.
|
|
|
|
|
|
|
|
--- patchelf/src/patchelf.cc.orig 1969-12-31 19:00:01.000000000 -0500
|
|
|
|
+++ patchelf/src/patchelf.cc 2014-02-16 20:15:06.283203125 -0500
|
|
|
|
@@ -21,11 +21,19 @@
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
-#ifdef MIPSEL
|
|
|
|
-/* The lemote fuloong 2f kernel defconfig sets a page size of 16KB */
|
|
|
|
-const unsigned int pageSize = 4096*4;
|
|
|
|
-#else
|
|
|
|
+/* Note that some platforms support multiple page sizes. Therefore,
|
|
|
|
+ it is not enough to query the current page size. 'pageSize' must
|
|
|
|
+ be the maximum architectural page size for the platform, which is
|
|
|
|
+ typically defined in the corresponding ABI document.
|
|
|
|
+
|
|
|
|
+ XXX FIXME: This won't work when we're cross-compiling. */
|
|
|
|
+
|
|
|
|
+#if defined __MIPSEL__ || defined __MIPSEB__ || defined __aarch64__
|
|
|
|
+const unsigned int pageSize = 65536;
|
|
|
|
+#elif defined __x86_64__ || defined __i386__ || defined __arm__
|
|
|
|
const unsigned int pageSize = 4096;
|
|
|
|
+#else
|
|
|
|
+# error maximum architectural page size unknown for this platform
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-01-06 22:38:35 +01:00
|
|
|
--- patchelf/tests/no-rpath.sh.orig 2014-01-14 08:17:47.000000000 -0500
|
|
|
|
+++ patchelf/tests/no-rpath.sh 2015-01-06 18:31:53.418172797 -0500
|
|
|
|
@@ -1,23 +1,23 @@
|
2014-02-17 02:20:10 +01:00
|
|
|
#! /bin/sh -e
|
2015-01-06 22:38:35 +01:00
|
|
|
SCRATCH=scratch/$(basename $0 .sh)
|
2014-02-17 02:20:10 +01:00
|
|
|
|
2015-01-06 22:38:35 +01:00
|
|
|
-rm -rf ${SCRATCH}
|
|
|
|
-mkdir -p ${SCRATCH}
|
2014-02-17 02:20:10 +01:00
|
|
|
+if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
|
2015-01-06 22:38:35 +01:00
|
|
|
+ rm -rf ${SCRATCH}
|
|
|
|
+ mkdir -p ${SCRATCH}
|
2014-02-17 02:20:10 +01:00
|
|
|
|
2015-01-06 22:38:35 +01:00
|
|
|
-cp ${srcdir}/no-rpath ${SCRATCH}/
|
|
|
|
+ cp ${srcdir}/no-rpath ${SCRATCH}/
|
2014-02-17 02:20:10 +01:00
|
|
|
|
2015-01-06 22:38:35 +01:00
|
|
|
-oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
|
2014-02-17 02:20:10 +01:00
|
|
|
-if test -n "$oldRPath"; then exit 1; fi
|
|
|
|
-../src/patchelf \
|
|
|
|
- --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
|
2015-01-06 22:38:35 +01:00
|
|
|
- --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath
|
|
|
|
+ oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
|
2014-02-17 02:20:10 +01:00
|
|
|
+ if test -n "$oldRPath"; then exit 1; fi
|
|
|
|
+ ../src/patchelf \
|
|
|
|
+ --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
|
2015-01-06 22:38:35 +01:00
|
|
|
+ --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx ${SCRATCH}/no-rpath
|
2014-02-17 02:20:10 +01:00
|
|
|
|
2015-01-06 22:38:35 +01:00
|
|
|
-newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
|
2014-02-17 02:20:10 +01:00
|
|
|
-if ! echo "$newRPath" | grep -q '/foo:/bar'; then
|
|
|
|
- echo "incomplete RPATH"
|
|
|
|
- exit 1
|
|
|
|
-fi
|
2015-01-06 22:38:35 +01:00
|
|
|
+ newRPath=$(../src/patchelf --print-rpath ${SCRATCH}/no-rpath)
|
2014-02-17 02:20:10 +01:00
|
|
|
+ if ! echo "$newRPath" | grep -q '/foo:/bar'; then
|
|
|
|
+ echo "incomplete RPATH"
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
-if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
|
2015-01-06 22:38:35 +01:00
|
|
|
cd ${SCRATCH} && ./no-rpath
|
2014-02-17 02:20:10 +01:00
|
|
|
fi
|