This works like /include, but is not fatal if the requested symbol wasn't found. This allows implementing the GNU ld option -u.
Details
Diff Detail
Event Timeline
Our algorithm for the ELF -u option is as follows:
- resolve all symbols normally
- for each symbol given by -u, look up the symbol table, and if a returned symbol is a lazy symbol, call fetch
This way seems better than the way how it is implemented in this patch for the following two reasons:
- we don't need any Config member as -u option values are consumed in-place
- The cost of -u is proportional to the number of -u options instead of the number of (undefined) symbols
Yes, probably - thanks!
Since we fetch objects iteratively in the COFF linker, we probably need to wait until the normal link has converged, then fetch lazy objs for -u, and then keep iterating until it converges again?
Yeah, I guess so. Technically, fetching an object file can add a new archive to the input file set via a .drctive section which could in turn make other -u symbols can be resolved, so we need to iterate the whole process until it converges. That said, I don't think we have to cover that case though.
Adjusted to make it work more like how this is implemented in the ELF linker; still failing (and properly so) if there's real undefined references to a symbol that was requested with the new option (-u in GNU ld).
I think you can write them in one line