From 7d053709d4c20c3d459a4c5d33bba44550e41092 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 25 Sep 2018 14:34:56 +0000 Subject: [PATCH] Parallelize .gdb_index string table writes. When we are creating a large .gdb_index, this change makes a difference. llvm-svn: 342978 --- lld/ELF/SyntheticSections.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index e4b1b0cc9864..a12a50626a5f 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2576,8 +2576,9 @@ void GdbIndexSection::writeTo(uint8_t *Buf) { // Write the string pool. Hdr->ConstantPoolOff = Buf - Start; - for (GdbSymbol &Sym : Symbols) + parallelForEach(Symbols, [&](GdbSymbol &Sym) { memcpy(Buf + Sym.NameOff, Sym.Name.data(), Sym.Name.size()); + }); // Write the CU vectors. for (GdbSymbol &Sym : Symbols) {