HomeFreeBSD

devel/llvm1[2345]: fix build with clang 15

Description

devel/llvm1[2345]: fix build with clang 15

When building llvm12 through llvm15 with clang 15 as host compiler, and
when compiler-rt is enabled, there will be errors due to float16
support, similar to:

In file included from /wrkdirs/usr/ports/devel/llvm15/work/llvm-project-15.0.6.src/compiler-rt/lib/builtins/extendhfsf2.c:11:
In file included from /wrkdirs/usr/ports/devel/llvm15/work/llvm-project-15.0.6.src/compiler-rt/lib/builtins/fp_extend_impl.inc:38:
/wrkdirs/usr/ports/devel/llvm15/work/llvm-project-15.0.6.src/compiler-rt/lib/builtins/fp_extend.h:44:9: error: _Float16 is not supported on this target
typedef _Float16 src_t;
        ^

This is because compiler-rt's CMake infrastructure detects float16
support at configure time, while targeting 'pure' x86_64, but then
builds parts of its tree also targeting i386.

To work around this, modify compiler-rt's top-level CMakeLists.txt to
move setting the -DCOMPILER_RT_HAS_FLOAT16 compilation flag to the
arch-specific for loop, so it only gets enabled for x86_64, and not for
i386.

For llvm15, also add another modification that removes the bfloat16
source files from the i386_SOURCES list, so these are not built for
i386.

PR: 268196
Submitted by: dim
(cherry picked from commit 830bbdd84a53aa33b48c01ee16048d1400094e26)

Details

Provenance
brooksAuthored on Dec 12 2022, 5:37 PM
Parents
R11:07affc2c7e44: devel/llvm15: Update to 15.0.6
Branches
Unknown
Tags
Unknown