This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [MinGW] Support the -u/--undefined option.
ClosedPublic

Authored by mstorsjo on Jun 4 2019, 1:23 PM.

Details

Summary

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

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Jun 4 2019, 1:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2019, 1:24 PM
rnk accepted this revision.Jun 4 2019, 3:36 PM

lgtm

MinGW/Options.td
57–58 ↗(On Diff #203008)

Interesting, I've always interpreted it as -require-defined.

This revision is now accepted and ready to land.Jun 4 2019, 3:36 PM
ruiu added a comment.Jun 4 2019, 6:34 PM

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.

orgads accepted this revision.Jun 4 2019, 8:48 PM
orgads added a subscriber: orgads.

Solves the problem for me. Thanks!

mstorsjo updated this revision to Diff 203428.Jun 6 2019, 1:05 PM
mstorsjo edited the summary of this revision. (Show Details)

Mimic the real -u option behavior properly.

ruiu accepted this revision.Jun 7 2019, 1:28 AM

LGTM

This revision was automatically updated to reflect the committed changes.