Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -gcc-toolchain flag to swift-driver #1307

Merged
merged 1 commit into from Apr 12, 2023

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Mar 7, 2023

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.

@etcwilde
Copy link
Member Author

etcwilde commented Mar 7, 2023

@swift-ci please test

@artemcm
Copy link
Contributor

artemcm commented Mar 7, 2023

@etcwilde from what I gather Options.swift was modified manually?
Sorry, for now the flag needs to be added to the main Swift repo first, and then this repo updated with:
https://github.com/apple/swift-driver#rebuilding-optionsswift

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 down to both the clang importer and clang linker
appropriately.
@etcwilde etcwilde force-pushed the ewilde/driver-gcc-toolchain-flag branch from 4d5c8c1 to 72ed3ac Compare April 12, 2023 17:49
@etcwilde
Copy link
Member Author

apple/swift#65108

@swift-ci please test

@etcwilde etcwilde merged commit 302ab58 into apple:main Apr 12, 2023
3 checks passed
@etcwilde etcwilde deleted the ewilde/driver-gcc-toolchain-flag branch April 12, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants