+ selected_cc_version=$(echo "${selected_cc}" | cut -d'-' -f2)
+ else
+ for cc in $(list_gccs) ; do
+ if "${CROSS_COMPILE:-}${cc}" -I include/ -D__LINUX_COMPILER_H -D__LINUX_COMPILER_TYPES_H -E include/linux/compiler-gcc.h; then
+ cc_version=$(echo "${cc}" | cut -d'-' -f2)
+ if { verlt "${kversion}" "5.17"; } && { vergt "${cc_version}" "11"; } ; then
+ # Using gcc-12+ with '-Wuse-after-free' breaks the build of older
+ # kernels (in particular, objtool). Some releases on LTS
+ # branches between 4.x and 5.15 can be built with gcc-12.
+ # @see https://lore.kernel.org/lkml/20494.1643237814@turing-police/
+ # @see https://gitlab.com/linux-kernel/stable/-/commit/52a9dab6d892763b2a8334a568bd4e2c1a6fde66
+ continue
+ fi
+ selected_cc="$cc"
+ selected_cc_version="$cc_version"
+ break
+ fi
+ done