boklm pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: a67eadb7 by NoisyCoil at 2026-01-29T11:57:14+01:00 Bug 41706: Switch to cross-built zlib in linux cross-builds - - - - - 4456f464 by NoisyCoil at 2026-01-29T11:57:16+01:00 Bug 41706: Bump glibc to v2.28 in the linux cross-toolchain Mozilla requires glibc >= 2.28 for linux-aarch64 builds. Bumping glibc to that version in our linux cross-toolchain allows us to drop all aarch64-specific patches. - - - - - 7 changed files: - projects/gcc-cross/build - projects/gcc-cross/config - − projects/gcc-cross/glibc-cross-linux-aarch64-2.patch - − projects/gcc-cross/glibc-cross-linux-aarch64.patch - projects/tor/build - projects/tor/config - projects/zlib/build Changes: ===================================== projects/gcc-cross/build ===================================== @@ -50,13 +50,6 @@ cd /var/tmp/build mkdir glibc cd glibc tar -xJf $rootdir/glibc-[% c("var/glibc_version") %].tar.xz -[% IF c("var/linux-aarch64") -%] - # Avoid linking issues by backporting glibc patches - cd glibc-[% c("var/glibc_version") %] - patch -p1 <$rootdir/glibc-cross-linux-aarch64.patch - patch -p1 <$rootdir/glibc-cross-linux-aarch64-2.patch - cd /var/tmp/build/glibc -[% END -%] # TODO: Remove --disable-werror once glibc is upgraded to a version that's # designed to work with the GCC version we're using. ===================================== projects/gcc-cross/config ===================================== @@ -10,6 +10,7 @@ hardened_gcc: 1 var: distdir: gcc deps: + - bison - build-essential - libmpc-dev setup: | @@ -19,8 +20,8 @@ var: export LD_LIBRARY_PATH=/var/tmp/dist/[% c("var/distdir") %]/lib64 [% IF c("hardened_gcc"); GET c("var/set_hardened_build_flags"); END %] configure_opt: '--target=[% c("var/crosstarget") %] --disable-multilib --enable-languages=c,c++ --with-glibc-version=[% c("var/glibc_version") %]' - # Use stretch's glibc and stretch-security's linux - glibc_version: 2.24 + # Use glibc 2.28 as per Mozilla's requirements for aarch64, and stretch-security's linux + glibc_version: 2.28 linux_version: 4.19.232 arch_deps: - gawk @@ -37,11 +38,7 @@ input_files: - name: gcc-native project: gcc - URL: 'https://ftp.gnu.org/gnu/glibc/glibc-[% c("var/glibc_version") %].tar.xz' - sha256sum: 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 + sha256sum: b1900051afad76f7a4f73e71413df4826dce085ef8ddb785a945b66d7d513082 - URL: 'https://www.kernel.org/pub/linux/kernel/v4.x/linux-[% c("var/linux_version") %].tar.xz' sha256sum: 4fcfe814780d63dc56e907bf41596ff162e9601978bdc1a60eab64cc3903a22c - filename: 'gcc-cross.patch' - - filename: 'glibc-cross-linux-aarch64.patch' - enable: '[% c("var/linux-aarch64") -%]' - - filename: 'glibc-cross-linux-aarch64-2.patch' - enable: '[% c("var/linux-aarch64") -%]' ===================================== projects/gcc-cross/glibc-cross-linux-aarch64-2.patch deleted ===================================== @@ -1,30 +0,0 @@ -From e9177fba13549a8e2a6232f46080e5c6d3e467b1 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy <szabolcs.nagy@arm.com> -Date: Wed, 21 Jun 2017 13:47:07 +0100 -Subject: [PATCH] [AArch64] Use hidden __GI__dl_argv in rtld startup code - -We rely on the symbol being locally defined so using extern symbol -is not correct and the linker may complain about the relocations. ---- - ChangeLog | 5 +++++ - sysdeps/aarch64/dl-machine.h | 4 ++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -Index: glibc/sysdeps/aarch64/dl-machine.h -=================================================================== ---- glibc.orig/sysdeps/aarch64/dl-machine.h -+++ glibc/sysdeps/aarch64/dl-machine.h -@@ -172,8 +172,8 @@ _dl_start_user: \n\ - cmp x0, #0 \n\ - bne 1b \n\ - // Update _dl_argv \n\ -- adrp x3, _dl_argv \n\ -- str x2, [x3, #:lo12:_dl_argv] \n\ -+ adrp x3, __GI__dl_argv \n\ -+ str x2, [x3, #:lo12:__GI__dl_argv] \n\ - .L_done_stack_adjust: \n\ - // compute envp \n\ - add x3, x2, x1, lsl #3 \n\ --- -2.43.2 - ===================================== projects/gcc-cross/glibc-cross-linux-aarch64.patch deleted ===================================== @@ -1,63 +0,0 @@ -From a68ba2f3cd3cbe32c1f31e13c20ed13487727b32 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy <szabolcs.nagy@arm.com> -Date: Wed, 18 Oct 2017 17:26:23 +0100 -Subject: [PATCH] [AARCH64] Rewrite elf_machine_load_address using _DYNAMIC - symbol - -This patch rewrites aarch64 elf_machine_load_address to use special _DYNAMIC -symbol instead of _dl_start. - -The static address of _DYNAMIC symbol is stored in the first GOT entry. -Here is the change which makes this solution work (part of binutils 2.24): -https://sourceware.org/ml/binutils/2013-06/msg00248.html - -i386, x86_64 targets use the same method to do this as well. - -The original implementation relies on a trick that R_AARCH64_ABS32 relocation -being resolved at link time and the static address fits in the 32bits. -However, in LP64, normally, the address is defined to be 64 bit. - -Here is the C version one which should be portable in all cases. - - * sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Use - _DYNAMIC symbol to calculate load address. ---- - ChangeLog | 5 +++++ - sysdeps/aarch64/dl-machine.h | 39 +++++------------------------------- - 2 files changed, 10 insertions(+), 34 deletions(-) - -Index: glibc-2.26/sysdeps/aarch64/dl-machine.h -=================================================================== ---- glibc-2.26.orig/sysdeps/aarch64/dl-machine.h -+++ glibc-2.26/sysdeps/aarch64/dl-machine.h -@@ -51,26 +51,11 @@ elf_machine_load_address (void) - /* To figure out the load address we use the definition that for any symbol: - dynamic_addr(symbol) = static_addr(symbol) + load_addr - -- The choice of symbol is arbitrary. The static address we obtain -- by constructing a non GOT reference to the symbol, the dynamic -- address of the symbol we compute using adrp/add to compute the -- symbol's address relative to the PC. -- This depends on 32bit relocations being resolved at link time -- and that the static address fits in the 32bits. */ -+ _DYNAMIC sysmbol is used here as its link-time address stored in -+ the special unrelocated first GOT entry. */ - -- ElfW(Addr) static_addr; -- ElfW(Addr) dynamic_addr; -- -- asm (" \n" --" adrp %1, _dl_start; \n" --" add %1, %1, #:lo12:_dl_start \n" --" ldr %w0, 1f \n" --" b 2f \n" --"1: \n" --" .word _dl_start \n" --"2: \n" -- : "=r" (static_addr), "=r" (dynamic_addr)); -- return dynamic_addr - static_addr; -+ extern ElfW(Dyn) _DYNAMIC[] attribute_hidden; -+ return (ElfW(Addr)) &_DYNAMIC - elf_machine_dynamic (); - } - - /* Set up the loaded object described by L so its unrelocated PLT ===================================== projects/tor/build ===================================== @@ -11,23 +11,9 @@ TORDOCSDIR="$distdir/docs" mkdir $TORDATADIR $TORBINDIR $TORDOCSDIR -[% IF c("var/windows") || c("var/android") %] +[% IF c("var/windows") || c("var/android") || c("var/linux-cross") %] tar -C /var/tmp/dist -xf [% c('input_files_by_name/zlib') %] zlibdir=/var/tmp/dist/zlib -[% ELSIF c("var/linux-cross") %] - # Since 1. we are using Debian's zlib1g-dev:$arch_debian, 2. our - # cross-toolchain's default paths (i.e. -I and -L) are not the same - # as those of Debian's cross-toolchain, and 3. tor's configure does - # not support separate header and library directories for zlib, we - # need to make the headers and $arch_debian library available to - # configure manually. - # DO NOT use CPPFLAGS="-I/usr/include" to include the headers, the - # build will fail (probably because some of our cross-$arch_debian - # headers get masked by the native ones). - CROSS_INCLUDEDIR=/var/tmp/dist/gcc/[% c("var/crosstarget") %]/include - ln -s /usr/include/zconf.h $CROSS_INCLUDEDIR - ln -s /usr/include/zlib.h $CROSS_INCLUDEDIR - export LDFLAGS="-L/usr/lib/[% c("var/crosstarget") %] $LDFLAGS" [% END %] [% IF c("var/android") %] tar -C /var/tmp/dist -xf [% c('input_files_by_name/zstd') %] @@ -74,7 +60,7 @@ echo '"[% c("abbrev", { abbrev_length => 16 }) %]"' > micro-revision.i find -type f -print0 | xargs -0 [% c("touch") %] ./configure --disable-asciidoc --with-libevent-dir="$libeventdir" --with-openssl-dir="$openssldir" \ [% IF c("var/asan") %]--enable-fragile-hardening[% END %] \ - [% IF c("var/windows") || c("var/android") %]--with-zlib-dir="$zlibdir"[% END %] \ + [% IF c("var/windows") || c("var/android") || c("var/linux-cross") %]--with-zlib-dir="$zlibdir"[% END %] \ [% IF c("var/macos") %]--enable-static-openssl[% END %] \ [% IF c("var/windows") %]--enable-static-libevent --enable-static-openssl --enable-static-zlib[% END %] \ [% IF c("var/linux-cross") %]--build=x86_64-linux-gnu[% END %] \ @@ -134,7 +120,7 @@ cd $distdir pushd $TORDOCSDIR cp $libeventdir/LICENSE libevent.txt cp $openssldir/LICENSE.txt openssl.txt -[% IF c("var/windows") || c("var/android") -%] +[% IF c("var/windows") || c("var/android") || c("var/linux-cross") -%] cp $zlibdir/LICENSE zlib.txt [% END -%] [% IF c("var/android") -%] ===================================== projects/tor/config ===================================== @@ -27,8 +27,6 @@ targets: linux-aarch64: var: libdir: lib64 - arch_deps: - - zlib1g-dev:arm64 android: var: @@ -42,7 +40,7 @@ input_files: project: libevent - name: zlib project: zlib - enable: '[% c("var/windows") || c("var/android") %]' + enable: '[% c("var/windows") || c("var/android") || c("var/linux-cross") %]' - name: '[% c("var/compiler") %]' project: '[% c("var/compiler") %]' - name: zstd ===================================== projects/zlib/build ===================================== @@ -14,6 +14,10 @@ cd /var/tmp/build/[% project %]-[% c('version') %] [% IF c("var/android") -%] export CHOST=[% c("var/cross_prefix") %] export CC=[% c("var/CC") %] +[% ELSIF c("var/linux-cross") -%] + export CHOST=[% c("var/crosstarget") %] +[% END -%] +[% IF c("var/android") || c("var/linux-cross") -%] export CFLAGS="[% c('var/CFLAGS') %]" ./configure --prefix=$distdir make -j[% c("num_procs") %] View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/3... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/3... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
boklm (@boklm)