Skip to content

Commit 196aedb

Browse files
committed
[ELF] Change vector<InputSection *> to SmallVector. NFC
My x86-64 lld executable is 8KiB smaller.
1 parent 783544b commit 196aedb

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lld/ELF/ICF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ template <class ELFT> class ICF {
122122

123123
void forEachClass(llvm::function_ref<void(size_t, size_t)> fn);
124124

125-
std::vector<InputSection *> sections;
125+
SmallVector<InputSection *, 0> sections;
126126

127127
// We repeat the main loop while `Repeat` is true.
128128
std::atomic<bool> repeat;

lld/ELF/SyntheticSections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3482,7 +3482,7 @@ void ARMExidxSyntheticSection::finalizeContents() {
34823482
sentinel = executableSections.back();
34833483
// Optionally merge adjacent duplicate entries.
34843484
if (config->mergeArmExidx) {
3485-
std::vector<InputSection *> selectedSections;
3485+
SmallVector<InputSection *, 0> selectedSections;
34863486
selectedSections.reserve(executableSections.size());
34873487
selectedSections.push_back(executableSections[0]);
34883488
size_t prev = 0;

lld/ELF/SyntheticSections.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ class ARMExidxSyntheticSection : public SyntheticSection {
10861086

10871087
// Links to the ARMExidxSections so we can transfer the relocations once the
10881088
// layout is known.
1089-
std::vector<InputSection *> exidxSections;
1089+
SmallVector<InputSection *, 0> exidxSections;
10901090

10911091
private:
10921092
size_t size = 0;
@@ -1095,7 +1095,7 @@ class ARMExidxSyntheticSection : public SyntheticSection {
10951095
// InputObjects, we store pointers to the executable sections that need
10961096
// .ARM.exidx sections. We can then use the dependentSections of these to
10971097
// either find the .ARM.exidx section or know that we need to generate one.
1098-
std::vector<InputSection *> executableSections;
1098+
SmallVector<InputSection *, 0> executableSections;
10991099

11001100
// The executable InputSection with the highest address to use for the
11011101
// sentinel. We store separately from ExecutableSections as merging of

lld/ELF/Writer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,8 +1570,8 @@ template <class ELFT> void Writer<ELFT>::resolveShfLinkOrder() {
15701570

15711571
// Link order may be distributed across several InputSectionDescriptions.
15721572
// Sorting is performed separately.
1573-
std::vector<InputSection **> scriptSections;
1574-
std::vector<InputSection *> sections;
1573+
SmallVector<InputSection **, 0> scriptSections;
1574+
SmallVector<InputSection *, 0> sections;
15751575
for (SectionCommand *cmd : sec->commands) {
15761576
auto *isd = dyn_cast<InputSectionDescription>(cmd);
15771577
if (!isd)

0 commit comments

Comments
 (0)