@@ -19,7 +19,7 @@ GCC_URL="https://github.com/antoyo/gcc.git"
1919GCC_BRANCH=" master"
2020
2121CG_GCC_BRANCH=" master"
22- CG_GCC_URL=" https://github.com/rust-lang/rustc_codegen_gcc.git "
22+ CG_GCC_URL=" https://github.com/rust-lang/gcc "
2323
2424GCC_REVISION=$( get_remote_revision " ${GCC_URL} " " heads/${GCC_BRANCH} " )
2525CG_GCC_REVISION=$( get_remote_revision " ${CG_GCC_URL} " " heads/${CG_GCC_BRANCH} " )
@@ -33,6 +33,53 @@ initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
3333
3434OUTPUT=$( realpath " ${OUTPUT} " )
3535
36+ # #
37+ # # Build customized GCC with libgccjit
38+ # #
39+ # # We can't use prebuilt ones because our runner are using ubuntu 22.04 which
40+ # # does not have a recent enough glibc (error at runtime).
41+
42+ git clone --depth 1 " ${GCC_URL} " --branch " ${GCC_BRANCH} "
43+
44+ rm -rf gcc-build gcc-install
45+ mkdir -p gcc-build " $PREFIX "
46+
47+ pushd gcc-build
48+ LANGUAGES=jit
49+ PKGVERSION=" Compiler-Explorer-Build-${REVISION} "
50+
51+ CONFIG=(" --enable-checking=release"
52+ " --enable-host-shared"
53+ " --build=x86_64-linux-gnu"
54+ " --host=x86_64-linux-gnu"
55+ " --target=x86_64-linux-gnu"
56+ " --disable-bootstrap"
57+ " --enable-multiarch"
58+ " --with-abi=m64"
59+ " --with-multilib-list=m32,m64,mx32"
60+ " --enable-multilib"
61+ " --enable-clocale=gnu"
62+ " --enable-languages=${LANGUAGES} "
63+ " --enable-ld=yes"
64+ " --enable-gold=yes"
65+ " --enable-libstdcxx-debug"
66+ " --enable-libstdcxx-time=yes"
67+ " --enable-linker-build-id"
68+ " --enable-lto"
69+ " --enable-plugins"
70+ " --enable-threads=posix"
71+ " --with-pkgversion=\" ${PKGVERSION} \" "
72+ " --with-pic" )
73+
74+ ../gcc/configure --prefix=" ${PREFIX} " " ${CONFIG[@]} "
75+
76+ make -j" $( nproc) "
77+ make -j" $( nproc) " install-strip
78+ popd
79+
80+ libgccjit_path=$( dirname $( readlink -f ` find " $PREFIX " -name libgccjit.so` ) )
81+
82+ #
3683# Needed because the later y.sh will call "git am" and this needs user info.
3784git config --global user.email
" [email protected] " 3885git config --global user.name " John Nope"
@@ -73,6 +120,9 @@ pushd rustc_codegen_gcc
73120
74121# Do default config, as described in the "Quick start" guide on the project's
75122# page.
123+ echo " gcc-path = \" $libgccjit_path \" " > config.toml
124+ echo " download-gccjit = false" >> config.toml
125+
76126cp config.example.toml config.toml
77127
78128./y.sh prepare
@@ -102,11 +152,7 @@ mkdir -p toolroot
102152mv rustup/toolchains/* /* toolroot/
103153
104154# libgccjit
105- find -name " libgccjit.so" -exec mv {} toolroot/lib ' ;'
106-
107- pushd toolroot/lib
108- ln -s libgccjit.so libgccjit.so.0
109- popd
155+ mv $PREFIX /lib/libgccjit.so* toolroot/lib
110156
111157# cg_gcc backend
112158mv ./rustc_codegen_gcc/target/release/librustc_codegen_gcc.so toolroot/lib
0 commit comments