From f7186bfd9626363c4217c25db82eb851da81882a Mon Sep 17 00:00:00 2001 From: vishnu Date: Thu, 9 Jul 2026 17:02:20 -0700 Subject: [PATCH 1/3] nvidia: work around GCC 16.1.x ICE compiling flcn_ls10.c GCC 16.1.x's instruction scheduler (sched2 RTL pass) segfaults with an internal compiler error while compiling _flcnDmemTransfer_LS10() in common/nvswitch/kernel/ls10/flcn_ls10.c at the default optimization level. This is a GCC codegen bug specific to this function's shape, not a defect in the source. Disable the two GCC instruction-scheduling passes (-fno-schedule-insns[2]) for this single translation unit only, gated to GCC >= 16.0.0 via the existing nv-compiler.sh version check. This unblocks builds on GCC 16 toolchains without disabling scheduling anywhere else in nv-kernel.o, and is a no-op on all other compilers/ versions. Fixes #1213 --- src/nvidia/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/nvidia/Makefile b/src/nvidia/Makefile index 0e13f2e99..d08282758 100644 --- a/src/nvidia/Makefile +++ b/src/nvidia/Makefile @@ -76,6 +76,22 @@ CFLAGS += -fno-common CFLAGS += -ffreestanding CFLAGS += -fno-stack-protector +############################################################################## +# GCC 16.1.x's instruction scheduler can crash with an internal compiler +# error (segfault during the "sched2" RTL pass) while compiling +# _flcnDmemTransfer_LS10() in flcn_ls10.c at the default optimization level. +# This is a compiler bug, not a problem with the source; disable the two +# GCC instruction-scheduling passes for this single translation unit to +# avoid triggering it, without giving up scheduling anywhere else in the +# build. See https://github.com/NVIDIA/open-gpu-kernel-modules/issues/1213 +############################################################################## +FLCN_LS10_CC_TYPE := $(call GET_COMPILER_TYPE, $(CC)) +ifeq ($(FLCN_LS10_CC_TYPE),gcc) + ifeq ($(shell $(VERSION_MK_DIR)/nv-compiler.sh version_is_at_least $(CC) 160000),1) + $(call BUILD_OBJECT_LIST,$(SRC_COMMON)/nvswitch/kernel/ls10/flcn_ls10.c): CFLAGS += -fno-schedule-insns2 -fno-schedule-insns + endif +endif + ifeq ($(TARGET_ARCH),x86_64) CFLAGS += -msoft-float CFLAGS += -mno-red-zone From c0c94e9e10c4157aee64984bc070fa76e9e8b8c4 Mon Sep 17 00:00:00 2001 From: vishnu Date: Thu, 9 Jul 2026 17:02:20 -0700 Subject: [PATCH 2/3] ci: add workflow to verify GCC16 flcn_ls10 fix --- .github/workflows/verify-gcc16-fix.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/verify-gcc16-fix.yml diff --git a/.github/workflows/verify-gcc16-fix.yml b/.github/workflows/verify-gcc16-fix.yml new file mode 100644 index 000000000..26dde8318 --- /dev/null +++ b/.github/workflows/verify-gcc16-fix.yml @@ -0,0 +1,27 @@ +name: verify-gcc16-fix + +on: + push: + branches: [ fix-gcc16-ice-flcn-ls10 ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Install GCC 16 + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt-get update + sudo apt-get install -y gcc-16 g++-16 + gcc-16 --version + + - name: Install build deps + matching kernel headers + run: | + sudo apt-get install -y build-essential libelf-dev "linux-headers-$(uname -r)" + + - name: Build kernel modules with GCC 16 + run: | + make modules -j$(nproc) CC=gcc-16 From 32dddd120ea5e7d387f80b87d5d32e905e3b2022 Mon Sep 17 00:00:00 2001 From: vishnu Date: Thu, 9 Jul 2026 17:02:20 -0700 Subject: [PATCH 3/3] ci: remove verification-only workflow before PR --- .github/workflows/verify-gcc16-fix.yml | 27 -------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/verify-gcc16-fix.yml diff --git a/.github/workflows/verify-gcc16-fix.yml b/.github/workflows/verify-gcc16-fix.yml deleted file mode 100644 index 26dde8318..000000000 --- a/.github/workflows/verify-gcc16-fix.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: verify-gcc16-fix - -on: - push: - branches: [ fix-gcc16-ice-flcn-ls10 ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - - name: Install GCC 16 - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update - sudo apt-get install -y gcc-16 g++-16 - gcc-16 --version - - - name: Install build deps + matching kernel headers - run: | - sudo apt-get install -y build-essential libelf-dev "linux-headers-$(uname -r)" - - - name: Build kernel modules with GCC 16 - run: | - make modules -j$(nproc) CC=gcc-16