mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-06 01:38:35 +00:00
Correctly test the custom GCC built in CI
This commit is contained in:
@@ -18,4 +18,15 @@ if [ "${DIST_TRY_BUILD:-0}" == "0" ]; then
|
||||
CC=/rustroot/bin/cc CXX=/rustroot/bin/c++ python3 ../x.py dist \
|
||||
gcc-dev \
|
||||
gcc
|
||||
# We confirm that the built GCC has support for the `retain` attribute.
|
||||
# FIXME: Maybe get the path from `.x.py` instead?
|
||||
gcc_path="./build/$HOSTS/gcc/$HOSTS/install/bin/gcc"
|
||||
if echo 'int x __attribute__((used, retain));' | "$gcc_path" -S -x c -o - - | grep -i '"a.*R"'; then
|
||||
echo "retain attribute is supported"
|
||||
else
|
||||
echo "retain attribute is not supported"
|
||||
# We display the generated asm just in case...
|
||||
echo 'int x __attribute__((used, retain));' | "$gcc_path" -S -x c -o - -
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -6,22 +6,22 @@ source shared.sh
|
||||
|
||||
BINUTILS="2.47"
|
||||
curl https://ci-mirrors.rust-lang.org/rustc/gcc/binutils-$BINUTILS.tar.xz | xzcat | tar xf -
|
||||
cd binutils-$BINUTILS
|
||||
hide_output ./configure --prefix=/rustroot
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure --prefix=/rustroot
|
||||
hide_output make -j$(nproc)
|
||||
hide_output make install
|
||||
|
||||
if echo '.section .test,"awR",@progbits' | /rustroot/bin/as - -o /dev/null 2>/dev/null; then
|
||||
cd ..
|
||||
rm -rf binutils-build binutils-$BINUTILS
|
||||
|
||||
if echo '.section .test,"awR",@progbits' | as - -o /dev/null 2>/dev/null; then
|
||||
echo "binutils assembler supports SHF_GNU_RETAIN"
|
||||
else
|
||||
echo "binutils assembler DOES NOT support SHF_GNU_RETAIN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
AS_PATH="/rustroot/bin/as"
|
||||
LD_PATH="/rustroot/bin/ld"
|
||||
|
||||
cd ..
|
||||
|
||||
# Note: in the future when bumping to version 10.1.0, also take care of the sed block below.
|
||||
# This version is specified in the Dockerfile
|
||||
@@ -61,9 +61,6 @@ export PATH=/rustroot/bin:$PATH
|
||||
# which is included in librustc_driver.so
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--prefix=/rustroot \
|
||||
--with-bintuils=/rustroot/bin \
|
||||
--with-as=$AS_PATH \
|
||||
--with-ld=$LD_PATH \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-gnu-unique-object \
|
||||
--enable-cxx-flags='-fno-reorder-blocks-and-partition'
|
||||
@@ -71,15 +68,6 @@ hide_output make -j$(nproc)
|
||||
hide_output make install
|
||||
ln -s gcc /rustroot/bin/cc
|
||||
|
||||
if echo 'int x __attribute__((used, retain));' | /rustroot/bin/gcc -S -x c -o - - | grep -i '"a.*R"'; then
|
||||
echo "retain attribute is supported"
|
||||
else
|
||||
echo "retain attribute is not supported"
|
||||
# We display the generated asm just in case...
|
||||
echo 'int x __attribute__((used, retain));' | /rustroot/bin/gcc -S -x c -o - -
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
rm -rf gcc-build
|
||||
rm -rf gcc-$GCC
|
||||
|
||||
Reference in New Issue
Block a user