@@ -16,8 +16,6 @@ GCC_TARBALL=gcc-${GCC_VERSION}.tar.xz
1616MUSL_TARBALL=musl-${MUSL_VERSION} .tar.gz
1717LINUX_TARBALL=linux-${LINUX_VERSION} .tar.xz
1818
19- export PATH=" /usr/lib/ccache/bin:$PATH "
20-
2119cd " $HOME "
2220mkdir pkgs
2321cd pkgs
@@ -78,6 +76,9 @@ fetch.sh https://gcc.gnu.org/pipermail/gcc-patches/attachments/20250220/c6211b02
7876
7977ORIGPATH=" $PATH "
8078
79+ export CC=" /usr/bin/ccache /usr/bin/gcc"
80+ export CXX=" /usr/bin/ccache /usr/bin/g++"
81+
8182for target_arch in ${TARGET_ARCH_STR// ,/ } ; do
8283 for OPT in ${OPTIMIZE_STR// ,/ } ; do
8384 echo " ==========================================================="
@@ -112,13 +113,13 @@ for target_arch in ${TARGET_ARCH_STR//,/ }; do
112113 ;;
113114 esac
114115
115- CFLAGS=" -O${OPT} -ffunction-sections -fdata-sections -fmerge-all-constants -fPIC"
116- CXXFLAGS=" -O ${OPT} -ffunction-sections -fdata-sections -fmerge-all-constants -fPIC "
117- LDFLAGS=" -Wl,--gc-sections"
116+ export CFLAGS=" -O${OPT} -ffunction-sections -fdata-sections -fmerge-all-constants -fPIC"
117+ export CXXFLAGS=" $CFLAGS "
118+ export LDFLAGS=" -Wl,--gc-sections"
118119
119120 SYSROOT=" /opt/cross/O${OPT} "
120121 PREFIX=" $SYSROOT /usr"
121- PATH=" $ORIGPATH : $ PREFIX /bin"
122+ PATH=" $PREFIX /bin: $ORIGPATH "
122123
123124 GCC_NODOCS=" MAKEINFO=/bin/true gcc_cv_prog_makeinfo_modern=no HELP2MAN=/bin/true TEXI2POD=/bin/true POD2MAN=/bin/true"
124125
@@ -163,13 +164,20 @@ for target_arch in ${TARGET_ARCH_STR//,/ }; do
163164 make install
164165 cp libssp_nonshared.a $PREFIX /$TARGET /lib/
165166
167+ if [[ " $TARGETARCH " == " $ARCH " ]]; then
168+ # Fix for aarch64 build: rsync musl headers to native sysroot
169+ rsync -av $PREFIX /$TARGET /include/ $PREFIX /include/
170+ rsync -av $PREFIX /$TARGET /lib/ $PREFIX /lib/
171+ fi
172+
166173 # Stage 2
167174 cd " $HOME " /pkgs
168175 mkdir gcc-${GCC_VERSION} -build-${TARGETARCH} -O${OPT} -final
169176 cd gcc-${GCC_VERSION} -build-${TARGETARCH} -O${OPT} -final
170177
171178 " $HOME " /pkgs/gcc-${GCC_VERSION} /configure \
172179 --target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT ${GCC_CONFIGURE_ARGS} \
180+ --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr \
173181 --disable-shared --enable-tls --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers \
174182 --enable-threads --enable-__cxa_atexit --enable-languages=c,c++ --enable-link-serialization=2 --enable-linker-build-id \
175183 --enable-libssp --disable-libsanitizer --with-system-zlib --enable-checking=release --disable-cet --disable-fixed-point \
0 commit comments