On Sun, May 15, 2022 at 6:09 PM Alexander Monakov <amona...@ispras.ru> wrote: > > On Sun, 15 May 2022, Rui Ueyama wrote: > > > > Makes sense, but I still don't understand why mold wants to discover in > > > advance whether the plugin is going to use get_symbols_v3. How would it > > > help with what mold does today to handle the _v2 case? > > > > Currently, mold restarts itself to reset the internal state of the plugin. > > If we know in advance that get_symbols_v3 is supported, we can avoid that > > restart. That should make the linker a bit faster. Also, restarting the > > linker is a hack, so we want to avoid it if possible. > > Can you simply restart the linker on first call to get_symbols_v2 instead?
I could, but it may not be a safe timing to call exec(2). I believe we are expected to call cleanup_hook after calling all_symbols_read_hook, and it is not clear what will happen if we abruptly terminate and restart the current process. For example, doesn't it leave temporary files on disk?