diff options
| -rw-r--r-- | lld/ELF/Driver.cpp | 5 | ||||
| -rw-r--r-- | lld/ELF/ICF.cpp | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index f83166870a4..a0987259d24 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1989,11 +1989,6 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) { // Two input sections with different output sections should not be folded. // ICF runs after processSectionCommands() so that we know the output sections. if (config->icf != ICFLevel::None) { - // Compute isPreemptible early to be used by ICF. We may add more symbols - // later, so this loop cannot be merged with the later computeIsPreemptible - // pass which is used by scanRelocations(). - for (Symbol *sym : symtab->symbols()) - sym->isPreemptible = computeIsPreemptible(*sym); findKeepUniqueSections<ELFT>(args); doIcf<ELFT>(); } diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 95f26c46b37..5e38066f45b 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -452,6 +452,12 @@ static void print(const Twine &s) { // The main function of ICF. template <class ELFT> void ICF<ELFT>::run() { + // Compute isPreemptible early. We may add more symbols later, so this loop + // cannot be merged with the later computeIsPreemptible() pass which is used + // by scanRelocations(). + for (Symbol *sym : symtab->symbols()) + sym->isPreemptible = computeIsPreemptible(*sym); + // Collect sections to merge. for (InputSectionBase *sec : inputSections) { auto *s = cast<InputSection>(sec); |

