summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2024-02-14 18:35:48 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2024-02-15 13:11:33 +0100
commit09f90fac9092de13a71723f849794474831fd678 (patch)
tree2b300d76bb1ad7133fddb2fe72face269bbaeec6 /etc
parentbda3dabe37fdde648f90ce5aa4b20d7336570cf0 (diff)
downloadjustbuild-09f90fac9092de13a71723f849794474831fd678.tar.gz
Replace glibc sync stubs when linking pthreads
... glibc provides synchronization stubs for single-threaded environments as weak symobls. When linking pthreads, these weak symbols must be replaced by the strong symbols provided by the pthread library. For dynamically linking pthreads, this is done automatically. However, to support this for static linking, we must ensure to link the whole archive.
Diffstat (limited to 'etc')
-rw-r--r--etc/import/TARGETS.boringssl3
-rw-r--r--etc/import/TARGETS.re23
-rw-r--r--etc/import/absl/base/TARGETS.absl4
-rw-r--r--etc/import/absl/random/TARGETS.absl3
-rw-r--r--etc/import/absl/synchronization/TARGETS.absl2
-rw-r--r--etc/import/src/TARGETS.archive2
-rw-r--r--etc/import/src/TARGETS.curl6
-rw-r--r--etc/import/src/compiler/TARGETS.grpc3
-rw-r--r--etc/import/src/util/TARGETS.git23
9 files changed, 19 insertions, 10 deletions
diff --git a/etc/import/TARGETS.boringssl b/etc/import/TARGETS.boringssl
index 2c95bc0f..158b3bc5 100644
--- a/etc/import/TARGETS.boringssl
+++ b/etc/import/TARGETS.boringssl
@@ -58,7 +58,8 @@
, "private-hdrs": ["fips_fragments", "crypto_internal_headers"]
, "srcs": ["crypto_sources", "crypto_sources_asm"]
, "pure C": ["YES"]
- , "private-ldflags": ["-pthread"]
+ , "private-ldflags":
+ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
}
, "ssl-lib":
{ "type": ["@", "rules", "CC", "library"]
diff --git a/etc/import/TARGETS.re2 b/etc/import/TARGETS.re2
index 83f12755..459c597c 100644
--- a/etc/import/TARGETS.re2
+++ b/etc/import/TARGETS.re2
@@ -66,6 +66,7 @@
]
, "hdrs":
["re2/filtered_re2.h", "re2/re2.h", "re2/set.h", "re2/stringpiece.h"]
- , "private-ldflags": ["-pthread"]
+ , "private-ldflags":
+ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
}
}
diff --git a/etc/import/absl/base/TARGETS.absl b/etc/import/absl/base/TARGETS.absl
index 22b408c5..c1a7713b 100644
--- a/etc/import/absl/base/TARGETS.absl
+++ b/etc/import/absl/base/TARGETS.absl
@@ -47,7 +47,7 @@
, "private-ldflags":
{ "type": "++"
, "$1":
- [ ["-pthread"]
+ [ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
, { "type": "case*"
, "expr":
{ "type": "lookup"
@@ -367,7 +367,7 @@
, "private-ldflags":
{ "type": "++"
, "$1":
- [ ["-pthread"]
+ [ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
, { "type": "case"
, "expr":
{ "type": "var"
diff --git a/etc/import/absl/random/TARGETS.absl b/etc/import/absl/random/TARGETS.absl
index db5b83ee..98f4c1c4 100644
--- a/etc/import/absl/random/TARGETS.absl
+++ b/etc/import/absl/random/TARGETS.absl
@@ -123,7 +123,8 @@
, "stage": ["absl", "random"]
, "hdrs": ["internal/pool_urbg.h"]
, "srcs": ["internal/pool_urbg.cc"]
- , "private-ldflags": ["-pthread"]
+ , "private-ldflags":
+ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
, "deps":
[ "internal_randen"
, "internal_seed_material"
diff --git a/etc/import/absl/synchronization/TARGETS.absl b/etc/import/absl/synchronization/TARGETS.absl
index 84a1a964..09bb1700 100644
--- a/etc/import/absl/synchronization/TARGETS.absl
+++ b/etc/import/absl/synchronization/TARGETS.absl
@@ -45,7 +45,7 @@
, "private-ldflags":
{ "type": "++"
, "$1":
- [ ["-pthread"]
+ [ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
, { "type": "case"
, "expr":
{ "type": "var"
diff --git a/etc/import/src/TARGETS.archive b/etc/import/src/TARGETS.archive
index b71c4f89..a2ffdfa7 100644
--- a/etc/import/src/TARGETS.archive
+++ b/etc/import/src/TARGETS.archive
@@ -6,7 +6,7 @@
{ "type": "if"
, "cond":
{"type": "==", "$1": {"type": "var", "name": "OS"}, "$2": "linux"}
- , "then": ["-pthread"]
+ , "then": ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
}
}
, "archive_crypt":
diff --git a/etc/import/src/TARGETS.curl b/etc/import/src/TARGETS.curl
index 29fd9706..60164c0e 100644
--- a/etc/import/src/TARGETS.curl
+++ b/etc/import/src/TARGETS.curl
@@ -57,7 +57,11 @@
, "then":
{ "type": "case*"
, "expr": {"type": "var", "name": "OS"}
- , "case": [["linux", ["-pthread"]]]
+ , "case":
+ [ [ "linux"
+ , ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
+ ]
+ ]
}
}
}
diff --git a/etc/import/src/compiler/TARGETS.grpc b/etc/import/src/compiler/TARGETS.grpc
index 13538d46..d9d5fa57 100644
--- a/etc/import/src/compiler/TARGETS.grpc
+++ b/etc/import/src/compiler/TARGETS.grpc
@@ -54,6 +54,7 @@
, "name": ["grpc_cpp_plugin"]
, "srcs": ["cpp_plugin.cc"]
, "private-deps": ["grpc_plugin_support"]
- , "private-ldflags": ["-pthread"]
+ , "private-ldflags":
+ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
}
}
diff --git a/etc/import/src/util/TARGETS.git2 b/etc/import/src/util/TARGETS.git2
index cac75649..cca52197 100644
--- a/etc/import/src/util/TARGETS.git2
+++ b/etc/import/src/util/TARGETS.git2
@@ -82,7 +82,8 @@
, "$1":
[ { "type": "if"
, "cond": {"type": "var", "name": "USE_THREADS"}
- , "then": ["-pthread"]
+ , "then":
+ ["-pthread", "-Wl,--whole-archive,-lpthread,--no-whole-archive"]
}
, { "type": "case"
, "expr": {"type": "var", "name": "OS"}