aboutsummaryrefslogtreecommitdiff
path: root/devel/llvm16/files/patch-compiler-rt_lib_builtins_CMakeLists.txt
blob: e26ae7cf063462fb46b261701f1f39ab7e46ed4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- compiler-rt/lib/builtins/CMakeLists.txt.orig	2022-11-29 10:05:58 UTC
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -183,11 +183,14 @@ if(COMPILER_RT_HAS_BFLOAT16 AND NOT APPLE)
 
 # Build BF16 files only when "__bf16" is available.
 if(COMPILER_RT_HAS_BFLOAT16 AND NOT APPLE)
-  set(GENERIC_SOURCES
-    ${GENERIC_SOURCES}
+  set(GENERIC_BF_SOURCES
     truncdfbf2.c
     truncsfbf2.c
   )
+  set(GENERIC_SOURCES
+    ${GENERIC_SOURCES}
+    ${GENERIC_BF_SOURCES}
+  )
 endif()
 
 # TODO: Several "tf" files (and divtc3.c, but not multc3.c) are in
@@ -360,6 +363,10 @@ if (NOT MSVC)
       i386/chkstk2.S
     )
   endif()
+
+  if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+    list(REMOVE_ITEM i386_SOURCES ${GENERIC_BF_SOURCES})
+  endif()
 else () # MSVC
   # Use C versions of functions when building on MSVC
   # MSVC's assembler takes Intel syntax, not AT&T syntax.
@@ -703,8 +710,6 @@ else ()
     append_list_if(COMPILER_RT_ENABLE_CET -fcf-protection=full BUILTIN_CFLAGS)
   endif()
 
-  append_list_if(COMPILER_RT_HAS_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS)
-
   append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS)
 
   # These flags would normally be added to CMAKE_C_FLAGS by the llvm
@@ -775,6 +780,10 @@ else ()
         )
 
         set(deps_aarch64 lse_builtin_symlinks)
+      endif()
+
+      if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" AND ${arch} STREQUAL "i386"))
+        append_list_if(COMPILER_RT_HAS_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS)
       endif()
 
       add_compiler_rt_runtime(clang_rt.builtins