This patch implements in the X86_64 ELF lld backend yet another feature that was
only available in the MIPS backend. However, this patch changes generic ELF
classes to make it trivial for other ELF backends to use this logic too. When
creating a dynamic executable that has dynamic relocations against weak
undefined symbols, these symbols must be exported to the dynamic symbol table
to seek a possible resolution at run time.
A common use case is the gmon_start weak glibc undefined symbol.
If we are creating a dynamic relocation for a symbol, that symbol should go in the dynamic symbol table. Looks like this code is removing undefined symbols that are targets of dynamic relocations.