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