This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Allow linking with ABI compatible architectures
ClosedPublic

Authored by thevinster on Jul 27 2022, 11:31 PM.

Details

Reviewers
int3
Group Reviewers
Restricted Project
Commits
rGf030132c72d9: [lld-macho] Allow linking with ABI compatible architectures
Summary

Linking fails when targeting x86_64-apple-darwin for runtimes. The issue
is that LLD strictly assumes the target architecture be present in the tbd
files (which isn't always true). For example, when targeting x86_64h, it should
work with x86_64 because they are ABI compatible. This is also inline with what
ld64 does.

An environment variable (which ld64 also supports) is also added to preserve the
existing behavior of strict architecture matching.

Diff Detail

Event Timeline

thevinster created this revision.Jul 27 2022, 11:31 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 27 2022, 11:31 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

clang-format

thevinster edited the summary of this revision. (Show Details)Jul 27 2022, 11:47 PM
thevinster published this revision for review.Jul 27 2022, 11:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2022, 11:48 PM
thevinster edited the summary of this revision. (Show Details)Jul 27 2022, 11:51 PM
int3 accepted this revision.Jul 28 2022, 12:00 PM
int3 added a subscriber: int3.

lgtm

lld/MachO/InputFiles.cpp
1877–1881
1896–1897

we can move this to line 1888 I think? doesn't seem like computing archSet is necessary if forceExactCpuSubtypeMatch == true

This revision is now accepted and ready to land.Jul 28 2022, 12:00 PM
thevinster marked 2 inline comments as done.Jul 28 2022, 5:10 PM