Add -gcc-toolchain
flag to swift-driver
#1307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GCC toolchains are useful when cross-compiling to Linux with a given gcc toolchain. The gcc toolchain contains tools for linking, libraries for linking against, and the headers that map to those libraries.
This patch adds a
-gcc-toolchain
flag to the driver so that Swift can pass that information down to both the clang importer and clang linker appropriately.I went with the double-dash, equals format passed to clang because maskray keeps poking at the clang flags and that format is the only one that goes all of the way back (to 2013). I'm also passing the path down directly instead of reinterpreting them as an absolute path. The driver seems to use the
-working-directory
path to resolve most of these instead of the current working directory path, which I believe is inconsistent with Clang. Letting clang deal with the paths will, by definition, be consistent with clang. Yes, little Bobby Tables is waiting to make a mess of things.