Skip to content

Commit

Permalink
[lld-macho] Use fixed chunk size for UUID
Browse files Browse the repository at this point in the history
Chunk size decided by the thread count makes the UUID less deterministic
(e.g. across machines with different core counts.)
Follow ELF and just use a fixed chunksize.

Fixes: #63961

Reviewed By: #lld-macho, keith

Differential Revision: https://reviews.llvm.org/D155761
  • Loading branch information
MaskRay committed Jul 20, 2023
1 parent fc5dcb0 commit 359f170
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lld/MachO/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,7 @@ void Writer::writeUuid() {
TimeTraceScope timeScope("Computing UUID");

ArrayRef<uint8_t> data{buffer->getBufferStart(), buffer->getBufferEnd()};
unsigned chunkCount = parallel::strategy.compute_thread_count() * 10;
// Round-up integer division
size_t chunkSize = (data.size() + chunkCount - 1) / chunkCount;
std::vector<ArrayRef<uint8_t>> chunks = split(data, chunkSize);
std::vector<ArrayRef<uint8_t>> chunks = split(data, 1024 * 1024);
// Leave one slot for filename
std::vector<uint64_t> hashes(chunks.size() + 1);
SmallVector<std::shared_future<void>> threadFutures;
Expand Down

0 comments on commit 359f170

Please sign in to comment.