[ELF] Adjust getOutputSectionName prefix order

Sorting the prefixes by decreasing frequency can improve performance.
.gcc_except_table is relatively frequent, so move it ahead.
.ctors and .dtors mostly disappear and should be the last.
This commit is contained in:
Fangrui Song 2021-12-15 00:18:58 -08:00
parent abbc2e997b
commit 3deb82cd07
1 changed files with 3 additions and 3 deletions

View File

@ -101,9 +101,9 @@ static StringRef getOutputSectionName(const InputSectionBase *s) {
return v;
for (StringRef v :
{".text", ".rodata", ".data.rel.ro", ".data", ".bss.rel.ro", ".bss",
".init_array", ".fini_array", ".ctors", ".dtors", ".tbss",
".gcc_except_table", ".tdata", ".ARM.exidx", ".ARM.extab"})
{".text", ".data.rel.ro", ".data", ".rodata", ".bss.rel.ro", ".bss",
".gcc_except_table", ".init_array", ".fini_array", ".tbss", ".tdata",
".ARM.exidx", ".ARM.extab", ".ctors", ".dtors"})
if (isSectionPrefix(v, s->name))
return v;