[libc-commits] [libc] [libc] Disable `-ffreestanding` and `-fno-builtin` on the GPU build (PR #97636)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Jul 3 14:34:17 PDT 2024


================
@@ -60,7 +62,25 @@ function(_get_common_compile_options output_var flags)
       list(APPEND compile_options "-ffixed-point")
     endif()
 
-    list(APPEND compile_options "-fno-builtin")
+    # Builtin recognition causes issues when trying to implement the builtin
+    # functions themselves. The GPU backends do not use libcalls so we disable
+    # the known problematic ones. This allows inlining during LTO linking.
+    if(LIBC_TARGET_OS_IS_GPU)
+      list(APPEND compile_options "-fno-builtin-bcmp")
----------------
jhuber6 wrote:

I think something like this might be better on second thought.
```
foreach(fn strlen memmem ...)
  ...
endforeach()
```

https://github.com/llvm/llvm-project/pull/97636


More information about the libc-commits mailing list