Skip to content

Commit 748a319

Browse files
Add extra checks to ensure GCC and binutils have needed support for the retain attribute
1 parent 377ef9f commit 748a319

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/ci/docker/scripts/build-gcc.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ hide_output ./configure
1111
hide_output make
1212
hide_output make install
1313

14+
if echo '.section .test,"awR",@progbits' | as - -o /dev/null 2>/dev/null; then
15+
echo "binutils assembler supports SHF_GNU_RETAIN"
16+
else
17+
echo "binutils assembler DOES NOT support SHF_GNU_RETAIN"
18+
exit 1
19+
fi
20+
21+
cd ..
22+
1423
# Note: in the future when bumping to version 10.1.0, also take care of the sed block below.
1524
# This version is specified in the Dockerfile
1625
GCC=$GCC_VERSION
@@ -54,6 +63,12 @@ hide_output ../gcc-$GCC/configure \
5463
hide_output make -j$(nproc)
5564
hide_output make install
5665
ln -s gcc /rustroot/bin/cc
66+
if echo 'int x __attribute__((used, retain));' | gcc -S -x c -o - - | grep -i '"a.*R"'; then
67+
echo "retain attribute is supported"
68+
else
69+
echo "retain attribute is not supported"
70+
exit 1
71+
fi
5772

5873
cd ..
5974
rm -rf gcc-build

0 commit comments

Comments
 (0)