[llvm] [OpenMP] Fix not linking C libraries when enabled (PR #109168)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 09:57:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-offload

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
We used to do this automatically, add it back in to do it manually.


---
Full diff: https://github.com/llvm/llvm-project/pull/109168.diff


1 Files Affected:

- (modified) offload/test/lit.cfg (+6-1) 


``````````diff
diff --git a/offload/test/lit.cfg b/offload/test/lit.cfg
index 9ddef42cf90370..514bb89e0b644e 100644
--- a/offload/test/lit.cfg
+++ b/offload/test/lit.cfg
@@ -182,7 +182,12 @@ def remove_suffix_if_present(name):
         return name
 
 def add_libraries(source):
-    return source + " " + config.llvm_library_intdir + "/libomptarget.devicertl.a"
+    if config.libomptarget_has_libc:
+        return source + " -Xoffload-linker " + "-lc " + \
+               "-Xoffload-linker " + "-lm " + \
+               config.llvm_library_intdir + "/libomptarget.devicertl.a"
+    else:
+        return source + " " + config.llvm_library_intdir + "/libomptarget.devicertl.a"
 
 # Add platform targets
 host_targets = [

``````````

</details>


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


More information about the llvm-commits mailing list