Skip to content

[OpenMP] Fix not linking C libraries when enabled #109168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Sep 18, 2024

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

Summary:
We used to do this automatically, add it back in to do it manually.
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2024

@llvm/pr-subscribers-offload

Author: Joseph Huber (jhuber6)

Changes

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 --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 = [

Copy link
Contributor

@jplehr jplehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhuber6 jhuber6 merged commit 5f02558 into llvm:main Sep 18, 2024
8 checks passed
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
Summary:
We used to do this automatically, add it back in to do it manually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants