This is an archive of the discontinued LLVM Phabricator instance.

Implements /force:multiple in lld-link
Needs ReviewPublic

Authored by ryan on Jun 29 2018, 1:15 AM.

Details

Reviewers
ruiu
compnerd
Summary

link.exe's /force:multiple is described here:
https://docs.microsoft.com/en-us/cpp/build/reference/force-force-file-output

lld-link with this /force:multiple implementation does not seem to do exactly
what link.exe is doing. But, the Microsoft documentation is fairly clear that
the behavior this option causes in the generated executables is undefined.

Diff Detail

Event Timeline

ryan created this revision.Jun 29 2018, 1:15 AM
ruiu added a comment.Jul 2 2018, 2:14 AM

Can you add a test?

COFF/SymbolTable.cpp
62

just_warn -> JustWarn

359

Do you have to change this

375

and this?

ryan added inline comments.Jul 12 2018, 6:45 PM
COFF/SymbolTable.cpp
359

I don't know. It just felt in the spirit of /force:multiple to use the existing symbol. (Doesn't impact me personally, I was just wanted /force for function symbols).

Do you think it's better to return null in this case? (There's other options here too, e.g. forcing the replaceSymbol case when /force:multiple is on.)

ruiu added inline comments.Jul 13 2018, 6:46 AM
COFF/SymbolTable.cpp
359

Yeah, it probably makes sense to use the first symbol rather than the last one. I just couldn't understand what this change is for. Could you add a testcase that covers this case?