Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If a given linker LTO plugin does not support the v3 API, we resolve all symbol names to identify the set of object files that are actually needed for linking and then restart the linker to do the same thing again from scratch, excluding the unneeded files from the beginning. We do this because the v2 API does not provide a way to "unload" an object file once it is read. To identify an unneeded object file on the second run, we serialize its name in the form of `<archive-name>:<offset-in-archive>` or just a filename. If an object file is in a thin archive, we simply used its filename. But if the same file is directly given to a linker as well as as a thin archive member, the file would accidentally be excluded on the second run. This change fixes that issue. With this change, it looks like we can build GCC 12 with LTO using mold. Fixes #454
- Loading branch information