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
This commit is contained in:
Mitch Phillips 2020-05-26 15:01:34 -07:00
parent a7e0d55de0
commit 9e9142cbb9
1 changed files with 6 additions and 0 deletions

View File

@ -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" ]
}
}