File tree Expand file tree Collapse file tree
host-x86_64/dist-x86_64-linux Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,23 @@ python3 ../x.py build --set rust.debug=true opt-dist
1616# Use GCC for building GCC components, as it seems to behave badly when built with Clang
1717# Only build GCC on full builds, not try builds
1818if [ " ${DIST_TRY_BUILD:- 0} " == " 0" ]; then
19- CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist \
20- gcc-dev \
21- gcc
19+ # We add the binutils binary path to ensure that it uses the 2.47 version of binutils,
20+ # which is needed for the `retain` attribute feature.
21+ export PATH=" /tmp/binutils-install/bin:$PATH "
22+
23+ CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ \
24+ python3 ../x.py dist \
25+ gcc-dev \
26+ gcc
27+
28+ gcc_path=" ./build/$HOSTS /gcc/$HOSTS /install/bin/gcc"
29+ if echo ' int x __attribute__((used, retain));' | \
30+ " $gcc_path " -S -x c -o - - | grep -i ' "a.*R"' ; then
31+ echo " retain attribute is supported"
32+ else
33+ echo " retain attribute is not supported"
34+ # We display the generated asm just in case...
35+ echo ' int x __attribute__((used, retain));' | " $gcc_path " -S -x c -o - -
36+ exit 1
37+ fi
2238fi
Original file line number Diff line number Diff line change @@ -4,6 +4,30 @@ set -eux
44
55source shared.sh
66
7+ # We have to build our own binutils for the GCC build, because the default CentOS 7 binutils are
8+ # too old, and they do not support `SHF_GNU_RETAIN`.
9+ BINUTILS=" 2.47"
10+ BINUTILS_ROOT_PATH=" $( pwd) /binutils-install"
11+ BINUTILS_PATH=" $BINUTILS_ROOT_PATH /bin"
12+ curl https://ci-mirrors.rust-lang.org/rustc/gcc/binutils-$BINUTILS .tar.xz | xzcat | tar xf -
13+ mkdir binutils-build
14+ mkdir " $BINUTILS_ROOT_PATH "
15+ cd binutils-build
16+
17+ hide_output ../binutils-$BINUTILS /configure --prefix=" $BINUTILS_ROOT_PATH " --disable-werror
18+ hide_output make -j$( nproc)
19+ hide_output make install
20+
21+ cd ..
22+ rm -rf binutils-build binutils-$BINUTILS
23+
24+ if echo ' .section .test,"awR",@progbits' | " $BINUTILS_PATH " /as - -o /dev/null 2> /dev/null; then
25+ echo " binutils assembler supports SHF_GNU_RETAIN"
26+ else
27+ echo " binutils assembler DOES NOT support SHF_GNU_RETAIN"
28+ exit 1
29+ fi
30+
731# Note: in the future when bumping to version 10.1.0, also take care of the sed block below.
832# This version is specified in the Dockerfile
933GCC=$GCC_VERSION
You can’t perform that action at this time.
0 commit comments