This is an archive of the discontinued LLVM Phabricator instance.

Unify the code that updates the ArchSpec after finding a fat binary with how it is done for a lean binary
ClosedPublic

Authored by aprantl on Jul 31 2020, 2:59 PM.

Details

Summary

In particular this affects how target create --arch is handled — it allowed us to override the deployment target (a useful feature for the expression evaluator), but the fat binary case didn't.

rdar://problem/66024437

Diff Detail

Event Timeline

aprantl requested review of this revision.Jul 31 2020, 2:59 PM
aprantl created this revision.

It would be nice to (in a follow-up-patch) clearly state what this function's goal is and then re-implement it with slightly fewer fallbacks. The code as it is is very convoluted.

davide added a subscriber: davide.Aug 5 2020, 4:08 PM
davide added inline comments.
lldb/source/Target/TargetList.cpp
110–111

Is this check strict enough? I thought it should be only TripleOSWasSpecified -- what we can infer from the vendor?

aprantl added inline comments.Aug 5 2020, 5:36 PM
lldb/source/Target/TargetList.cpp
159

this is wrong. it should be at line 132!

Thanks @jingham !

aprantl updated this revision to Diff 283669.Aug 6 2020, 10:59 AM

Address review feedback.

aprantl added inline comments.Aug 6 2020, 12:06 PM
lldb/source/Target/TargetList.cpp
110–111

Git archeology says that this comes from 3f19ada88e24008b24a5db20b7f78f5cff525a0b / SVN r212783.
Quoting: - Fixed the coded in TargetList::CreateTarget() so it does the right thing with an underspecified triple where just the arch is specified.

I think it's specifically supposed to detect a triple with just a CPU, which is what we get from target create --arch. I think your comment still rings true.

jasonmolenda added inline comments.Aug 6 2020, 1:13 PM
lldb/source/Target/TargetList.cpp
140–141

Should this conditional be replaced with your update_platform_arch lambda?

jasonmolenda accepted this revision.Aug 6 2020, 1:15 PM

LGTM, it's hard to keep all the supported behaviors in my head but I think this is right.

This revision is now accepted and ready to land.Aug 6 2020, 1:15 PM
aprantl added inline comments.Aug 6 2020, 1:26 PM
lldb/source/Target/TargetList.cpp
140–141

Yes!

Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2020, 1:30 PM