gendwarfksyms: Add a separate pass to resolve FQNs
Using dwarf_getscopes_die to resolve fully-qualified names turns out to
be rather slow, and also results in duplicate scopes being processed,
which doesn't help. Simply adding an extra pass to resolve names for all
DIEs before processing exports is noticeably faster.
For the object files with the most exports in a defconfig+Rust build,
the performance improvement is consistently >50%:
Overall, a defconfig+DWARF5 build with gendwarfksyms and Rust is 14.8%
faster with this patch applied on my test system. Without Rust, there's
still a 10.4% improvement in build time when gendwarfksyms is used.
Note that symbol versions are unchanged with this patch.