boklm pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
-
1f881995
by JeremyRand at 2023-05-15T11:34:26+00:00
-
eb83bb70
by Jeremy Rand at 2023-05-15T11:34:26+00:00
-
25d02d5d
by JeremyRand at 2023-05-15T11:34:26+00:00
-
225f00eb
by Jeremy Rand at 2023-05-15T11:34:26+00:00
5 changed files:
- projects/binutils/build
- projects/binutils/config
- projects/gcc/build
- projects/gcc/config
- projects/openssl/config
Changes:
... | ... | @@ -23,7 +23,11 @@ cd [% project %]-[% c("version") %] |
23 | 23 | make -j[% c("num_procs") %] MAKEINFO=true
|
24 | 24 | make install MAKEINFO=true
|
25 | 25 | |
26 | -[% IF c("var/linux") %]
|
|
26 | +# gold is disabled for linux-cross, because of
|
|
27 | +# https://sourceware.org/bugzilla/show_bug.cgi?id=14995
|
|
28 | +# Once we upgrade to glibc 2.26, we might be able to enable gold for
|
|
29 | +# linux-cross.
|
|
30 | +[% IF c("var/linux") && ! c("var/linux-cross") %]
|
|
27 | 31 | # Make sure gold is used with the hardening wrapper for full RELRO, see #13031.
|
28 | 32 | cd $distdir/bin
|
29 | 33 | rm ld
|
... | ... | @@ -10,6 +10,11 @@ targets: |
10 | 10 | windows:
|
11 | 11 | var:
|
12 | 12 | configure_opt: '--target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-deterministic-archives'
|
13 | + linux-cross:
|
|
14 | + var:
|
|
15 | + # gold is disabled on cross-compiles until we upgrade to glibc 2.26 and
|
|
16 | + # binutils 2.28
|
|
17 | + configure_opt: '--target=[% c("var/crosstarget") %] --disable-multilib --enable-deterministic-archives --enable-plugins'
|
|
13 | 18 | |
14 | 19 | input_files:
|
15 | 20 | - URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.xz
|
... | ... | @@ -16,11 +16,85 @@ |
16 | 16 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48817.
|
17 | 17 | export DEB_BUILD_HARDENING_FORMAT=0
|
18 | 18 | [% END -%]
|
19 | -distdir=/var/tmp/dist/[% project %]
|
|
19 | +distdir=/var/tmp/dist/[% c("var/distdir") %]
|
|
20 | 20 | mkdir /var/tmp/build
|
21 | -tar -C /var/tmp/build -xf $rootdir/[% c('input_files_by_name/gcc') %]
|
|
22 | -cd /var/tmp/build/[% project %]-[% c("version") %]
|
|
23 | -./configure --prefix=$distdir [% c("var/configure_opt") %]
|
|
21 | + |
|
22 | +[% IF c("var/linux-cross") -%]
|
|
23 | + |
|
24 | + # Install binutils (needed for cross-compiling)
|
|
25 | + mkdir /var/tmp/dist
|
|
26 | + cd /var/tmp/dist
|
|
27 | + tar xf $rootdir/[% c('input_files_by_name/binutils') %]
|
|
28 | + mv binutils $distdir
|
|
29 | + export PATH="$distdir/bin:$PATH"
|
|
30 | + |
|
31 | + # Install Linux headers, see Step 2 of
|
|
32 | + # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
|
|
33 | + # Doing this before gcc configure is intended to solve a limits.h issue
|
|
34 | + cd /var/tmp/build
|
|
35 | + mkdir linux
|
|
36 | + cd linux
|
|
37 | + tar -xJf $rootdir/linux-[% c("var/linux_version") %].tar.xz
|
|
38 | + cd linux-[% c("var/linux_version") %]
|
|
39 | + make ARCH=[% c("arch") %] INSTALL_HDR_PATH=$distdir/[% c("var/crosstarget") %] headers_install
|
|
40 | + |
|
41 | + cd /var/tmp/build
|
|
42 | + mkdir gcc
|
|
43 | + cd gcc
|
|
44 | + tar -xJf $rootdir/[% c('input_files_by_name/gcc') %]
|
|
45 | + # --with-headers is intended to solve a limits.h issue
|
|
46 | + [% project %]-[% c("version") %]/configure --prefix=$distdir --with-headers=$distdir/[% c("var/crosstarget") %]/include/linux [% c("var/configure_opt") %]
|
|
47 | + |
|
48 | + # For cross-compiling to work, we need to partially build GCC, then build
|
|
49 | + # glibc, then come back to finish GCC.
|
|
50 | + |
|
51 | + # Build only the components of GCC that don't need glibc, see Step 3 of
|
|
52 | + # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
|
|
53 | + cd /var/tmp/build/gcc
|
|
54 | + make -j[% c("num_procs") %] all-gcc
|
|
55 | + make install-gcc
|
|
56 | + # Removing sys-include is intended to solve a limits.h issue
|
|
57 | + rm --recursive --force $distdir/[% c("var/crosstarget") %]/sys-include
|
|
58 | + |
|
59 | + # Build glibc headers and startup files, see Step 4 of
|
|
60 | + # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
|
|
61 | + cd /var/tmp/build
|
|
62 | + mkdir glibc
|
|
63 | + cd glibc
|
|
64 | + tar -xJf $rootdir/glibc-[% c("var/glibc_version") %].tar.xz
|
|
65 | + # TODO: Remove --disable-werror once glibc is upgraded to a version that's
|
|
66 | + # designed to work with the GCC version we're using.
|
|
67 | + glibc-[% c("var/glibc_version") %]/configure --prefix=$distdir/[% c("var/crosstarget") %] --build=$MACHTYPE --host=[% c("var/crosstarget") %] --target=[% c("var/crosstarget") %] --with-headers=$distdir/[% c("var/crosstarget") %]/include --disable-multilib --disable-werror libc_cv_forced_unwind=yes
|
|
68 | + make install-bootstrap-headers=yes install-headers
|
|
69 | + make -j[% c("num_procs") %] csu/subdir_lib
|
|
70 | + install csu/crt1.o csu/crti.o csu/crtn.o $distdir/[% c("var/crosstarget") %]/lib
|
|
71 | + [% c("var/crosstarget") %]-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $distdir/[% c("var/crosstarget") %]/lib/libc.so
|
|
72 | + # stdio_lim.h is intended to solve a limits.h issue
|
|
73 | + touch $distdir/[% c("var/crosstarget") %]/include/gnu/stubs.h $distdir/[% c("var/crosstarget") %]/include/bits/stdio_lim.h
|
|
74 | + |
|
75 | + # Build compiler support library, see Step 5 of
|
|
76 | + # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
|
|
77 | + cd /var/tmp/build/gcc
|
|
78 | + make -j[% c("num_procs") %] all-target-libgcc
|
|
79 | + make install-target-libgcc
|
|
80 | + |
|
81 | + # finish building glibc, see Step 6 of
|
|
82 | + # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
|
|
83 | + cd /var/tmp/build/glibc
|
|
84 | + make -j[% c("num_procs") %]
|
|
85 | + make install
|
|
86 | + |
|
87 | + # We're done with glibc, we can now finish building gcc...
|
|
88 | + cd /var/tmp/build/gcc
|
|
89 | + |
|
90 | +[% ELSE -%]
|
|
91 | + |
|
92 | + tar -C /var/tmp/build -xf $rootdir/[% c('input_files_by_name/gcc') %]
|
|
93 | + cd /var/tmp/build/[% project %]-[% c("version") %]
|
|
94 | + ./configure --prefix=$distdir [% c("var/configure_opt") %]
|
|
95 | + |
|
96 | +[% END -%]
|
|
97 | + |
|
24 | 98 | make -j[% c("num_procs") %]
|
25 | 99 | make install
|
26 | 100 | # tor-browser-build#31321: we need a link to our GCC, to prevent some projects
|
... | ... | @@ -28,6 +102,6 @@ make install |
28 | 102 | ln -s gcc $distdir/bin/cc
|
29 | 103 | cd /var/tmp/dist
|
30 | 104 | [% c('tar', {
|
31 | - tar_src => [ project ],
|
|
105 | + tar_src => [ c('var/distdir') ],
|
|
32 | 106 | tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
|
33 | 107 | }) %] |
1 | 1 | # vim: filetype=yaml sw=2
|
2 | -filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
|
|
2 | +filename: '[% project %]-[% c("version") %]-[% IF c("var/linux-cross") %][% c("var/osname") %][% ELSE %]x86[% END %]-[% c("var/build_id") %].tar.gz'
|
|
3 | 3 | # Note: When updating the gcc version, if this includes a libstdc++
|
4 | 4 | # ABI change we should also update projects/firefox/abicheck.cc to
|
5 | 5 | # require the new version.
|
... | ... | @@ -7,14 +7,17 @@ version: '[% pc("gcc-source", "version") %]' |
7 | 7 | container:
|
8 | 8 | use_container: 1
|
9 | 9 | var:
|
10 | + distdir: gcc
|
|
10 | 11 | deps:
|
11 | 12 | - build-essential
|
12 | 13 | - libmpc-dev
|
13 | 14 | setup: |
|
14 | 15 | mkdir -p /var/tmp/dist
|
15 | 16 | tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
|
16 | - export PATH="/var/tmp/dist/gcc/bin:$PATH"
|
|
17 | - export LD_LIBRARY_PATH=/var/tmp/dist/gcc/lib64:/var/tmp/dist/gcc/lib32
|
|
17 | + export PATH="/var/tmp/dist/[% c("var/distdir") %]/bin:$PATH"
|
|
18 | + [% IF ! c("var/linux-cross") -%]
|
|
19 | + export LD_LIBRARY_PATH=/var/tmp/dist/[% c("var/distdir") %]/lib64:/var/tmp/dist/[% c("var/distdir") %]/lib32
|
|
20 | + [% END -%]
|
|
18 | 21 | |
19 | 22 | [% IF c("hardened_gcc") -%]
|
20 | 23 | # Config options for hardening-wrapper
|
... | ... | @@ -25,14 +28,14 @@ var: |
25 | 28 | export DEB_BUILD_HARDENING_PIE=1
|
26 | 29 | |
27 | 30 | # Make sure we use the hardening wrapper
|
28 | - pushd /var/tmp/dist/gcc/bin
|
|
31 | + pushd /var/tmp/dist/[% c("var/distdir") %]/bin
|
|
29 | 32 | cp /usr/bin/hardened-cc ./
|
30 | - mv gcc gcc.real
|
|
31 | - mv c++ c++.real
|
|
32 | - mv g++ g++.real
|
|
33 | - ln -sf hardened-cc gcc
|
|
34 | - ln -sf hardened-cc c++
|
|
35 | - ln -sf hardened-cc g++
|
|
33 | + mv [% c("var/target_prefix") %]gcc [% c("var/target_prefix") %]gcc.real
|
|
34 | + mv [% c("var/target_prefix") %]c++ [% c("var/target_prefix") %]c++.real
|
|
35 | + mv [% c("var/target_prefix") %]g++ [% c("var/target_prefix") %]g++.real
|
|
36 | + ln -sf hardened-cc [% c("var/target_prefix") %]gcc
|
|
37 | + ln -sf hardened-cc [% c("var/target_prefix") %]c++
|
|
38 | + ln -sf hardened-cc [% c("var/target_prefix") %]g++
|
|
36 | 39 | popd
|
37 | 40 | [% END -%]
|
38 | 41 | |
... | ... | @@ -50,8 +53,34 @@ targets: |
50 | 53 | arch_deps:
|
51 | 54 | - hardening-wrapper
|
52 | 55 | - libc6-dev-i386
|
56 | + linux-cross:
|
|
57 | + var:
|
|
58 | + target_prefix: '[% c("var/crosstarget") %]-'
|
|
59 | + distdir: gcc-cross
|
|
60 | + # TODO: Consider upgrading to a glibc that works out of the box with the
|
|
61 | + # GCC version we use. However, removing our glibc version workarounds may
|
|
62 | + # not be desirable since we want to be able to easily bump the GCC
|
|
63 | + # version without worrying about linux-cross breakage.
|
|
64 | + glibc_version: 2.26
|
|
65 | + linux_version: 4.10.1
|
|
66 | + arch_deps:
|
|
67 | + - hardening-wrapper
|
|
68 | + - libc6-dev-i386
|
|
69 | + - gawk
|
|
70 | + linux-arm:
|
|
71 | + var:
|
|
72 | + configure_opt: --disable-multilib --enable-languages=c,c++ --target=arm-linux-gnueabihf --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb
|
|
53 | 73 | |
54 | 74 | input_files:
|
55 | 75 | - project: container-image
|
56 | 76 | - project: gcc-source
|
57 | 77 | name: gcc
|
78 | + - name: binutils
|
|
79 | + project: binutils
|
|
80 | + enable: '[% c("var/linux-cross") -%]'
|
|
81 | + - URL: 'https://ftp.gnu.org/gnu/glibc/glibc-[% c("var/glibc_version") %].tar.xz'
|
|
82 | + sha256sum: e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd
|
|
83 | + enable: '[% c("var/linux-cross") -%]'
|
|
84 | + - URL: 'https://www.kernel.org/pub/linux/kernel/v4.x/linux-[% c("var/linux_version") %].tar.xz'
|
|
85 | + sha256sum: 6ca06bb5faf5f83600d7388bb623dae41df2a257de85ad5d1792e03302bc3543
|
|
86 | + enable: '[% c("var/linux-cross") -%]' |
... | ... | @@ -14,6 +14,9 @@ targets: |
14 | 14 | linux-i686:
|
15 | 15 | var:
|
16 | 16 | configure_opts: -shared linux-x86
|
17 | + linux-arm:
|
|
18 | + var:
|
|
19 | + configure_opts: -shared --cross-compile-prefix=[% c("var/crosstarget") %]- linux-armv4
|
|
17 | 20 | windows:
|
18 | 21 | var:
|
19 | 22 | flag_mwindows: ''
|