This is implemented by the lld-link option -include:, just like --require-defined. Contrary to --require-defined, the -u/--undefined option allows the symbol to remain undefined in the end.
This should fix PR42121.
|  Differential  D62876  
[LLD] [MinGW] Support the -u/--undefined option. Authored by mstorsjo on Jun 4 2019, 1:23 PM. 
Details This is implemented by the lld-link option -include:, just like --require-defined. Contrary to --require-defined, the -u/--undefined option allows the symbol to remain undefined in the end. This should fix PR42121. 
Diff Detail 
 Event TimelineComment Actions lgtm 
 Comment Actions This is LGTM, but I believe you will have to implement -u in a more correct way. IIRC, I implemented -u as -require-defined in the ELF linker first. It seemed to be working fine until we found something weird, investigated it and then found that that was caused by an incorrect implementation of -u. So, if it is not too hard, you probably should implement it in the right way. | ||||||