[all-commits] [llvm/llvm-project] 381df1: Clang Driver: Use Apple ld64's new @response-file ...

James Y Knight via All-commits all-commits at lists.llvm.org
Mon Jun 29 15:27:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 381df1653c927efa9dac86c24a9db2b98f270de0
      https://github.com/llvm/llvm-project/commit/381df1653c927efa9dac86c24a9db2b98f270de0
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-06-29 (Mon, 29 Jun 2020)

  Changed paths:
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Driver/ToolChains/Darwin.h

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

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.

Differential Revision: https://reviews.llvm.org/D82777


  Commit: 4772b99dffec4f87bb7bc9273495066058ac0186
      https://github.com/llvm/llvm-project/commit/4772b99dffec4f87bb7bc9273495066058ac0186
  Author: James Y Knight <jyknight at google.com>
  Date:   2020-06-29 (Mon, 29 Jun 2020)

  Changed paths:
    M clang/include/clang/Driver/Job.h
    M clang/include/clang/Driver/Tool.h
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/Job.cpp
    M clang/lib/Driver/Tool.cpp
    M clang/lib/Driver/ToolChains/AIX.cpp
    M clang/lib/Driver/ToolChains/AMDGPU.cpp
    M clang/lib/Driver/ToolChains/AMDGPU.h
    M clang/lib/Driver/ToolChains/AVR.cpp
    M clang/lib/Driver/ToolChains/AVR.h
    M clang/lib/Driver/ToolChains/Ananas.cpp
    M clang/lib/Driver/ToolChains/Ananas.h
    M clang/lib/Driver/ToolChains/BareMetal.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/Clang.h
    M clang/lib/Driver/ToolChains/CloudABI.cpp
    M clang/lib/Driver/ToolChains/CloudABI.h
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/CrossWindows.cpp
    M clang/lib/Driver/ToolChains/CrossWindows.h
    M clang/lib/Driver/ToolChains/Cuda.cpp
    M clang/lib/Driver/ToolChains/Cuda.h
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Driver/ToolChains/Darwin.h
    M clang/lib/Driver/ToolChains/DragonFly.cpp
    M clang/lib/Driver/ToolChains/DragonFly.h
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Driver/ToolChains/FreeBSD.cpp
    M clang/lib/Driver/ToolChains/FreeBSD.h
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/Gnu.h
    M clang/lib/Driver/ToolChains/HIP.cpp
    M clang/lib/Driver/ToolChains/Hexagon.cpp
    M clang/lib/Driver/ToolChains/Hexagon.h
    M clang/lib/Driver/ToolChains/InterfaceStubs.cpp
    M clang/lib/Driver/ToolChains/MSP430.cpp
    M clang/lib/Driver/ToolChains/MSP430.h
    M clang/lib/Driver/ToolChains/MSVC.cpp
    M clang/lib/Driver/ToolChains/MSVC.h
    M clang/lib/Driver/ToolChains/MinGW.cpp
    M clang/lib/Driver/ToolChains/MinGW.h
    M clang/lib/Driver/ToolChains/Minix.cpp
    M clang/lib/Driver/ToolChains/Minix.h
    M clang/lib/Driver/ToolChains/Myriad.cpp
    M clang/lib/Driver/ToolChains/Myriad.h
    M clang/lib/Driver/ToolChains/NaCl.cpp
    M clang/lib/Driver/ToolChains/NaCl.h
    M clang/lib/Driver/ToolChains/NetBSD.cpp
    M clang/lib/Driver/ToolChains/NetBSD.h
    M clang/lib/Driver/ToolChains/OpenBSD.cpp
    M clang/lib/Driver/ToolChains/OpenBSD.h
    M clang/lib/Driver/ToolChains/PS4CPU.cpp
    M clang/lib/Driver/ToolChains/PS4CPU.h
    M clang/lib/Driver/ToolChains/RISCVToolchain.cpp
    M clang/lib/Driver/ToolChains/RISCVToolchain.h
    M clang/lib/Driver/ToolChains/Solaris.cpp
    M clang/lib/Driver/ToolChains/WebAssembly.cpp
    M clang/lib/Driver/ToolChains/WebAssembly.h
    M clang/lib/Driver/ToolChains/XCore.cpp

  Log Message:
  -----------
  Clang Driver: refactor support for writing response files to be
specified at Command creation, rather than as part of the Tool.

This resolves the hack I just added to allow Darwin toolchain to vary
its level of support based on `-mlinker-version=`.

The change preserves the _current_ settings for response-file support.
Some tools look likely to be declaring that they don't support
response files in error, however I kept them as-is in order for this
change to be a simple refactoring.

Differential Revision: https://reviews.llvm.org/D82782


Compare: https://github.com/llvm/llvm-project/compare/bdcd20062933...4772b99dffec


More information about the All-commits mailing list