This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Fix default LTO triple
AbandonedPublic

Authored by keith on Mar 3 2023, 12:39 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

In the case you pass -object_path_lto without any IR files, the LTO
infrastructure attempts to derive the default triple and fails if none
is found. This sets the default triple to the one we've derived from
-platform_version / -arch.

Fixes https://github.com/llvm/llvm-project/issues/61031

Diff Detail

Event Timeline

keith created this revision.Mar 3 2023, 12:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 3 2023, 12:39 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
keith requested review of this revision.Mar 3 2023, 12:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 12:39 PM
int3 added a subscriber: int3.Mar 3 2023, 12:46 PM

Huh, I'm surprised that setting -object_path_lto has a functional difference; I thought it was only to make debugging the intermediate object files easier. Did you figure out why?

Also, did you figure out why LLD-ELF doesn't seem to need to set DefaultTriple?

lld/test/MachO/lto-object-path.ll
5

how does compiling with llc different from compiling with opt?

keith added a comment.Mar 3 2023, 1:29 PM

Huh, I'm surprised that setting -object_path_lto has a functional difference; I thought it was only to make debugging the intermediate object files easier. Did you figure out why?

Also, did you figure out why LLD-ELF doesn't seem to need to set DefaultTriple?

so the difference with elf is it just avoids this work all together, here's a patch with that option https://reviews.llvm.org/D145273 and the original commit for that logic https://github.com/llvm/llvm-project/commit/f3994e4dfa0214b2a09a0e327ba37e6b38bbcdb3

with this patch the object_path_lto file ends up getting created and is empty, so technically the other patch would be less work, although I doubt it's meaningful perf wise

lld/test/MachO/lto-object-path.ll
5

the difference is that we want an object file here and the opt calls are producing bitcode files

int3 added inline comments.Mar 3 2023, 1:41 PM
lld/test/MachO/lto-object-path.ll
5

d'oh, of course :)