[tbb-commits] [tor-browser-build/master] Bug 31388: Update Rust Project for Android

gk at torproject.org gk at torproject.org
Fri Aug 30 06:30:01 UTC 2019


commit 9e3cc2f51b69fdcf6ff1366bec5eac8525ad14d4
Author: sisbell <shane.isbell at gmail.com>
Date:   Sat Aug 10 21:18:15 2019 -0700

    Bug 31388: Update Rust Project for Android
---
 ...e-dl_iterate_phdr-is-undefined-on-Android.patch | 34 -----------------
 projects/rust/build                                |  8 ----
 projects/rust/config                               |  6 +--
 projects/rust/replace_pagesize_in_mmap.patch       | 44 ----------------------
 4 files changed, 1 insertion(+), 91 deletions(-)

diff --git a/projects/rust/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch b/projects/rust/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
deleted file mode 100644
index 75cd657..0000000
--- a/projects/rust/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 4fa67c8a014ac10558be71edec9048851ca7a02d Mon Sep 17 00:00:00 2001
-From: Georg Koppen <gk at torproject.org>
-Date: Thu, 15 Nov 2018 19:04:46 +0000
-Subject: [PATCH] Make sure `dl_iterate_phdr` is undefined on Android
-
-If we build with API < 21 we'll run into undefined reference errors.
-We follow the Rust people who ran into similar issues when
-upgrading libbacktrace for 1.28.0 in making sure `dl_iterate_phdr` is
-not defined for Android.
-
-diff --git a/src/libbacktrace/configure b/src/libbacktrace/configure
-index 8bdb29d256..8941fcd2b0 100755
---- a/src/libbacktrace/configure
-+++ b/src/libbacktrace/configure
-@@ -12397,7 +12397,15 @@ rm -f conftest*
- 	have_dl_iterate_phdr=no ;;
-     esac
-   else
--    ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr"
-+    case "${host}" in
-+    *-*-androideabi*)
-+        # Avoid dl_iterate_phdr on older Android API (which we use),
-+        # as defining it causes undefined reference errors when
-+        # compiling Firefox later on.
-+        have_dl_iterate_phdr=no ;;
-+    *) ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr" ;;
-+    esac
-+
- if test "x$ac_cv_func_dl_iterate_phdr" = x""yes; then :
-   have_dl_iterate_phdr=yes
- else
--- 
-2.19.1
-
diff --git a/projects/rust/build b/projects/rust/build
index 5cf8c02..ce039ea 100644
--- a/projects/rust/build
+++ b/projects/rust/build
@@ -62,14 +62,6 @@ cd /var/tmp/build/rustc-[% c('version') %]-src
   patch -p1 < $rootdir/unwind.patch
 [% END %]
 
-[% IF c("var/android") %]
-  patch -p1 < $rootdir/replace_pagesize_in_mmap.patch
-  # The additional Rust patch is not necessary for x86.
-  [% IF c("var/android-armv7") %]
-    patch -p1 < $rootdir/0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
-  [% END %]
-[% END %]
-
 mkdir build
 cd build
 ../configure --prefix=$distdir [% c("var/configure_opt") %]
diff --git a/projects/rust/config b/projects/rust/config
index 011920b..106c709 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -18,7 +18,7 @@ targets:
         - zlib1g-dev
   android-armv7:
     var:
-      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=armv7-linux-androideabi --set=target.armv7-linux-androideabi.cc=$ANDROID_NDK_HOME/arm/bin/arm-linux-androideabi-gcc
+      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=thumbv7neon-linux-androideabi --set=target.thumbv7neon-linux-androideabi.cc=$ANDROID_NDK_HOME/arm/bin/arm-linux-androideabi-gcc
 
   android-x86:
     var:
@@ -105,7 +105,3 @@ input_files:
     gpg_keyring: rust.gpg
   - filename: unwind.patch
     enable: '[% c("var/windows-i686") %]'
-  - filename: replace_pagesize_in_mmap.patch
-    enable: '[% c("var/android") %]'
-  - filename: 0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
-    enable: '[% c("var/android-armv7") %]'
diff --git a/projects/rust/replace_pagesize_in_mmap.patch b/projects/rust/replace_pagesize_in_mmap.patch
deleted file mode 100644
index 598f190..0000000
--- a/projects/rust/replace_pagesize_in_mmap.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c
-index 138ef70711..e3c4cd2643 100644
---- a/src/libbacktrace/mmap.c
-+++ b/src/libbacktrace/mmap.c
-@@ -140,7 +140,7 @@ backtrace_alloc (struct backtrace_state *state,
-     {
-       /* Allocate a new page.  */
- 
--      pagesize = getpagesize ();
-+      pagesize = sysconf(_SC_PAGESIZE);
-       asksize = (size + pagesize - 1) & ~ (pagesize - 1);
-       page = mmap (NULL, asksize, PROT_READ | PROT_WRITE,
- 		   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-@@ -181,7 +181,7 @@ backtrace_free (struct backtrace_state *state, void *addr, size_t size,
-     {
-       size_t pagesize;
- 
--      pagesize = getpagesize ();
-+      pagesize = sysconf(_SC_PAGESIZE);
-       if (((uintptr_t) addr & (pagesize - 1)) == 0
- 	  && (size & (pagesize - 1)) == 0)
- 	{
-@@ -226,7 +226,7 @@ backtrace_vector_grow (struct backtrace_state *state,size_t size,
-       size_t alc;
-       void *base;
- 
--      pagesize = getpagesize ();
-+      pagesize = sysconf(_SC_PAGESIZE);
-       alc = vec->size + size;
-       if (vec->size == 0)
- 	alc = 16 * size;
-diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c
-index dfdaf6fa52..5b23003090 100644
---- a/src/libbacktrace/mmapio.c
-+++ b/src/libbacktrace/mmapio.c
-@@ -60,7 +60,7 @@ backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
-   off_t pageoff;
-   void *map;
- 
--  pagesize = getpagesize ();
-+  pagesize = sysconf(_SC_PAGESIZE);
-   inpage = offset % pagesize;
-   pageoff = offset - inpage;
- 



More information about the tbb-commits mailing list