aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/patchelf-page-size.patch
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-02-16 20:20:10 -0500
committerMark H Weaver <mhw@netris.org>2014-02-17 18:47:22 -0500
commit0841dcf7dd8e6c3e474f75cfa5b95a7feaf6f112 (patch)
tree38d18e5f7adbaf386bd5b4dbdb116f47c0400364 /gnu/packages/patches/patchelf-page-size.patch
parente7fc17b592a0d25c18fbc6774b1f8a6d2a9bbc69 (diff)
downloadgnu-guix-0841dcf7dd8e6c3e474f75cfa5b95a7feaf6f112.tar
gnu-guix-0841dcf7dd8e6c3e474f75cfa5b95a7feaf6f112.tar.gz
gnu: patchelf: Fix platform page size determination.
* gnu/packages/patches/patchelf-page-size.patch: New file. * gnu/packages/elf.scm (patchelf): Add the patch. * gnu-system.am (dist_patch_DATA): Add the patch.
Diffstat (limited to 'gnu/packages/patches/patchelf-page-size.patch')
-rw-r--r--gnu/packages/patches/patchelf-page-size.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/gnu/packages/patches/patchelf-page-size.patch b/gnu/packages/patches/patchelf-page-size.patch
new file mode 100644
index 0000000000..2528b604e5
--- /dev/null
+++ b/gnu/packages/patches/patchelf-page-size.patch
@@ -0,0 +1,69 @@
+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
+
+
+--- patchelf/tests/no-rpath.sh.orig 1969-12-31 19:00:01.000000000 -0500
++++ patchelf/tests/no-rpath.sh 2014-02-16 20:44:12.036376953 -0500
+@@ -1,22 +1,22 @@
+ #! /bin/sh -e
+
+-rm -rf scratch
+-mkdir -p scratch
++if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
++ rm -rf scratch
++ mkdir -p scratch
+
+-cp no-rpath scratch/
++ cp no-rpath scratch/
+
+-oldRPath=$(../src/patchelf --print-rpath scratch/no-rpath)
+-if test -n "$oldRPath"; then exit 1; fi
+-../src/patchelf \
+- --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
+- --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx scratch/no-rpath
++ oldRPath=$(../src/patchelf --print-rpath scratch/no-rpath)
++ if test -n "$oldRPath"; then exit 1; fi
++ ../src/patchelf \
++ --set-interpreter "$(../src/patchelf --print-interpreter ../src/patchelf)" \
++ --set-rpath /foo:/bar:/xxxxxxxxxxxxxxx scratch/no-rpath
+
+-newRPath=$(../src/patchelf --print-rpath scratch/no-rpath)
+-if ! echo "$newRPath" | grep -q '/foo:/bar'; then
+- echo "incomplete RPATH"
+- exit 1
+-fi
++ newRPath=$(../src/patchelf --print-rpath scratch/no-rpath)
++ if ! echo "$newRPath" | grep -q '/foo:/bar'; then
++ echo "incomplete RPATH"
++ exit 1
++ fi
+
+-if [ "$(uname -m)" = i686 -a "$(uname -s)" = Linux ]; then
+ cd scratch && ./no-rpath
+ fi