buildgcc: Remove GDB from crossgcc

It was added for a specific defunct project by a specific defunct
company.

Change-Id: Ib56ae0fdc1a50d24ff44c7879c43f8e94a5bfa95
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58380
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by:  Felix Singer <felixsinger@posteo.net>
diff --git a/util/crossgcc/.gitignore b/util/crossgcc/.gitignore
index e6ff06c..fd50eef 100644
--- a/util/crossgcc/.gitignore
+++ b/util/crossgcc/.gitignore
@@ -2,26 +2,20 @@
 binutils-*/
 build-*BINUTILS/
 build-*CMAKE/
-build-*EXPAT/
 build-*GCC/
-build-*GDB/
 build-*GMP/
 build-*LIBELF/
 build-*MPC/
 build-*MPFR/
-build-*PYTHON/
 build-*LVM/
 build-*IASL/
 cmake-*/
-expat-*/
 gcc-*/
-gdb-*/
 gmp-*/
 libelf-*/
 mingwrt-*/
 mpc-*/
 mpfr-*/
-Python-*/
 *.src/
 tarballs/
 w32api-*/
diff --git a/util/crossgcc/Makefile b/util/crossgcc/Makefile
index bb30fa4..34fb244 100644
--- a/util/crossgcc/Makefile
+++ b/util/crossgcc/Makefile
@@ -7,18 +7,11 @@
 # use BUILDGCC_OPTIONS= to set any other crossgcc command line options
 # Example: BUILDGCC_OPTIONS=-c to remove temporary files before build
 
-all all_with_gdb:
+all:
 	$(MAKE) build-i386 build-x64 build-arm \
 		build-riscv build-aarch64 build-ppc64 build-nds32le \
 		build_clang build_iasl build_nasm
 
-all_without_gdb:
-	$(MAKE) SKIP_GDB=1 build-i386 build-x64 build-arm \
-		build-riscv build-aarch64 build-ppc64 build-nds32le \
-		build_clang build_iasl build_nasm
-
-build_tools: build_gcc build_gdb
-
 ###########################################################
 ### targets to do buildgcc builds
 
@@ -26,12 +19,6 @@
 	bash ./buildgcc -p $(BUILD_PLATFORM) $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) \
 			$(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) -d $(DEST)
 
-build_gdb:
-ifeq ($(SKIP_GDB),)
-	bash ./buildgcc -p $(BUILD_PLATFORM) -P gdb $(if $(CPUS),-j $(CPUS))  $(if $(KEEP_SOURCES),-t) \
-			$(BUILDGCC_OPTIONS) -d $(DEST)
-endif
-
 build_iasl:
 	bash ./buildgcc -P iasl $(if $(CPUS),-j $(CPUS))  $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
 
@@ -48,33 +35,31 @@
 
 ###########################################################
 build-i386:
-	@$(MAKE) build_tools build_nasm BUILD_PLATFORM=i386-elf
+	@$(MAKE) build_gcc build_nasm BUILD_PLATFORM=i386-elf
 
 build-x64:
-	@$(MAKE) build_tools build_nasm BUILD_PLATFORM=x86_64-elf
+	@$(MAKE) build_gcc build_nasm BUILD_PLATFORM=x86_64-elf
 
 build-arm:
-	@$(MAKE) build_tools BUILD_PLATFORM=arm-eabi
+	@$(MAKE) build_gcc BUILD_PLATFORM=arm-eabi
 
 build-aarch64:
-	@$(MAKE) build_tools BUILD_PLATFORM=aarch64-elf
+	@$(MAKE) build_gcc BUILD_PLATFORM=aarch64-elf
 
 build-riscv:
-	# GDB is currently not supported on RISC-V
 	@$(MAKE) build_gcc BUILD_PLATFORM=riscv-elf
 
 build-ppc64:
-	@$(MAKE) build_tools BUILD_PLATFORM=powerpc64-linux-gnu
+	@$(MAKE) build_gcc BUILD_PLATFORM=powerpc64-linux-gnu
 
 build-nds32le:
-	@$(MAKE) build_tools BUILD_PLATFORM=nds32le-elf
+	@$(MAKE) build_gcc BUILD_PLATFORM=nds32le-elf
 
 clean_tempfiles:
 	rm -rf build-*
 	rm -rf binutils-* gcc-* gmp-* mpc-* mpfr-*
 	rm -rf llvm-* clang-tools-* cfe-* compiler-rt-*
 	rm -rf acpica-*
-	rm -rf gdb-*
 	rm -f  getopt
 
 clean: clean_tempfiles
@@ -83,8 +68,8 @@
 distclean: clean
 	rm -rf tarballs
 
-.PHONY: build_gcc build_iasl build_gdb build_clang all all_with_gdb \
-	all_without_gdb build_tools build-i386 build-x64 build-arm  \
+.PHONY: build_gcc build_iasl build_clang all \
+	build-i386 build-x64 build-arm  \
 	build-aarch64 build-riscv build-ppc64 build-nds32le build-nasm \
 	clean distclean clean_tempfiles
 .NOTPARALLEL:
diff --git a/util/crossgcc/Makefile.inc b/util/crossgcc/Makefile.inc
index 74de5bd..a52fbf1 100644
--- a/util/crossgcc/Makefile.inc
+++ b/util/crossgcc/Makefile.inc
@@ -5,14 +5,12 @@
 help_toolchain help::
 	@echo  '*** Toolchain targets ***'
 	@echo  '  crossgcc        - Build coreboot cross-compilers for all platforms'
-	@echo  '  crosstools      - Build coreboot cross-compiler and GDB for all platforms'
 	@echo  '  crossgcc-clean  - Remove all built coreboot cross-compilers'
 	@echo  '  iasl            - Build coreboot IASL compiler (built by all cross targets)'
 	@echo  '  clang           - Build coreboot clang compiler'
 	@echo  '  nasm            - Build coreboot nasm'
 	@echo  '  test-toolchain  - Reports if toolchain components are out of date'
 	@echo  '  crossgcc-ARCH   - Build cross-compiler for specific architecture'
-	@echo  '  crosstools-ARCH - Build cross-compiler with GDB for specific architecture'
 	@echo  '  ARCH can be "$(subst $(spc),"$(comma) ",$(TOOLCHAIN_ARCHES))"'
 	@echo  '  Use "make [target] CPUS=#" to build toolchain using multiple cores'
 	@echo  '  Use "make [target] DEST=some/path" to install toolchain there'
@@ -22,19 +20,14 @@
 # use BUILDGCC_OPTIONS= to set any crossgcc command line options
 # Example: BUILDGCC_OPTIONS='-t' will keep temporary files after build
 crossgcc: clean-for-update
-	$(MAKE) -C util/crossgcc all_without_gdb SKIP_CLANG=1
+	$(MAKE) -C util/crossgcc all SKIP_CLANG=1
 
 .PHONY: crossgcc crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 \
 	crossgcc-riscv crossgcc-power8 crossgcc-clean iasl \
-	clang crosstools-i386 crosstools-x64 crosstools-arm \
-	crosstools-aarch64 crosstools-riscv crosstools-power8 \
-	jenkins-build-toolchain nasm
+	clang jenkins-build-toolchain nasm
 
 $(foreach arch,$(TOOLCHAIN_ARCHES),crossgcc-$(arch)): clean-for-update
-	$(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl SKIP_GDB=1
-
-crosstools: clean-for-update
-	$(MAKE) -C util/crossgcc all_with_gdb SKIP_CLANG=1
+	$(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl
 
 iasl: clean-for-update
 	$(MAKE) -C util/crossgcc build_iasl
@@ -45,9 +38,6 @@
 nasm: clean-for-update
 	$(MAKE) -C util/crossgcc build_nasm
 
-$(foreach arch,$(TOOLCHAIN_ARCHES),crosstools-$(arch)): clean-for-update
-	$(MAKE) -C util/crossgcc $(patsubst crosstools-%,build-%,$@) build_iasl
-
 crossgcc-clean: clean-for-update
 	$(MAKE) -C util/crossgcc clean
 
@@ -63,7 +53,5 @@
 jenkins-build-toolchain: BUILDGCC_OPTIONS ?= -y --nocolor
 jenkins-build-toolchain:
 	$(MAKE) crossgcc clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)'
-	#TODO: Re-enable gdb build after the builders can build it again.
-	#$(MAKE) crosstools clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)'
 	PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) what-jenkins-does
 	PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) test-toolchain
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index ab8cba4..6c1a7a5 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -28,7 +28,6 @@
 LANGUAGES=
 DESTDIR=
 SAVETEMPS=0
-SKIPPYTHON=1
 BOOTSTRAP=0
 THREADS=1
 
@@ -39,10 +38,7 @@
 GCC_VERSION=11.2.0
 GCC_AUTOCONF_VERSION=2.69
 BINUTILS_VERSION=2.37
-GDB_VERSION=9.2
 IASL_VERSION=20210331
-PYTHON_VERSION=3.8.5
-EXPAT_VERSION=2.4.1
 # CLANG version number
 CLANG_VERSION=12.0.0
 CMAKE_VERSION=3.20.3
@@ -57,10 +53,7 @@
 MPC_ARCHIVE="https://ftpmirror.gnu.org/mpc/mpc-${MPC_VERSION}.tar.gz"
 GCC_ARCHIVE="https://ftpmirror.gnu.org/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz"
 BINUTILS_ARCHIVE="https://ftpmirror.gnu.org/binutils/binutils-${BINUTILS_VERSION}.tar.xz"
-GDB_ARCHIVE="https://ftpmirror.gnu.org/gdb/gdb-${GDB_VERSION}.tar.xz"
 IASL_ARCHIVE="https://acpica.org/sites/acpica/files/acpica-unix2-${IASL_VERSION}.tar.gz"
-PYTHON_ARCHIVE="https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz"
-EXPAT_ARCHIVE="https://downloads.sourceforge.net/sourceforge/expat/expat-${EXPAT_VERSION}.tar.bz2"
 # CLANG toolchain archive locations
 LLVM_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/llvm-${CLANG_VERSION}.src.tar.xz"
 CLANG_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/clang-${CLANG_VERSION}.src.tar.xz"
@@ -70,8 +63,8 @@
 NASM_ARCHIVE="https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2"
 
 ALL_ARCHIVES="$GMP_ARCHIVE $MPFR_ARCHIVE $MPC_ARCHIVE \
-	$GCC_ARCHIVE $BINUTILS_ARCHIVE $GDB_ARCHIVE $IASL_ARCHIVE \
-	$PYTHON_ARCHIVE $EXPAT_ARCHIVE $LLVM_ARCHIVE $CLANG_ARCHIVE \
+	$GCC_ARCHIVE $BINUTILS_ARCHIVE $IASL_ARCHIVE \
+	$LLVM_ARCHIVE $CLANG_ARCHIVE \
 	$CRT_ARCHIVE $CTE_ARCHIVE $CMAKE_ARCHIVE $NASM_ARCHIVE"
 
 # GCC toolchain directories
@@ -82,10 +75,7 @@
 GCC_DIR="gcc-${GCC_VERSION}"
 # shellcheck disable=SC2034
 BINUTILS_DIR="binutils-${BINUTILS_VERSION}"
-GDB_DIR="gdb-${GDB_VERSION}"
 IASL_DIR="acpica-unix2-${IASL_VERSION}"
-PYTHON_DIR="Python-${PYTHON_VERSION}"
-EXPAT_DIR="expat-${EXPAT_VERSION}"
 # CLANG toolchain directories
 LLVM_DIR="llvm-${CLANG_VERSION}.src"
 CLANG_DIR="clang-${CLANG_VERSION}.src"
@@ -464,7 +454,7 @@
 
 package_uses_targetarch()
 {
-	if [ "$1" = "GCC" ] || [ "$1" = "GDB" ] || [ "$1" = "BINUTILS" ]; then
+	if [ "$1" = "GCC" ] || [ "$1" = "BINUTILS" ]; then
 		true
 	else
 		false
@@ -573,7 +563,7 @@
 	printf "        (defaults to $TARGETDIR)\n\n"
 	printf "    [-D|--destdir <dest dir>]     destination directory to install cross compiler to\n"
 	printf "                                  (for RPM builds, default unset)\n"
-	printf "    [-P|--package <package>]      Build a specific package: GCC, CLANG, IASL, GDB\n"
+	printf "    [-P|--package <package>]      Build a specific package: GCC, CLANG, IASL\n"
 	printf "                                  (defaults to $PACKAGE)\n"
 	printf "GCC specific options:\n"
 	printf "    [-b|--bootstrap]              bootstrap the host compiler before building\n"
@@ -582,11 +572,7 @@
 	printf "                                  (defaults to $TARGETARCH)\n"
 	printf "    [-l|--languages <languages>]  comma separated list of target languages\n"
 	printf "                                  (defaults to $DEFAULT_LANGUAGES)\n"
-	printf "GDB specific options:\n"
-	printf "    [-p|--platform <platform>]    target platform to build cross compiler for\n"
-	printf "                                  (defaults to $TARGETARCH)\n"
-	printf "    [-S|--scripting]              build scripting support for GDB\n\n"
-	printf "Platforms for GCC & GDB:\n"
+	printf "Platforms for GCC:\n"
 	printf "    x86_64 i386-elf i386-mingw32 riscv-elf arm aarch64\n"
 	printf "    powerpc64le-linux-gnu nds32le-elf\n\n"
 }
@@ -798,43 +784,6 @@
 	fi
 }
 
-build_EXPAT() {
-	CC="$(hostcc host)" CXX="$(hostcxx host)" CFLAGS="$HOSTCFLAGS"
-	../${EXPAT_DIR}/configure --disable-shared --prefix="$TARGETDIR" \
-		|| touch .failed
-	$MAKE || touch .failed
-	$MAKE install DESTDIR=$DESTDIR || touch .failed
-
-	normalize_dirs
-}
-
-build_PYTHON() {
-	CC="$(hostcc host)" CXX="$(hostcxx host)" CFLAGS="$HOSTCFLAGS"
-	../${PYTHON_DIR}/configure --prefix="$TARGETDIR" \
-		|| touch .failed
-	# shellcheck disable=SC2086
-	$MAKE $JOBS || touch .failed
-	$MAKE install DESTDIR=$DESTDIR || touch .failed
-
-	normalize_dirs
-}
-
-build_GDB() {
-	export PYTHONHOME=$DESTDIR$TARGETDIR
-	if [ "$UNAME" != "FreeBSD" ] && [ "$UNAME" != "NetBSD" ]; then
-		LIBDL="-ldl"
-	fi
-	LDFLAGS="-Wl,-rpath,\$\$ORIGIN/../lib/ -L$DESTDIR$TARGETDIR/lib \
-		 -lpthread $LIBDL -lutil" \
-	CC="$(hostcc target)" CXX="$(hostcxx target)" \
-	CFLAGS="$HOSTCFLAGS -I$DESTDIR$TARGETDIR/include" \
-	../${GDB_DIR}/configure --prefix="$TARGETDIR" \
-		--target=${TARGETARCH} --disable-werror --disable-nls
-	# shellcheck disable=SC2086
-	$MAKE $JOBS || touch .failed
-	$MAKE install DESTDIR=$DESTDIR || touch .failed
-}
-
 build_IASL() {
 	RDIR=$PWD
 	cd ../$IASL_DIR/generate/unix || exit 1
@@ -906,14 +855,11 @@
 		AUTOCONF|autoconf)  printf "%s\n" "$GCC_AUTOCONF_VERSION";;
 		BINUTILS|binutils)  printf "%s\n" "$BINUTILS_VERSION";;
 		CLANG|clang)  printf "%s\n" "$CLANG_VERSION";;
-		EXPAT|expat)  printf "%s\n" "$EXPAT_VERSION";;
 		GCC|gcc)  printf "%s\n" "$GCC_VERSION";;
-		GDB|gdb)  printf "%s\n" "$GDB_VERSION";;
 		GMP|gmp)   printf "%s\n" "$GMP_VERSION";;
 		IASL|iasl) printf "%s\n" "$IASL_VERSION";;
 		MPC|mpc)  printf "%s\n" "$MPC_VERSION";;
 		MPFR|mpfr)  printf "%s\n" "$MPFR_VERSION";;
-		PYTHON|python)  printf "%s\n" "$PYTHON_VERSION";;
 		NASM|nasm) printf "%s\n" "${NASM_VERSION}";;
 		*) printf "Unknown tool %s\n" "$PRINTSUPPORTED";;
 	esac
@@ -960,7 +906,6 @@
 		-D|--destdir)		shift; DESTDIR="$1"; shift;;
 		-j|--jobs)		shift; THREADS="$1"; JOBS="-j $1"; shift;;
 		-P|--package)		shift; PACKAGE="$1"; shift;;
-		-S|--scripting)		shift; SKIPPYTHON=0;;
 		-y|--ccache)		shift; USECCACHE=1;;
 		-s|--supported)		shift; PRINTSUPPORTED="$1"; shift;;
 		-u|--urls)		shift; printf "%s\n" "$ALL_ARCHIVES"; exit 0;;
@@ -1009,14 +954,6 @@
 		NAME="${TARGETARCH} cross GCC"
 		PACKAGES="GMP MPFR MPC BINUTILS GCC"
 		;;
-	GDB|gdb)
-		NAME="${TARGETARCH} cross GDB"
-		if [ $SKIPPYTHON -eq 0 ]; then
-			PACKAGES="EXPAT PYTHON GDB"
-		else
-			PACKAGES="EXPAT GDB"
-		fi
-		;;
 	CLANG|clang)
 		NAME="LLVM clang"
 		LLVM_VERSION=${CLANG_VERSION}
@@ -1036,7 +973,7 @@
 		PACKAGES=NASM
 		;;
 	*)
-		printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, GDB, CLANG, IASL, and NASM)${NC}\n\n";
+		printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, CLANG, IASL, and NASM)${NC}\n\n";
 		exit 1
 		;;
 esac
diff --git a/util/crossgcc/patches/gdb-9.2_amd64.patch b/util/crossgcc/patches/gdb-9.2_amd64.patch
deleted file mode 100644
index 47d9a72..0000000
--- a/util/crossgcc/patches/gdb-9.2_amd64.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -urN gdb-3.orig/gdb/configure.tgt gdb-8.3/gdb/configure.tgt
---- gdb-8.3.orig/gdb/configure.tgt	2019-02-27 05:51:48.000000000 +0100
-+++ gdb-8.3/gdb/configure.tgt	2019-05-12 08:07:45.624984535 +0200
-@@ -772,6 +772,10 @@
- x86_64-*-rtems*)
- 	gdb_target_obs="${amd64_tobjs} ${i386_tobjs} i386-bsd-tdep.o"
- 	;;
-+x86_64-*-*)
-+	# Target: amd6
-+	gdb_target_obs="amd64-tdep.o i386-tdep.o i387-tdep.o"
-+	;;
- xtensa*-*-*linux*)
- 	# Target: GNU/Linux Xtensa
- 	gdb_target_obs="xtensa-linux-tdep.o symfile-mem.o linux-tdep.o"
diff --git a/util/crossgcc/patches/gdb-9.2_no-doc.patch b/util/crossgcc/patches/gdb-9.2_no-doc.patch
deleted file mode 100644
index 59ca998..0000000
--- a/util/crossgcc/patches/gdb-9.2_no-doc.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- gdb-9.1.orig/gdb/Makefile.in	2020-02-08 13:50:14.000000000 +0100
-+++ gdb-9.1/gdb/Makefile.in	2020-02-08 20:11:17.201244042 +0100
-@@ -1606,7 +1606,7 @@
- 	$(SUBDIR_TARGET_OBS) \
- 	$(SUBDIR_GCC_COMPILE_OBS)
- 
--SUBDIRS = doc @subdirs@ data-directory
-+SUBDIRS = @subdirs@ data-directory
- CLEANDIRS = $(SUBDIRS)
- 
- # List of subdirectories in the build tree that must exist.
diff --git a/util/crossgcc/patches/gdb-9.2_pythonhome.patch b/util/crossgcc/patches/gdb-9.2_pythonhome.patch
deleted file mode 100644
index 51f74db..0000000
--- a/util/crossgcc/patches/gdb-9.2_pythonhome.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -urN gdb-8.2.1.orig/gdb/python/python.c gdb-8.2.1/gdb/python/python.c
---- gdb-8.2.1.org/gdb/python/python.c	2019-01-04 12:48:32.440687758 +0100
-+++ gdb-8.2.1/gdb/python/python.c	2019-01-04 12:54:09.917677688 +0100
-@@ -1727,6 +1727,15 @@
- #endif
- #endif
- 
-+  char readlinkbuffer[BUFSIZ];
-+  int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1);
-+  readlinkbuffer[readlinks] = 0;
-+  char *executeablepath = dirname(readlinkbuffer);
-+  char *pythonhome = malloc(strlen(executeablepath) + strlen("/../") + 2);
-+  strcpy(pythonhome, executeablepath);
-+  strcat(pythonhome, "/../");
-+  setenv("PYTHONHOME", pythonhome, 1);
-+
-   Py_Initialize ();
-   PyEval_InitThreads ();
- 
diff --git a/util/crossgcc/sum/Python-3.8.5.tar.xz.cksum b/util/crossgcc/sum/Python-3.8.5.tar.xz.cksum
deleted file mode 100644
index 2f4d4ad..0000000
--- a/util/crossgcc/sum/Python-3.8.5.tar.xz.cksum
+++ /dev/null
@@ -1 +0,0 @@
-68d6c7f948801cc755905162f5ee7589595edee4  tarballs/Python-3.8.5.tar.xz
diff --git a/util/crossgcc/sum/expat-2.4.1.tar.bz2.cksum b/util/crossgcc/sum/expat-2.4.1.tar.bz2.cksum
deleted file mode 100644
index 5b520f3..0000000
--- a/util/crossgcc/sum/expat-2.4.1.tar.bz2.cksum
+++ /dev/null
@@ -1 +0,0 @@
-b677b9a1cf3a1424fda183223fae2c58f50151af  tarballs/expat-2.4.1.tar.bz2
diff --git a/util/crossgcc/sum/gdb-9.2.tar.xz.cksum b/util/crossgcc/sum/gdb-9.2.tar.xz.cksum
deleted file mode 100644
index 8bbc448..0000000
--- a/util/crossgcc/sum/gdb-9.2.tar.xz.cksum
+++ /dev/null
@@ -1 +0,0 @@
-356ee474a24bfb2f133894730916557dfea9da2e  tarballs/gdb-9.2.tar.xz