Skip to content

Commit

Permalink
remove GCC 4.2.1 build infrastructure
Browse files Browse the repository at this point in the history
As described in Warner's email message[1] to the FreeBSD-arch mailing
list we have reached GCC 4.2.1's retirement date.  At this time all
supported architectures either use in-tree Clang, or rely on external
toolchain (i.e., a contemporary GCC version from ports).

GCC 4.2.1 was released July 18, 2007 and was imported into FreeBSD later
that year, in r171825.  GCC has served us well, but version 4.2.1 is
obsolete and not used by default on any architecture in FreeBSD.  It
does not support modern C and does not support arm64 or RISC-V.

Thanks to everyone responsible for maintaining, updating, and testing
GCC in the FreeBSD base system over the years.

So long, and thanks for all the fish.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html

PR:		228919
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23124
  • Loading branch information
emaste committed Feb 29, 2020
1 parent 6be21eb commit 57f8046
Show file tree
Hide file tree
Showing 77 changed files with 637 additions and 8,128 deletions.
66 changes: 10 additions & 56 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ X${COMPILER}?= ${${COMPILER}}
# a cross compiler.
.if ${XCC:N${CCACHE_BIN}:M/*}
MK_CLANG_BOOTSTRAP= no
MK_GCC_BOOTSTRAP= no
.endif

# Pull in compiler metadata from buildworld/toolchain if possible to avoid
Expand Down Expand Up @@ -207,8 +206,6 @@ _WANT_TOOLCHAIN_CROSS_VARS= t
# Which compiler is expected to be used?
.if ${MK_CLANG_BOOTSTRAP} == "yes"
WANT_COMPILER_TYPE= clang
.elif ${MK_GCC_BOOTSTRAP} == "yes"
WANT_COMPILER_TYPE= gcc
.else
WANT_COMPILER_TYPE=
.endif
Expand All @@ -224,15 +221,6 @@ WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc
WANT_COMPILER_VERSION!= \
awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
.elif ${WANT_COMPILER_TYPE} == "gcc"
WANT_COMPILER_FREEBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h
WANT_COMPILER_FREEBSD_VERSION!= \
awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \
${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown
WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER
WANT_COMPILER_VERSION!= \
awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \
${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown
.endif
.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION
.endif # !defined(WANT_COMPILER_FREEBSD_VERSION)
Expand All @@ -243,15 +231,14 @@ WANT_COMPILER_VERSION!= \
# TARGET_ARCH!=MACHINE_ARCH.
.if ${MK_SYSTEM_COMPILER} == "yes" && \
defined(WANT_COMPILER_FREEBSD_VERSION) && \
(${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
${MK_CLANG_BOOTSTRAP} == "yes" && \
!make(xdev*) && \
${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \
(${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
# Everything matches, disable the bootstrap compiler.
MK_CLANG_BOOTSTRAP= no
MK_GCC_BOOTSTRAP= no
USING_SYSTEM_COMPILER= yes
.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE}

Expand Down Expand Up @@ -305,7 +292,7 @@ USING_SYSTEM_LINKER?= no

TEST_SYSTEM_COMPILER_VARS= \
USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \
MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \
MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP \
WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \
WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \
CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \
Expand Down Expand Up @@ -2128,10 +2115,6 @@ BOOTSTRAPPING_OSRELDATE:= 0
_strfile= usr.bin/fortune/strfile
.endif

.if ${MK_GCC} != "no" && ${MK_CXX} != "no"
_gperf= gnu/usr.bin/gperf
.endif

.if ${MK_VT} != "no"
_vtfontcvt= usr.bin/vtfontcvt
.endif
Expand Down Expand Up @@ -2377,7 +2360,6 @@ bootstrap-tools: ${_bt}-links .PHONY
${_clang_tblgen} \
${_kerberos5_bootstrap_tools} \
${_strfile} \
${_gperf} \
${_dtc} \
${_cat} \
${_kbdcontrol} \
Expand Down Expand Up @@ -2419,10 +2401,6 @@ bootstrap-tools: ${_bt}-${_tool}
_share= share/syscons/scrnmaps
.endif

.if ${MK_GCC} != "no"
_gcc_tools= gnu/usr.bin/cc/cc_tools
.endif

.if ${MK_RESCUE} != "no"
# rescue includes programs that have build-tools targets
_rescue=rescue/rescue
Expand Down Expand Up @@ -2460,8 +2438,7 @@ _bt_clean= ${CLEANDIR}
${_libmagic} \
usr.bin/mkesdb_static \
usr.bin/mkcsmapper_static \
usr.bin/vi/catalog \
${_gcc_tools}
usr.bin/vi/catalog
build-tools_${_tool}: .PHONY
${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \
cd ${.CURDIR}/${_tool}; \
Expand Down Expand Up @@ -2530,9 +2507,6 @@ _lld= usr.bin/clang/lld
.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no"
_clang_libs= lib/clang
.endif
.if ${MK_GCC_BOOTSTRAP} != "no"
_gcc= gnu/usr.bin/cc
.endif
.if ${MK_USB} != "no"
_usb_tools= stand/usb/tools
.endif
Expand All @@ -2551,7 +2525,6 @@ cross-tools: .MAKE .PHONY
${_binutils} \
${_elftctools} \
${_dtrace_tools} \
${_gcc} \
${_btxld} \
${_usb_tools}
${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \
Expand Down Expand Up @@ -2647,9 +2620,6 @@ SUBDIR_DEPEND_usr.bin/clang= lib/clang
NXBDIRS+= lib/clang
NXBDIRS+= usr.bin/clang
.endif
.if ${MK_GCC} != "no"
NXBDIRS+= gnu/usr.bin/cc
.endif
.if ${MK_BINUTILS} != "no"
NXBDIRS+= gnu/usr.bin/binutils
.endif
Expand Down Expand Up @@ -2713,27 +2683,23 @@ NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \
TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \
TARGET_TRIPLE=${MACHINE_TRIPLE:Q}
# NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to
# invoke a sub-make to reevaluate MK_GCC, etc, for NXBDIRS.
# invoke a sub-make to reevaluate MK_CLANG, etc, for NXBDIRS.
NXBMAKE+= SUBDIR_OVERRIDE='$${NXBDIRS:M*}'
# Need to avoid the -isystem logic when using clang as an external toolchain
# even if the TARGET being built for wants GCC.
NXBMAKE+= WANT_COMPILER_TYPE='$${X_COMPILER_TYPE}'
native-xtools: .PHONY
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj MK_GCC=yes
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj
# Build the bootstrap/host/cross tools that produce native binaries
# Pass along MK_GCC=yes to ensure GCC-needed build tools are built.
# We don't quite know what the NXB_TARGET wants so just build it.
${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain MK_GCC=yes
${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain
# Populate includes/libraries sysroot that produce native binaries.
# This is split out from 'toolchain' above mostly so that target LLVM
# libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without
# polluting the cross-compiler build. The LLVM/GCC libs are skipped
# here to avoid the problem but are kept in 'toolchain' so that
# needed build tools are built.
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no MK_GCC=no
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no MK_GCC=no
# Clean out improper TARGET=MACHINE files
${_+_}cd ${.CURDIR}/gnu/usr.bin/cc/cc_tools; ${NXBTMAKE} cleandir
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no
${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no
.if !defined(NO_OBJWALK)
${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj
.endif
Expand Down Expand Up @@ -2832,12 +2798,6 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_secure_lib_libcrypto} ${_secure_lib_libssl} \
${_lib_libldns} ${_secure_lib_libssh}

.if ${MK_GNUCXX} != "no"
_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
gnu/lib/libstdc++__L: lib/msun__L
gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
.endif

.if ${MK_DIALOG} != "no"
_prebuild_libs+= gnu/lib/libdialog
gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
Expand Down Expand Up @@ -2995,12 +2955,8 @@ lib/libradius__L: lib/libmd__L

lib/libproc__L: \
${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L
.if ${MK_CXX} != "no"
.if ${MK_LIBCPLUSPLUS} != "no"
.if ${MK_CXX} != "no" && ${MK_LIBCPLUSPLUS} != "no"
lib/libproc__L: lib/libcxxrt__L
.else # This implies MK_GNUCXX != "no"; see lib/libproc
lib/libproc__L: gnu/lib/libsupc++__L
.endif
.endif

.for _lib in ${_prereq_libs}
Expand Down Expand Up @@ -3358,7 +3314,6 @@ _xb-worldtmp: .PHONY
_xb-bootstrap-tools: .PHONY
.for _tool in \
${_clang_tblgen} \
${_gperf} \
${_yacc}
${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \
cd ${.CURDIR}/${_tool}; \
Expand All @@ -3377,8 +3332,7 @@ XDEVDIRS= \
${_binutils} \
${_elftctools} \
usr.bin/ar \
${_clang} \
${_gcc}
${_clang}

_xb-cross-tools: .PHONY
.for _tool in ${XDEVDIRS}
Expand Down
Loading

0 comments on commit 57f8046

Please sign in to comment.