Reduce memory usage when creating .gdb_index. NFC.
authorRui Ueyama <ruiu@google.com>
Tue, 10 Jul 2018 13:49:13 +0000 (13:49 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 10 Jul 2018 13:49:13 +0000 (13:49 +0000)
commit7f112ea26dc0fb7c401892330d4a3954c7f609ce
tree9df09ccb7167b93402b695170382d970c1ed2c54
parent237d42bfa53c6fb8c3fc3760b91799e8f2f9f5e9
Reduce memory usage when creating .gdb_index. NFC.

.gdb_index sections can be very large. When you are compiling
multi-gibibyte executables, they can be larger than 1 GiB. The previous
implementation of .gdb_index seems to consume too much memory.

This patch reduces memory consumption by eliminating temporary objects.
In one experiment, memory consumption of GdbIndexSection class is
reduced from 962 MiB to 228 MiB when creating a .gdb_index of 1350 GiB.

Differential Revision: https://reviews.llvm.org/D49094

llvm-svn: 336672
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h