// this means to map the primary and thread stacks as PROT_MTE. Note: This is
// not supported on Android 11 & 12.
bool androidMemtagStack;
+
+ unsigned threadCount;
};
// The only instance of Configuration struct.
}
if (auto *arg = args.getLastArg(OPT_thinlto_jobs))
config->thinLTOJobs = arg->getValue();
+ config->threadCount = parallel::strategy.compute_thread_count();
if (config->ltoo > 3)
error("invalid optimization level for LTO: " + Twine(config->ltoo));
// of millions for very large executables, so we use multi-threading to
// speed it up.
constexpr size_t numShards = 32;
- size_t concurrency = PowerOf2Floor(
- std::min<size_t>(hardware_concurrency(parallel::strategy.ThreadsRequested)
- .compute_thread_count(),
- numShards));
+ const size_t concurrency =
+ PowerOf2Floor(std::min<size_t>(config->threadCount, numShards));
// A sharded map to uniquify symbols by name.
auto map =
// Concurrency level. Must be a power of 2 to avoid expensive modulo
// operations in the following tight loop.
- size_t concurrency = PowerOf2Floor(
- std::min<size_t>(hardware_concurrency(parallel::strategy.ThreadsRequested)
- .compute_thread_count(),
- numShards));
+ const size_t concurrency =
+ PowerOf2Floor(std::min<size_t>(config->threadCount, numShards));
// Add section pieces to the builders.
parallelFor(0, concurrency, [&](size_t threadId) {
StringRef relaDynName = config->isRela ? ".rela.dyn" : ".rel.dyn";
- const unsigned threadCount = parallel::strategy.compute_thread_count();
+ const unsigned threadCount = config->threadCount;
for (Partition &part : partitions) {
auto add = [&](SyntheticSection &sec) {
sec.partition = part.getNumber();