Bug 293293 - devel/spirv-llvm-translator: fix build of llvm12 flavor with clang 21
Summary: devel/spirv-llvm-translator: fix build of llvm12 flavor with clang 21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-02-19 12:31 UTC by Dimitry Andric
Modified: 2026-02-20 17:54 UTC (History)
0 users

See Also:
jbeich: maintainer-feedback+
jbeich: merge-quarterly+


Attachments
devel/spirv-llvm-translator: fix build of llvm12 flavor with clang 21 (3.84 KB, patch)
2026-02-19 12:32 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2026-02-19 12:31:14 UTC
With clang 21 the llvm12 flavor of devel/spirv-llvm-translator fails to
build, with errors similar to:

    In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLTypeToSPIRV.cpp:44:
    In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLUtil.h:42:
    In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/SPIRVInternal.h:43:
    In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVEnum.h:44:
    In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVOpCode.h:45:
    /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:120:31: error: constexpr variable 'FunctionControlOptNoneINTELMask' must be initialized by a constant expression
      120 | constexpr FunctionControlMask FunctionControlOptNoneINTELMask =
          |                               ^
      121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:121:5: note: integer value 65536 is outside the valid range of values [0, 15] for the enumeration type 'FunctionControlMask'
      121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
          |     ^

This is because clang 21 no longer allows enum values outside of the
valid range. Upstream spirv refactored a lot in this area, so the llvm13
flavor and later compile fine with clang 21.

Fix it by explicitly making the underlying type for the two affected
enums uint32_t.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-02-19 12:32:08 UTC
Created attachment 268186 [details]
devel/spirv-llvm-translator: fix build of llvm12 flavor with clang 21
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-02-20 15:02:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a93fd63ae97f7bb7737ede009224b492545f0e95

commit a93fd63ae97f7bb7737ede009224b492545f0e95
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2026-02-20 14:28:12 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2026-02-20 15:01:24 +0000

    devel/spirv-llvm-translator: split port patches by flavor

    Add patches to files.llvm*/ instead of files/ subdirectory.
    For now, it lacks support for patches common to all flavors.

    PR:             293293

 devel/spirv-llvm-translator/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-02-20 15:02:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d50aa610760e499062d3f050b4402e97531fe376

commit d50aa610760e499062d3f050b4402e97531fe376
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-19 12:31:30 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2026-02-20 15:01:24 +0000

    devel/spirv-llvm-translator: unbreak llvm12 flavor with clang 21

    With clang 21 the llvm12 flavor of devel/spirv-llvm-translator fails to
    build, with errors similar to:

        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLTypeToSPIRV.cpp:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLUtil.h:42:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/SPIRVInternal.h:43:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVEnum.h:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVOpCode.h:45:
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:120:31: error: constexpr variable 'FunctionControlOptNoneINTELMask' must be initialized by a constant expression
          120 | constexpr FunctionControlMask FunctionControlOptNoneINTELMask =
              |                               ^
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:121:5: note: integer value 65536 is outside the valid range of values [0, 15] for the enumeration type 'FunctionControlMask'
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ^

    This is because clang 21 no longer allows enum values outside of the
    valid range. Upstream spirv refactored a lot in this area, so the llvm13
    flavor and later compile fine with clang 21.

    Fix it by explicitly making the underlying type for the two affected
    enums uint32_t.

    PR:             293293
    MFH:            2026Q1

 .../files.llvm12/patch-clang21 (new)               | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-02-20 15:04:47 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b01beecef8b6fb192a6fb9830f9fd8a6435fb83d

commit b01beecef8b6fb192a6fb9830f9fd8a6435fb83d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-19 12:31:30 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2026-02-20 15:04:22 +0000

    devel/spirv-llvm-translator: unbreak llvm12 flavor with clang 21

    With clang 21 the llvm12 flavor of devel/spirv-llvm-translator fails to
    build, with errors similar to:

        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLTypeToSPIRV.cpp:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLUtil.h:42:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/SPIRVInternal.h:43:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVEnum.h:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVOpCode.h:45:
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:120:31: error: constexpr variable 'FunctionControlOptNoneINTELMask' must be initialized by a constant expression
          120 | constexpr FunctionControlMask FunctionControlOptNoneINTELMask =
              |                               ^
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:121:5: note: integer value 65536 is outside the valid range of values [0, 15] for the enumeration type 'FunctionControlMask'
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ^

    This is because clang 21 no longer allows enum values outside of the
    valid range. Upstream spirv refactored a lot in this area, so the llvm13
    flavor and later compile fine with clang 21.

    Fix it by explicitly making the underlying type for the two affected
    enums uint32_t.

    PR:             293293
    MFH:            2026Q1
    (cherry picked from commit d50aa610760e499062d3f050b4402e97531fe376)

 .../files.llvm12/patch-clang21 (new)               | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-02-20 15:04:48 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=90f512cec35bc417a83b7eb72b2cc94547bbb678

commit 90f512cec35bc417a83b7eb72b2cc94547bbb678
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2026-02-20 14:28:12 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2026-02-20 15:04:22 +0000

    devel/spirv-llvm-translator: split port patches by flavor

    Add patches to files.llvm*/ instead of files/ subdirectory.
    For now, it lacks support for patches common to all flavors.

    PR:             293293
    (cherry picked from commit a93fd63ae97f7bb7737ede009224b492545f0e95)

 devel/spirv-llvm-translator/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 6 Jan Beich freebsd_committer freebsd_triage 2026-02-20 15:07:37 UTC
Thanks. Landed after adjusting style.

In future, please, attach patches in "git am" compatible format such as via "git format-patch" (instead of "git log -p" or similar). Makes it easy to preserve your commit message/author/timestamp in case of edits.
Comment 7 Dimitry Andric freebsd_committer freebsd_triage 2026-02-20 17:54:09 UTC
Thanks. I wasn't aware of the files.${FLAVOR} method, otherwise I'd have used that!