[PATCH] D70378: [LLD][COFF] Fix missing cache cleanup in COFF::link()
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 21:40:10 PST 2019
ruiu added a comment.
I share your concern and I'm sorry about leaving so many global variables as uninitialized in the second run of the linker in the same process. But I'd like to find and fix the problems without abolishing global variables in lld, as I don't actually dislike them. One thing we could do is initializing global variables with invalid data -- like -1 or {nullptr} so that you'd get an error even on the first run if you do not reset them before use. I'll create a patch and send it to you.
================
Comment at: lld/COFF/DebugTypes.cpp:93
+void lld::coff::clearTypeServerSourceInstances() { TypeServerSource::instances.clear(); }
+
----------------
Instead of defining a new function, you could add `TypeServerSource::instances.clear()` at the beginning of `loadTypeServerSource()`.
================
Comment at: lld/COFF/Writer.cpp:85
+void OutputSection::clearOutputSections() { outputSections.clear(); }
+
----------------
Likewise, I'd add `outputSections.clear()` at the beginning of Writer::run().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70378/new/
https://reviews.llvm.org/D70378
More information about the llvm-commits
mailing list