Page MenuHomePhabricator

[llvm-link] use file magic when deciding if input should be loaded as archive
ClosedPublic

Authored by sdmitriev on Dec 1 2020, 2:45 AM.

Details

Summary

llvm-link should not rely on the '.a' file extension when deciding if input file
should be loaded as archive. Archives may have other extensions (f.e. .lib) or no
extensions at all. This patch changes llvm-link to use llvm::file_magic to check
if input file is an archive.

Diff Detail

Event Timeline

sdmitriev created this revision.Dec 1 2020, 2:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2020, 2:45 AM
sdmitriev requested review of this revision.Dec 1 2020, 2:45 AM

I guess the buffer part could be committed first but I'd be OK with this as is. Let's give others a chance to comment.

This revision is now accepted and ready to land.Dec 1 2020, 2:50 PM
sdmitriev updated this revision to Diff 309108.Dec 2 2020, 5:15 PM

Added BinaryFormat to the list of components that need to be linked.