swift
8dd8fc0c - Add -Xclang-linker option to the compiler. (#20441)

Commit
6 years ago
Add -Xclang-linker option to the compiler. (#20441) In the Darwin toolchain the linker is invoked directly, and compiler_rt is used if it is found, but in Unix platforms, clang++ is invoked instead, and the clang driver will invoke the linker. Howerver there was no way of modifying this clang++ invocation, so there's no way of providing `--rtlib=` and change the platform default (which is normally libgcc). The only workaround is doing the work that the Swift driver is doing "manually". The change adds a new option (with help hidden, but we can change that) to allow providing extra arguments to the clang++ invocation. The change is done in the two places in the Unix and Windows toolchains that I found the clang driver was being used. Includes some simple tests.
Author
Committer
Parents
  • include/swift/Option
    • Options.td
  • lib/Driver
    • File
      UnixToolChains.cpp
    • File
      WindowsToolChains.cpp
  • test/Driver
    • File
      linker.swift