[llvm] 9e9142c - Patch up issues with GN builds (pthread / libz)

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 13:03:02 PDT 2020


Author: Mitch Phillips
Date: 2020-06-09T13:01:40-07:00
New Revision: 9e9142cbb90901cd0e96a73d14382721250a4069

URL: https://github.com/llvm/llvm-project/commit/9e9142cbb90901cd0e96a73d14382721250a4069
DIFF: https://github.com/llvm/llvm-project/commit/9e9142cbb90901cd0e96a73d14382721250a4069.diff

LOG: Patch up issues with GN builds (pthread / libz)

Summary:
Fixes up two small issues with the gn build.

 1 - Ensures that the correct ldflag `-pthread` is provided, not just linking the library.
 2 - Ensures that libraries are linked in the same group as the dependencies. This fixes a problem where system libraries (libc) are involved in a link-order dependency that's not being fulfilled.

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80591

Added: 
    

Modified: 
    llvm/utils/gn/build/libs/pthread/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/libs/pthread/BUILD.gn b/llvm/utils/gn/build/libs/pthread/BUILD.gn
index 7708d3146033..95ff73211d69 100644
--- a/llvm/utils/gn/build/libs/pthread/BUILD.gn
+++ b/llvm/utils/gn/build/libs/pthread/BUILD.gn
@@ -5,9 +5,15 @@ config("pthread_config") {
   libs = [ "pthread" ]
 }
 
+config("pthread_link_time_config") {
+  visibility = [ ":pthread" ]
+  ldflags = [ "-pthread" ]
+}
+
 group("pthread") {
   # On Android, bionic has built-in support for pthreads.
   if (llvm_enable_threads && current_os != "win" && current_os != "android") {
     public_configs = [ ":pthread_config" ]
+    all_dependent_configs = [ ":pthread_link_time_config" ]
   }
 }


        


More information about the llvm-commits mailing list