Page MenuHomePhabricator

Clang Driver: Use Apple ld64's new @response-file support.
ClosedPublic

Authored by jyknight on Jun 29 2020, 8:53 AM.

Details

Summary

In XCode 12, ld64 got support for @files, in addition to the old
-filelist mechanism. Response files allow passing all command-line
arguments to the linker via a file, rather than just filenames, and is
therefore preferred.

Because of the way response-file support is currently implemented as
part of the Tool class in Clang, this change requires an ugly backdoor
function to access Args. A follow-up commit fixes this, but I've
ordered this change first, for easier backportability.

I've added no tests here, because unfortunately, there don't appear to
be _any_ response-file emission automated tests, and I don't see an
obvious way to add them. I've tested that this change works as
expected locally.

Diff Detail

Event Timeline

jyknight created this revision.Jun 29 2020, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2020, 8:53 AM
steven_wu accepted this revision.Jun 29 2020, 10:22 AM

LGTM.

Agree this is ugly but the clean up looks fine. Not sure how to write a test as well but I can see the @ file path is triggered correctly.

This revision is now accepted and ready to land.Jun 29 2020, 10:22 AM
This revision was automatically updated to reflect the committed changes.
keith added a subscriber: keith.Aug 7 2020, 8:26 AM

BTW, to the apple folks here, it'd sure be awesome if this could be backported into XCode 12's clang. :) (c.f. FB7037642).

got it, we'll do what we can to release it as soon as possible in Xcode