[ELF] Make InputFile smaller
authorFangrui Song <i@maskray.me>
Wed, 15 Dec 2021 04:55:32 +0000 (20:55 -0800)
committerFangrui Song <i@maskray.me>
Wed, 15 Dec 2021 04:55:32 +0000 (20:55 -0800)
commit1ff1d50d9f461e005085db5ec94d21f15d701a90
treec0d52f9675935ee61290c6cd811f11f291e9acac
parentd4f3af2f6c53198b00d932a625f78cbf9b5cfdd1
[ELF] Make InputFile smaller

sizeof(ObjFile<ELF64LE>) is decreased from 344 to 272 on an ELF64 system.
In a large link with 30000 ObjFiles, this may be 2+MiB saving.

Change std::vector members to SmallVector, and std::string members to
SmallString<0> (these members typically don't benefit from small string optimization).
On Linux x86-64 the lld executable is ~6k smaller.
lld/ELF/Config.h
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
lld/ELF/InputSection.cpp