cosmopolitan/third_party/gcc/upgrade-cosmo-gcc.sh
Justine Tunney afc58a8b41
Upgrade cosmopolitan gcc and binutils to 2.35.2
This change upgrades to the latest portcosmo gcc patch
6728fe1a25185560603ca312a8d4352af2a4e515 which lets us avoid needing to
define __tmpcosmo_FOO constants. We're now using an appropriate binutils
version for GCC 11. The older binutils sometimes wasn't able to print
backtraces, due to not being able to find a .debug_ranges section.

This is breaking change for /opt/cosmos libraries :'( due to this weird
"error: need linked-to section for --gc-sections" that pops up.

Please run `make clean` in the monorepo before rebuilding.
2023-06-18 00:54:14 -07:00

36 lines
1,022 B
Bash
Executable file

#!/bin/sh
ARCH=${1:-x86_64}
IMPORT=${2:-/opt/cross11portcosmo}
PREFIX=third_party/gcc
OLDVERSION=11.2.0
NEWVERSION=11.2.0
rm -rf o/third_party/gcc
if [ $OLDVERSION != $NEWVERSION ]; then
mv $PREFIX/libexec/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/libexec/gcc/$ARCH-linux-musl/$NEWVERSION
mv $PREFIX/lib/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/lib/gcc/$ARCH-linux-musl/$NEWVERSION
sed -i -e "s/$OLDVERSION/$NEWVERSION/g" $(find $PREFIX -name \*.sym | grep $ARCH)
fi
FILES="
$ARCH-linux-musl/bin/ld.bfd
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/collect2
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/cc1
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/cc1plus
bin/$ARCH-linux-musl-as
bin/$ARCH-linux-musl-gcc
bin/$ARCH-linux-musl-g++
bin/$ARCH-linux-musl-nm
bin/$ARCH-linux-musl-objcopy
bin/$ARCH-linux-musl-c++filt
bin/$ARCH-linux-musl-addr2line
bin/$ARCH-linux-musl-objdump
bin/$ARCH-linux-musl-gcc-nm
bin/$ARCH-linux-musl-strip
"
for f in $FILES; do
cp -f $IMPORT/$f $PREFIX/$f || exit
gzip -f9 $PREFIX/$f || exit
done