This is an archive of the discontinued LLVM Phabricator instance.

[llvm-libtool-darwin] Add support for -dependency_info
ClosedPublic

Authored by keith on Sep 20 2022, 3:40 PM.

Details

Summary

When using llvm-libtool-darwin as a drop in replacement for cctools
libtool, Xcode expects you to create a dependency info file. This file
is a very simple format describing the input files, the output files,
and the version of the tool. This logic is mirrored from that of
ld64.lld, which supports creating this file as well. Ideally we could
extract it, but I don't think we want to throw this into one of the
grab-bag libraries given how small the logic is.

Diff Detail

Event Timeline

keith created this revision.Sep 20 2022, 3:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 3:40 PM
Herald added a subscriber: mgrang. · View Herald Transcript
keith requested review of this revision.Sep 20 2022, 3:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 3:40 PM
oontvoo added inline comments.
llvm/tools/llvm-libtool-darwin/DependencyInfo.h
47

Is this intentional? (ie., logging to errs()? ) I wonder if there's a "debug()" or something similar so that it'd look less suspicious)

56

nit: could use StringRef here? (given we're not modifying the strings, so no need for the extra copies?)

keith updated this revision to Diff 461919.Sep 21 2022, 9:11 AM
keith marked 2 inline comments as done.

Remove debug prints, use StringRef to avoid copies

oontvoo accepted this revision.Sep 21 2022, 12:48 PM

LG (with a nit)

(I don't know who else needs to stamp this)

llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
665

[nit] How important is performance for this tool, do you know? Is it worth removing the if (Active) check in the DependencyInfo class, and instead movign the logic here so that the check is done only once:

GlobalDependencyInfo = DependencyInfoPath.empty() 
                                                ? std::make_unique<DummyDependencyInfo>()  // A subclass that doesn't do anything
                                                : std::make_unique<DependencyInfo>(DependencyInfoPath);
This revision is now accepted and ready to land.Sep 21 2022, 12:48 PM
keith updated this revision to Diff 462048.Sep 21 2022, 5:02 PM
keith marked an inline comment as done.

Use a dummy class in the case this is disabled

This revision was landed with ongoing or failed builds.Oct 3 2022, 9:54 AM
This revision was automatically updated to reflect the committed changes.